The CLI searches upward from the current working directory for:
cms0.config.tscms0.config.jscms0.config.mjscms0.config.cjscms0.config.json
- cms0.config.ts
- cms0.ts
Recommended config
cms0.config.ts
import "dotenv/config";
import { defineConfig } from "@cms0/cms0/config";
export default defineConfig({
entry: "./src/cms0.ts",
api: {
baseUrl: process.env.CMS0_API_BASE_URL,
key: process.env.CMS0_API_KEY,
},
});Fields
| Field | Required | Description |
|---|---|---|
entry | Yes | File that calls cms0<T>(), relative to the config file |
tsconfig | No | TypeScript config used for schema analysis |
api.baseUrl | No | Runtime API base URL; when set, the CLI publishes the schema |
api.key | No | API key sent as Authorization: Bearer ... during publish |
Config and runtime client
The CLI config and runtime client usually read the same URL and key:
src/cms0.ts
export const cms = cms0<RootSchema>({
apiConfig: {
baseUrl: process.env.CMS0_API_BASE_URL,
key: process.env.CMS0_API_KEY,
},
});Success check
Run:
Terminal
pnpm exec cms0 buildIf the config is valid, the CLI resolves the entry file and publishes the generated schema.
If you need a different schema file per app, keep each app’s cms0.config.ts next to that app’s package manifest and run the CLI from that directory.