Skip to content

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.

2.0 KB
Raw Blame
// SPDX-License-Identifier: AGPL-3.0-only
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.

/** Shared config constants, deliberately free of `"use client"`.
 *
 *  Server components (the MCP page) interpolate these into build-time code samples
 *  while client components read them at render, so they cannot live in the client
 *  module: importing across that boundary hands the server a client reference
 *  rather than the primitive string. */

/** REST base for Carbon Cloud, and the literal baked into every generated sample. */
export const DEFAULT_API_BASE = "https://rest.carbon.ms";

/** App host for Carbon Cloud, where Settings and the MCP server live. */
export const DEFAULT_APP_ORIGIN = "https://app.carbon.ms";

export const DEFAULT_MCP_ENDPOINT = `${DEFAULT_APP_ORIGIN}/api/mcp`;

/** Carbon Cloud regions for the CARBON API — app origins, since `/api/v1` is served
 *  by the app rather than the REST host. The US and ITAR values are the same two
 *  `getAppUrl()` falls back to in `packages/env`; keep them in step.
 *
 *  Deliberately NOT the Data API's list: that plane is one `rest.` host plus a
 *  self-hosted escape, and is configured on its own. */
export const CARBON_REGIONS = [
  { id: "us", label: "US", origin: DEFAULT_APP_ORIGIN },
  { id: "eu", label: "EU", origin: "https://app.eu.carbon.ms" },
  { id: "itar", label: "ITAR", origin: "https://itar.carbon.ms" }
] as const;

export type CarbonRegionId = (typeof CARBON_REGIONS)[number]["id"];

/** Stand-in for the origin when we don't know which instance the reader is on.
 *  Mirrors the `<api-key>` convention: obviously a placeholder when copy-pasted. */
export const HOST_PLACEHOLDER = "<your-host>";

/** Query params the ERP adds to its docs links: the deployment's REST origin and,
 *  because the two are configured independently, its app origin. */
export const HOST_PARAM = "host";
export const APP_PARAM = "app";