/carbon

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.

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Carbon Logo

Screen.Recording.2024-01-16.at.11.24.50.PM.mov

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

/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 running the steps below 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
Redis redis://localhost:6379
Edge Functions http://localhost:54321/functions/v1/

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

Use the output of npm run db:start to set the following variables in .env:

  • SUPABASE_SERVICE_ROLE=[service_role key]
  • SUPABASE_ANON_PUBLIC=[anon key]

Then you can run the following:

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

Finally, start the apps and packages:

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

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