Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
Examples
This folder contains examples for interacting with Carbon through the API to accomplish different things.
Examples are intended to be as small as possible so that the behavior can be composed by you.
In most examples, we first define an API client like this, and then selectively add methods. Each example will have different methods to accomplish some task. For more details, we recommend checking out the .service.ts files in the /apps repo.
import type { PostgrestError, SupabaseClient } from "@supabase/supabase-js";
import { createClient } from "@supabase/supabase-js";
import {
CARBON_API_KEY,
CARBON_API_URL,
CARBON_APP_URL,
CARBON_COMPANY_ID,
CARBON_PUBLIC_KEY,
} from "~/config";
class CarbonClient {
private readonly appUrl: string = CARBON_APP_URL;
private readonly client: SupabaseClient;
private readonly companyId: string = CARBON_COMPANY_ID;
constructor() {
this.client = createClient(CARBON_API_URL, CARBON_PUBLIC_KEY, {
global: {
headers: {
"carbon-key": CARBON_API_KEY,
},
},
});
}
}
const carbon = new CarbonClient();
export { carbon };