Carbon
Carbon — это открытая ERP, MES и QMS платформа для оптимизации производства. Наслаждайтесь расширяемостью с API-first подходом, полноценной типовой безопасностью на всём стеке, продвинутым контролем доступа, спецификациями материалов (BoM), планированием потребности в материалах (MRP) и прослеживаемостью.
Carbon — это операционная система с открытым исходным кодом для производства, предоставляющая интегрированный набор функций ERP, MES и QMS. Разработанная для устранения ограничений традиционных производственных систем, она предлагает современные инстру
The operating system for manufacturing
Discord
·
Website
·
Documentation
We built Carbon after years of building end-to-end manufacturing systems with off-the-shelf solutions. We realized that:
- Modern, API-first tooling didn't exist
- Vendor lock-in bordered on extortion
- There is no "perfect ERP" because each company is unique
We built Carbon to solve these problems ☝️
Carbon is designed to make it easy for you to extend the platform by building your own apps through our API. We provide some examples to get you started in the examples folder.
Features:
- ERP
- MES
- QMS
- Custom Fields
- Nested BoM
- Traceability
- MRP
- Configurator
- MCP Client/Server
- API
- Webhooks
- Accounting
- Capacity Planning
- Simulation
- Full Roadmap
Technical highlights:
- Unified auth and permissions across apps
- Full-stack type safety (Database → UI)
- Realtime database subscriptions
- Attribute-based access control (ABAC)
- Role-based access control (Customer, Supplier, Employee)
- Row-level security (RLS)
- Composable user groups
- Dependency graph for operations
- Third-party integrations
- React Router – framework
- Typescript – language
- Tailwind – styling
- Radix UI - behavior
- Supabase - database
- Supabase – auth
- Redis - cache
- Inngest - jobs
- Resend – email
- Lingui - i18n
- Novu – notifications
- Vercel – hosting
- Stripe - billing
The monorepo follows the Turborepo convention of grouping packages into one of two folders.
/appsfor applications/packagesfor shared code
| Package Name | Description | Local Command |
|---|---|---|
erp |
ERP Application | npm run dev |
mes |
MES | npm run dev:mes |
academy |
Academy | npm run dev:academy |
starter |
Starter | npm run dev:starter |
| Package Name | Description |
|---|---|
@carbon/database |
Database schema, migrations and types |
@carbon/documents |
Transactional PDFs and email templates |
@carbon/ee |
Integration definitions and configurations |
@carbon/config |
Shared configuration (vitest, tsconfig, tailwind) across apps and packages |
@carbon/jobs |
Background jobs and workers |
@carbon/logger |
Shared logger used across apps |
@carbon/react |
Shared web-based UI components |
@carbon/kv |
Redis cache client |
@carbon/lib |
Third-party client libraries (slack, resend) |
@carbon/stripe |
Stripe integration |
@carbon/utils |
Shared utility functions used across apps and packages |
-
Clone the repo into a public GitHub repository (or fork https://github.com/crbnos/carbon/fork). If want to make the repo private, you should acquire a commercial license to comply with the AGPL license.
git clone https://github.com/crbnos/carbon.git
-
Go to the project folder
cd carbon
Make sure that you have Docker installed on your system since this monorepo uses the Docker for local development.
In addition you must configure the following external services:
| Service | Purpose | URL |
|---|---|---|
| Posthog | Product analytics platform | https://us.posthog.com/signup |
| Stripe | Payments service | https://dashboard.stripe.com/login |
| Resend | Email service | https://resend.com |
| Novu | Notifications service | https://dashboard.novu.co/auth/sign-in |
Posthog has a free tier which should be plenty to support local development. If you're self hosting and you don't want to use Posthog, it's pretty easy to remove the analytics.
First download and initialize the repository dependencies.
$ nvm use # use node v20
$ npm install # install dependencies
$ npm run db:start # pull and run the containersCreate an .env file and copy the contents of .env.example file into it
$ cp ./.env.example ./.env- Social Sign In: Signing in requires you to setup one of two methods:
- Email requires a Resend API key (you'll set this up later on)
- Sign-in with Google requires a Google auth client with these variables. See the Supabase docs for instructions on how to set this up:
- Set
Authorized JavaScript originsto onlyhttp://127.0.0.1:54321 - Set
Authorized redirect URIstohttp://127.0.0.1:54321/auth/v1/callback
- Set
- You should set environment variables like the following.
SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID="******.apps.googleusercontent.com"SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_SECRET="GOCSPX-****************"
- Supabase: Start up the backend services using
npm run db:start. Find the following values in its output to set the supabase entries:
SUPABASE_SERVICE_ROLE_KEY=[service_role key]SUPABASE_ANON_KEY=[anon key]
- Redis (Caching): Set up a Redis instance (local or cloud) and add the connection URL. You can set one up in the cloud easily using Upstash:
REDIS_URL=[redis://user:password@host:port]
- Posthog (Analytics): 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]POSTHOG_PROJECT_PUBLIC_KEY=[Project API Key starting 'phc*']
- Stripe (Payment service) - Create a stripe account, add a
STRIPE_SECRET_KEYfrom the StripeSettings > Developersinterface
STRIPE_SECRET_KEY="sk_test_*************"
- Resend (Email service) - Create a Resend account and configure:
RESEND_API_KEY="re_**********"RESEND_DOMAIN="carbon.ms"(or your domain, no trailing slashes or protocols)RESEND_AUDIENCE_ID="*****"(Optional - required for contact management inpackages/jobs)
Resend is used for transactional emails (user invitations, email verification, onboarding). All three variables are stored in packages/auth/src/config/env.ts.
- Novu (In-app notifications) - Create a Novu account and configure:
NOVU_APPLICATION_ID="********************"(Client-side, public)NOVU_SECRET_KEY="********************"(Server-side secret, backend only)
Novu is used for in-app notifications and notification workflows. After standing up the application and tunnelling port 3000, sync your Novu workflows:
npm run novu:syncThis command syncs your Novu workflows with the Carbon application using the bridge URL.
Finally, start the apps and packages:
$ npm run dev
$ npm run dev:mes # npm run dev in all apps & packagesAfter installation you should be able run the apps locally.
| Application | URL |
|---|---|
| ERP | http://localhost:3000 |
| MES | http://localhost:3001 |
| Academy | http://localhost:4111 |
| Starter | http://localhost:4000 |
| Background Jobs | http://localhost:8288 |
| Postgres | postgresql://postgres:postgres@localhost:54322/postgres |
| Supabase Studio | http://localhost:54323/project/default |
| Mailpit | http://localhost:54324 |
| Edge Functions | http://localhost:54321/functions/v1/ |
This project uses Biome for code formatting and linting. To set up automatic formatting on save in VS Code:
-
Install the Biome VS Code extension
-
Add the following to your VS Code settings (
.vscode/settings.jsonor global settings):
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"source.fixAll.biome": "explicit"
},
"editor.defaultFormatter": "biomejs.biome"To add an edge function
$ npm run db:function:new <name>To add a database migration
$ npm run db:migrate:new <name>To add an AI agent
$ npm run agent:new <name>To add an AI tool
$ npm run tool:new <name>To kill the database containers in a non-recoverable way, you can run:
$ npm run db:kill # stop and delete all database containersTo restart and reseed the database, you can run:
$ npm run db:build # runs db:kill, db:start, and setupTo 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
To restore a production database locally:
- Download the production database as a .backup file
- Rename the
migrationsfolder to_migrations - Restore the database with the following command:
$ npm run db:build # this should error out at the seed step
$ PGPASSWORD=postgres psql -h localhost -p 54322 -U supabase_admin -d postgres < ~/Downloads/db_cluster-17-11-2025@09-03-36.backup
$ npm run dev- Rename the
_migraitonsfolder back tomigrations
The API documentation is located in the ERP app at ${ERP}/x/api/js/intro. It is auto-generated based on changes to the database.
There are two ways to use the API:
- From another codebase using a supabase client library:
- From within the codebase using our packages.
First, set up the necessary credentials in environment variables. For the example below:
- Navigate to settings in the ERP to generate an API key. Set this in
CARBON_API_KEY - Get the Supabase URL to call (this is
SUPABASE_URLin your.envif hosting locally, e.g. http://localhost:54321). Set this asCARBON_API_URL. - Get the
SUPABASE_ANON_KEYe.g. from your .env file. Set this asCARBON_PUBLIC_KEY.
If you're self-hosting you can also use the supabase service key instead of the public key for root access. In that case you don't need to include the carbon-key header.
import { Database } from "@carbon/database";
import { createClient } from "@supabase/supabase-js";
const apiKey = process.env.CARBON_API_KEY;
const apiUrl = process.env.CARBON_API_URL;
const publicKey = process.env.CARBON_PUBLIC_KEY;
const carbon = createClient<Database>(apiUrl, publicKey, {
global: {
headers: {
"carbon-key": apiKey,
},
},
});
// returns items from the company associated with the api key
const { data, error } = await carbon.from("item").select("*");import { getCarbonServiceRole } from "@carbon/auth/client.server";
const carbon = getCarbonServiceRole();
// returns all items across companies
const { data, error } = await carbon.from("item").select("*");
// returns items from a specific company
const companyId = "xyz";
const { data, error } = await carbon
.from("item")
.select("*")
.eq("companyId", companyId);In order to run npm run translate you must first run:
brew install ollama
brew services start ollama
ollama pull llama3.2
curl http://localhost:11434/api/tags
npx linguito config set \
llmSettings.provider=ollama \
llmSettings.url=http://127.0.0.1:11434/apiBackground jobs have been migrated from Trigger.dev to Inngest. Key changes:
- Job definitions moved from
packages/jobs/trigger/topackages/jobs/src/inngest/functions/ - Triggering jobs from app code uses
trigger()andbatchTrigger()from@carbon/jobsinstead oftasks.trigger()from@trigger.dev/sdk - Inngest dev server runs via
npx inngest-cli@latest dev -u http://localhost:3000/api/inngest - Environment variables:
TRIGGER_SECRET_KEY,TRIGGER_API_URL, andTRIGGER_PROJECT_IDare no longer needed. SetINNGEST_EVENT_KEYandINNGEST_SIGNING_KEYinstead (not required for local dev).
The caching layer (@carbon/kv) no longer depends on Upstash. A standard Redis instance is used instead. The REDIS_URL environment variable still applies, but you can point it at any Redis-compatible server (including a local Docker container).
Carbon — операционная система для производства
Carbon — это открытая платформа для управления производством, объединяющая ERP, MES, QMS и другие модули. В отличие от традиционных решений, Carbon спроектирована как API-first и расширяемая система, которую можно адаптировать под уникальные процессы конкретного предприятия.
Веб-сайт • Документация • Discord • Дорожная карта
Ключевые возможности
- ERP, MES, QMS, MRP, управление конфигурациями и учёт
- Вложенные спецификации (Nested BoM), прослеживаемость и планирование мощностей
- Пользовательские поля, вебхуки, API, MCP-клиент/сервер
- Документооборот (PDF, email-шаблоны), фоновые задачи, уведомления
- Многоарендность, разграничение доступа (ABAC, RBAC, RLS), композитные группы пользователей
- Симуляция и граф зависимостей операций
Архитектура и стек
Carbon построена на монорепозитории (Turborepo) с единой системой аутентификации и разрешений. Основные технологии:
- Фреймворк: React Router
- Язык: TypeScript
- Стилизация: Tailwind + Radix UI
- База данных и аутентификация: Supabase (PostgreSQL, RLS, реальное время)
- Кэш: Redis
- Фоновые задачи: Inngest
- Почта: Resend
- Уведомления: Novu
- Аналитика: Posthog
- Платежи: Stripe
- Хостинг: Vercel
Структура репозитория
/apps
erp — ERP-приложение (npm run dev)
mes — MES-приложение (npm run dev:mes)
academy — Обучающая платформа (npm run dev:academy)
starter — Шаблон для быстрого старта (npm run dev:starter)
/packages
@carbon/database — Схема БД, миграции, типы
@carbon/documents — PDF и email-шаблоны
@carbon/ee — Определения и конфигурации интеграций
@carbon/config — Общие конфиги (vitest, tsconfig, tailwind)
@carbon/jobs — Фоновые задачи и воркеры
@carbon/logger — Логгер
@carbon/react — UI-компоненты
@carbon/kv — Redis-клиент
@carbon/lib — Клиенты сторонних сервисов (Slack, Resend)
@carbon/stripe — Интеграция Stripe
@carbon/utils — Вспомогательные функции
Быстрый старт
Требования
- Docker
- Node.js v20
- Аккаунты: Posthog, Stripe, Resend, Novu (можно бесплатные)
Установка
- Склонируйте репозиторий (если делаете приватный форк — приобретите коммерческую лицензию для соблюдения AGPL):
git clone https://github.com/crbnos/carbon.git
cd carbon
- Установите зависимости и запустите контейнеры:
nvm use
npm install
npm run db:start
-
Скопируйте
.env.exampleв.envи заполните переменные:- Supabase — ключи берутся из вывода
npm run db:start - Redis — строка подключения (например, через Upstash или локальный контейнер)
- Posthog — Project ID и API-ключ
- Stripe — секретный ключ (sk_test_...)
- Resend — API-ключ и домен
- Novu — Application ID и Secret Key
- Supabase — ключи берутся из вывода
-
Запустите приложения:
npm run dev
npm run dev:mes
Приложения будут доступны:
- ERP: http://localhost:3000
- MES: http://localhost:3001
- Academy: http://localhost:4111
- Starter: http://localhost:4000
- Supabase Studio: http://localhost:54323
- Mailpit (просмотр email): http://localhost:54324
API
Документация API генерируется автоматически и доступна в ERP-приложении по пути /x/api/js/intro.
Из внешнего кода
import { createClient } from "@supabase/supabase-js";
import type { Database } from "@carbon/database";
const carbon = createClient<Database>(process.env.CARBON_API_URL!, process.env.CARBON_PUBLIC_KEY!, {
global: { headers: { "carbon-key": process.env.CARBON_API_KEY! } },
});
const { data } = await carbon.from("item").select("*");
Из монорепозитория
import { getCarbonServiceRole } from "@carbon/auth/client.server";
const carbon = getCarbonServiceRole();
const { data } = await carbon.from("item").select("*").eq("companyId", "xyz");
Полезные команды
| Команда | Описание |
|---|---|
npm run db:migrate:new <name> |
Создать миграцию БД |
npm run db:function:new <name> |
Добавить edge-функцию |
npm run agent:new <name> |
Создать AI-агента |
npm run tool:new <name> |
Создать AI-инструмент |
npm run db:kill |
Полностью удалить контейнеры БД |
npm run db:build |
Пересобрать БД (kill + start + seed) |
npm run translate |
Автоматический перевод через Ollama + Llama 3.2 |
npm run novu:sync |
Синхронизировать workflow Novu с приложением |
Форматирование кода
Проект использует Biome. Для автоформатирования при сохранении в VS Code:
- Установите расширение Biome
- Добавьте в настройки:
{
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"source.fixAll.biome": "explicit"
},
"editor.defaultFormatter": "biomejs.biome"
}
Миграции (важные изменения)
- Trigger.dev → Inngest (февраль 2025): задачи перенесены в
packages/jobs/src/inngest/functions/. ВместоTRIGGER_*переменных используйтеINNGEST_EVENT_KEYиINNGEST_SIGNING_KEY. - Upstash → локальный Redis: кэш больше не зависит от Upstash, используйте любой Redis-совместимый сервер.
Лицензия
Проект распространяется под лицензией AGPL. Коммерческая лицензия доступна для закрытых форков.
Что такое Carbon и для чего он предназначен?
Carbon — это открытая интегрированная платформа ERP, MES и QMS, разработанная для оптимизации и управления всеми аспектами производственных операций — от планирования до контроля качества, с использованием современного расширяемого инструментария.
Какие проблемы Carbon призван решить для производителей?
Carbon решает распространенные проблемы в производстве, такие как отсутствие современных инструментов с приоритетом API, зависимость от одного вендора и потребность в высоконастраиваемой системе, способной адаптироваться к уникальным требованиям каждой компании, в отличие от жестких готовых решений.
Каковы ключевые функции и модули, входящие в состав Carbon?
Carbon предлагает интегрированные модули ERP, MES и QMS, а также такие важные функции, как Вложенная спецификация материалов (BoM), Прослеживаемость, Планирование потребности в материалах (MRP), Конфигуратор и расширенный контроль доступа (ABAC, RBAC, RLS).
Насколько расширяемой и настраиваемой является платформа Carbon?
Carbon может похвастаться архитектурой с приоритетом API и вебхуками, что обеспечивает непревзойденную расширяемость. Она поддерживает полную типобезопасность от базы данных до пользовательского интерфейса и предлагает надежный контроль доступа, позволяя компаниям создавать собственные приложения и интеграции, адаптированные к их конкретным рабочим процессам.
Какова техническая основа Carbon?
Carbon построен на современном технологическом стеке, включающем React для пользовательского интерфейса, TypeScript для полной типобезопасности, Supabase для базы данных и аутентификации, Redis для кэширования и Inngest для фоновых задач, что обеспечивает производительную и масштабируемую платформу.
Источник: https://mcpmarket.com/server/carbon-2
Комментарии
Комментариев пока нет. Будьте первым.