Skip to content

Carbon is a high-performance, open-source, single tenant (incomplete) ERP written in Typescript. It allows customers, suppliers, and employees to share a common platform that's easy to extend.

License

barbinbrad/carbon

Repository files navigation

Carbon ERP

Carbon is a high performance, open-source, single tenant (incomplete) ERP written in Typescript. It allows customers, suppliers, and employees to share a common platform that's easy to integrate with.

Technical highlights/roadmap:

  • Full-stack type safety (Database → UI)
  • Realtime database subscriptions
  • Attribute-based access control (ABAC)
  • Row-level security (RLS)
  • Composable user groups
  • Magic link authentication
  • File-based routing
  • Third-party integrations for data
  • Easy-to-use plugin system

Product highlights/roadmap are:

  • Search
  • Customer and supplier access
  • Double-entry accrual accounting
  • Stochastic scheduling/planning
  • Graph-based routing for manufacturing

Project Status

  • Pre-Alpha: Developing foundation
  • Alpha: Heavy feature development and refinement
  • Public Alpha: Ready for use. But go easy on us, there'll be bugs.
  • Public Beta: Stable enough for most non-enterprise use-cases.
  • Public: Production-ready

Techstack

Codebase

The monorepo follows the Turborepo convention of grouping packages into one of two folders.

  1. /apps for applications
  2. /packages for shared code

/apps

Package Name Description Local Command
carbon ERP Application npm run dev
docs Documentation npm run dev:docs
website Website npm run dev:website

/packages

Package Name Description
eslint-config-carbon Shared, extendable eslint configuration for apps and packages
@carbon/database Database schema, migrations and types
@carbon/documents Transactional PDFs and email templates
@carbon/jest Jest preset configuration shared across apps and packages
@carbon/logger Shared logger used across apps
@carbon/react Shared web-based UI components
@carbon/redis Redis cache client
@carbon/tsconfig Shared, extendable tsconfig configuration used across apps and packages
@carbon/utils Shared utility functions used across apps and packages

Local Development

Make sure that you have Docker installed on your system since this monorepo uses the Docker for local development.

After installation you should be able to access the following apps/containers locally:

Application URL
Carbon ERP http://localhost:3000
Postgres postgresql://postgres:postgres@localhost:54322/postgres
Supabase Studio http://localhost:54323/project/default
Inbucket http://localhost:54324/monitor
Edge Functions http://localhost:54321/functions/v1/

In addition you must configure the following external services:

Service Purpose URL
Upstash Serverless Redis https://console.upstash.com/login
Trigger.dev Job runner https://cloud.trigger.dev/login
Posthog Product analytics platform https://us.posthog.com/signup

Each of these services has a free tier which should be plenty to support local development.

Installation

First download and initialize the repository dependencies.

$ nvm use           # use node v20
$ npm install       # install dependencies
$ npm run db:start  # pull and run the containers

Create an .env file and copy the contents of .env.example file into it

$ cp ./.env.example ./.env

Add your environment variables:

  1. Use the output of npm run db:start to set the supabase entries:
  • SUPABASE_SERVICE_ROLE=[service_role key]
  • SUPABASE_ANON_PUBLIC=[anon key]
  1. Create a Redis database in upstash and copy the following from the REST API section:
  • UPSTASH_REDIS_REST_URL=[UPSTASH_REDIS_REST_URL]
  • UPSTASH_REDIS_REST_TOKEN=[UPSTASH_REDIS_REST_TOKEN]]
  1. Navigate to the project you created in https://cloud.trigger.dev/ and copy the following from the Environments & API Keys section:
  • TRIGGERPUBLIC_API_KEY=[Public 'dev' API Key, starting 'pk_dev']
  • TRIGGERAPI_KEY=[Server 'dev' API Key, starting 'tr_dev']
  1. In Posthog go to https://[region].posthog.com/project/[project-id]/settings/project-details to find your Project ID and Project API key:
  • POSTHOG_API_HOST=[https://[region].posthog.com]
  • POSTHOGPROJECT_PUBLIC_KEY=[Project API Key starting 'phc']

Then you can run the following:

$ npm run db:build     # run db migrations and seed script
$ npm run build:app    # build the app

Finally, start the apps and packages:

$ npm run dev         # npm run dev in all apps & packages

You can now sign in with:

username: admin@carbon.us.org password: carbon

Go ahead and create your own user account

Notes

To kill the database containers in a non-recoverable way, you can run:

$ npm run db:kill   # stop and delete all database containers

To restart and reseed the database, you can run:

$ npm run db:build # runs db:kill, db:start, and setup

To run a particular application, use the -w workspace flag.

For example, to run test command in the @carbon/react package you can run:

$ npm run test -w @carbon/react

Or run with the launcher.sh script

chmod +x launcher.sh # make the file executable
./launcher.sh

About

Carbon is a high-performance, open-source, single tenant (incomplete) ERP written in Typescript. It allows customers, suppliers, and employees to share a common platform that's easy to extend.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project