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
@carbon/account
The account settings modal — Profile, Appearance, Notifications, Security — shared by the ERP, the MES and the starter. Each app mounts it once in its shell; it opens over any page.
Always
- Use the two-export structure:
@carbon/account(client-safe:accountSettingsTabs,isAccountSettingsTab,accountProfileValidator, theuseAccountSettingsstore, the response types) and@carbon/account/ui(AccountSettings,AccountSettingsPane/AccountSettingsSection,ProfileForm,OtpInput/useTotpEnrollment). - The ERP owns the data. Loaders and actions live in the ERP's
routes/api+/account.{profile,notifications,security}.ts(plusmfa.*andpasskey.register.*). The MES and the starter reach them through theirx+/proxy.$.tsxroute (proxyToErp,@carbon/auth/erp-proxy.server), so the package never ships a copy. The ERP loaders end insatisfies Account*Data— change a response shape intypes.tsand the route together. - Open it through the store:
useAccountSettings((s) => s.open)(tab?).?account=<tab>on any URL also opens it (the host drops the param at once); the ERP's old/x/account/<tab>pages redirect to/x?account=<tab>. - Mount with the app's config (
AccountSettingsConfig,src/ui/context.tsx):api(/apiin the ERP,/x/proxy/apielsewhere),user,companyId. Only the ERP passesrenderBrowserNotifications(the push service worker is on its origin) andtwoFactor(the plan gate + upgrade dialog) andtransitionMode(the view-transition mode wipe, whose CSS is in the ERP's stylesheet) — seeapps/erp/app/modules/users/ui/AccountSettings.tsx. - Appearance is the one pane that does not call the ERP. Mode and theme color are
per-browser cookies on the HOST app, so the pane posts
mode/themeto the host's own root action (/), which every app'sroot.tsxhandles (modeValidator/themeColorValidatorfrom@carbon/utils).useOptimisticModeonly counts a/submission carryingmode, so the two never read each other's in-flight value. The theme grid listspickableThemes(): the everydaythemes, with the seasonal theme first while one is in season. Picking an everyday theme then switches the seasonal one off for this browser. - Panes read with
useLoaderQuery(@carbon/query), so the host app needs aQueryClientProvider,window.clientCacheandcreateInvalidationMiddlewarein its root. Strings use Lingui macros, so it also needs aLocaleProvider; the package is in the erp and mes catalogs (lingui.config.js), and the starter loads the erp catalog. - Signature (
SignatureForm, Profile pane only — notProfileForm, so nobody edits another person's signature from the person page): one dialog with Draw / Upload tabs. Draw isSignaturePad(plain canvas, speed- or pen-pressure-weighted ink, undo withSHORTCUTS.undo, exported as a trimmed PNG); Upload previews the file afterprepareImageUpload(height: 200). The browser uploads a NEW file to the privatesignaturesbucket at{userId}/{uuid}.{ext}(owner INSERT/SELECT only, no UPDATE), then postsintent=signature; the ERP'supdateOwnSignaturesavesuser.signaturePathand deletes the replaced file only when noapprovalRequest.decisionSignaturePathnames it. The profile loader returns a 5-minute signedsignatureUrl. Every reader checks a path withisOwnSignaturePath(@carbon/utils): a user can write any text into their own row.
Never
- Import from an app (
~/…). Anything app-specific comes in throughAccountSettingsConfigor a prop. - Make
ProfileFormdepend on the modal's context — the ERP's person page renders it outside the modal (photoandactionare props for that reason).
Validation Commands
pnpm --filter @carbon/account typecheck
pnpm exec turbo run typecheck --filter=erp --filter=mes --filter=starter