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.

feat: remove deprecated API documentation routes

fiber[bot]101d46e1e5d8
diff --git a/apps/erp/app/routes/x+/api+/$lang.intro.tsx b/apps/erp/app/routes/x+/api+/$lang.intro.tsx
deleted file mode 100644
index 97f990c615..0000000000
--- a/apps/erp/app/routes/x+/api+/$lang.intro.tsx
+++ /dev/null
@@ -1,90 +0,0 @@
-import { getBrowserEnv, SUPABASE_ANON_KEY } from "@carbon/auth";
-import { Alert, AlertDescription, AlertTitle } from "@carbon/react";
-import { LuTriangleAlert } from "react-icons/lu";
-import { Link } from "react-router";
-import { useUser } from "~/hooks";
-import { CodeSnippet, Snippets, useSelectedLang } from "~/modules/api";
-import { path } from "~/utils/path";
-
-const { SUPABASE_URL } = getBrowserEnv();
-
-export default function Route() {
- const { company } = useUser();
- const selectedLang = useSelectedLang();
- return (
- <>
- <h2 className="doc-heading">Authentication</h2>
- <div className="doc-section">
- <article className="code-column text-foreground">
- <p>Carbon uses API token authentication for the public API.</p>
- <p>
- First you'll need an <Link to={path.to.apiKeys}>API Key</Link>.
- </p>
- <p>Next save the API Key as an Environment Variable.</p>
- <article>
- <CodeSnippet
- selectedLang={selectedLang}
- snippet={Snippets.env({
- appUrl: window.location.origin,
- apiKey: "<your-api-key>",
- publicKey: SUPABASE_ANON_KEY,
- apiUrl: SUPABASE_URL,
- companyId: company?.id
- })}
- />
- </article>
- <p>
- The API Key is provided via the <code>carbon-key</code> header when
- making requests to the API.
- </p>
- </article>
- </div>
- {selectedLang == "js" ? (
- <>
- <h2 className="doc-heading">Client Library SDK</h2>
- <div className="doc-section">
- <article className="code-column text-foreground">
- <p>
- The easiest way to interact with the public API is via the
- JavaScript Client Library SDK.
- </p>
- <p>
- To initialize the Client Library SDK, you will need the
- environment variables you set up earlier.
- </p>
- <Alert variant="destructive">
- <LuTriangleAlert className="h-4 w-4 my-1" />
- <AlertTitle className="!my-0 font-bold text-base">
- You should never expose the <code>carbon-key</code> in the
- client
- </AlertTitle>
- <AlertDescription>
- Your API key gives full access to your database. Never expose
- it in a public-facing client.
- </AlertDescription>
- </Alert>
-
- <p>
- As with your API Key, we recommend setting your Client Key as an
- Environment Variable.
- </p>
- <p>Initialize the client as follows:</p>
- <div className="doc-section doc-section--client-libraries">
- <article className="code">
- <CodeSnippet
- selectedLang={selectedLang}
- snippet={Snippets.init(SUPABASE_URL)}
- />
- </article>
- </div>
- <p>
- You can now make requests to the API using the client. See the
- specific tables and views for more details.
- </p>
- </article>
- </div>
- </>
- ) : null}
- </>
- );
-}
diff --git a/apps/erp/app/routes/x+/api+/$lang.rpc.$id.tsx b/apps/erp/app/routes/x+/api+/$lang.rpc.$id.tsx
deleted file mode 100644
index da90098c64..0000000000
--- a/apps/erp/app/routes/x+/api+/$lang.rpc.$id.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import { useSwaggerDocs } from "~/hooks/useSwaggerDocs";
-import { useSelectedLang } from "~/modules/api";
-import { snakeToCamel } from "~/utils/string";
-
-const functionPath = "rpc/";
-
-export default function Route() {
- const swaggerDocsSchema = useSwaggerDocs();
- //
- // biome-ignore lint/correctness/noUnusedVariables: suppressed due to migration
- const { rpcs } = Object.entries(swaggerDocsSchema?.paths || {}).reduce(
- (a, [name]) => {
- const trimmedName = name.slice(1);
- const id = trimmedName.replace(functionPath, "");
-
- const displayName = id.replace(/_/g, " ");
- const camelCase = snakeToCamel(id);
- const enriched = { id, displayName, camelCase };
-
- if (!trimmedName.length) {
- return a;
- }
-
- return {
- rpcs: {
- ...a.rpcs,
- ...(trimmedName.includes(functionPath)
- ? {
- [id]: enriched
- }
- : {})
- }
- };
- },
- { rpcs: {} }
- );
- // biome-ignore lint/correctness/noUnusedVariables: suppressed due to migration
- const selectedLang = useSelectedLang();
-
- return null;
-}
diff --git a/apps/erp/app/routes/x+/api+/$lang.table.$id.tsx b/apps/erp/app/routes/x+/api+/$lang.table.$id.tsx
deleted file mode 100644
index 1f6b7ddd26..0000000000
--- a/apps/erp/app/routes/x+/api+/$lang.table.$id.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { getBrowserEnv } from "@carbon/auth";
-import { useParams } from "react-router";
-import { TableDocs, useSelectedLang } from "~/modules/api";
-
-const { SUPABASE_URL } = getBrowserEnv();
-
-export default function Route() {
- const selectedLang = useSelectedLang();
- const { id } = useParams();
- if (!id) throw new Error("Table id not found");
-
- return (
- <TableDocs
- endpoint={SUPABASE_URL}
- selectedLang={selectedLang}
- resourceId={id}
- />
- );
-}
diff --git a/apps/erp/app/routes/x+/api+/_index.tsx b/apps/erp/app/routes/x+/api+/_index.tsx
deleted file mode 100644
index da13118823..0000000000
--- a/apps/erp/app/routes/x+/api+/_index.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-import { redirect } from "react-router";
-import { path } from "~/utils/path";
-
-export async function loader() {
- throw redirect(path.to.apiIntroduction);
-}
diff --git a/apps/erp/app/routes/x+/api+/_layout.tsx b/apps/erp/app/routes/x+/api+/_layout.tsx
deleted file mode 100644
index cb55a1024d..0000000000
--- a/apps/erp/app/routes/x+/api+/_layout.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-import { redirect } from "react-router";
-
-export async function loader() {
- // Redirect from the old protected x+ route to the new public docs+ route
- throw redirect("/docs/api/js/intro");
-}