@noverax/create-courier sets Courier up in one command. It finds your framework, shows what it is about to do, and once you agree writes the files, installs the packages with your package manager and type-checks what it added. You get a working page at /courier before you have a backend: the example API answers from a mock that Studio runs. In a React or Vue app that Vite builds, the page is /courier.html, which Vite serves while npm run dev runs; opened from disk, it says so.
In your project
Run it in the project's folder:
npx @noverax/create-courierIn a terminal it asks first, each question with the answer it takes on Enter: your API — the example, a specification to import by its URL or file, or none yet; Studio, which an import needs; the example's mock, which Studio runs; whether to offer the API's reads to AI agents, no unless you say so; whether to point your editor's agent at the docs of the Courier you install, no unless you say so, where that would change anything; and, where your framework has Courier's plugin and the project writes no routes module, where pages take their routes from. A flag answers each: --example or --no-example, --openapi, --studio or --no-studio, --mocks or --no-mocks, --mcp or --no-mcp, --agents-md or --no-agents-md, --routes. With --yes, --dry-run or --json, or without a terminal, it asks nothing, and sets up the example, Studio and its mock, without agents or their docs, the routes from the plugin.
Then it prints the plan, and asks before it changes anything:
Set Courier up in shop (Next.js 16.4.0, npm)
Files
+ src/courier/api.ts your API, typed, with an example to start from
+ courier.config.ts lists your APIs for the app, Studio and agents
+ courier.mocks.ts the mock Studio runs on port 7001
+ src/app/api/request/route.ts the route the browser calls your API through
+ src/courier/query.ts React Query hooks for your API
+ src/app/courier/page.tsx a page that shows Courier at work
+ src/instrumentation.ts registers your APIs as the server starts
+ src/instrumentation-client.ts the browser's connection to Studio
Changes to your files
~ next.config.ts builds the pages' routes in from the endpoints marked .expose()
+ import { withCourier } from "@noverax/courier-next/plugin";
- export default nextConfig;
+ export default withCourier(nextConfig);
~ package.json adds Courier's scripts
+ "studio": "courier-studio"
Packages
+ @noverax/courier @noverax/courier-next @noverax/courier-build @noverax/courier-react @tanstack/react-query zod @noverax/courier-studio-core
+ @noverax/courier-studio @noverax/courier-mock hono @hono/node-server (dev)Then start Studio, which runs the mock, and your app:
npm run studio
npm run devOpen /courier: the users the mock answers with, and a form that creates one, each call in Studio's timeline.
In a new project
Point it at a folder that does not exist yet, and name the framework:
npx @noverax/create-courier shop --framework nextIt creates the project with the framework's own generator — create-next-app, sv, create-astro and the others, run without a question at the major the setup is checked against — puts right what a template gets wrong for the project it makes, installs its packages with your package manager, and sets Courier up in it. Express has no generator of its own: the command writes a minimal server in TypeScript. In a terminal, it asks for the framework when --framework is left out, then the setup's questions, all before it makes anything.
A project it creates is moved to TypeScript 6 where its template came with an older one. A project you already have keeps the TypeScript it has, and the plan says how to move when you are ready: the command to run, and what TypeScript 6 deprecates that your tsconfig.json sets — moduleResolution: "node", baseUrl, downlevelIteration — with what to write instead. Courier's entries resolve under "moduleResolution": "node" meanwhile; see an existing project.
What it sets up
| Framework | Where your API is served | What it changes in your files |
|---|---|---|
| Next.js | app/api/request/route.ts, registered from instrumentation.ts | next.config passed to Courier's withCourier(), and Studio's port in it when the default is taken |
| Nuxt | server/api/request.ts, registered from a Nitro plugin | Courier's module and Studio's in nuxt.config; app.vue renders pages where it showed the welcome |
| SvelteKit | src/routes/api/request/+server.ts, registered from hooks.server.ts | Courier's plugin and Studio's in vite.config |
| Astro | src/pages/api/request.ts, on demand, registered from the middleware | Courier's integration and Studio's in astro.config |
| React Router, Remix | app/routes/api.request.ts | the routes in app/routes.ts; Courier's plugin and Studio's in vite.config |
| SolidStart | src/routes/api/request.ts | Courier's plugin and Studio's in vite.config |
| TanStack Start, for React or Solid | src/routes/api/request.ts, registered from src/server.ts | Courier's plugin and Studio's in vite.config — under Rsbuild, Courier's in rsbuild.config, and Studio connected to the server alone; the app built once, which writes its routes' types, before the check |
| React with Vite | no server: the browser calls your API directly | Studio's plugin in vite.config |
| Vue with Vite | no server: the browser calls your API directly | Studio's plugin in vite.config |
| Expo | no server: the app calls your API directly | a Courier tab in the template's tabs |
| Express | a router on /api/request and /courier | the router mounted after express() |
| Hono | routes on /api/request and /courier | the routes mounted after new Hono(); include in a tsconfig that compiles src/ |
| Fastify | a plugin on /api/request and /courier | .courier/ kept out of fastify start -w |
| NestJS | a module on /api/request and /courier | the module imported into your root module |
Every setup in a project without Courier adds courier.config.ts, the list of your APIs that your server, Studio and the MCP server read; courier.mocks.ts, the mock Studio starts with itself — with --no-studio there is no mock, the plan says so, and the example's page asks for your backend's address; and your API's definition, with its Zod schemas and the .expose() marks that open its endpoints to a page. Where a page calls the API through your server, its client takes the routes from @noverax/courier/routes, which Courier's plugin for the app's build — @noverax/courier-build, installed with it — builds in from the marks, and registers the config, so they are typed from it; the config keeps Studio from writing courier.routes.ts, which no page would import. With --routes file, and on Express, Hono, Fastify and NestJS, whose pages no bundler builds, it adds courier.routes.ts in place of the plugin: the routes as Courier writes them from the marks, so the project compiles before Studio first runs — and @noverax/courier-cli with a routes script, which writes them again without Studio and, with --check, fails a CI job when they are out of date. A project that keeps the module already, or a script that writes it, keeps it; npx @noverax/courier-cli setup moves one to the plugin. A server compiled by tsc from src/ — Express, Hono, Fastify, NestJS — cannot import a file at the project's root, so its list lives in src/courier/config.ts, which the server registers from, and courier.config.ts passes it on to Studio and agents. It is still one list: an API Studio imports is declared where the list is written.
What it will not do
- Change anything you have not seen. The plan comes first; without a terminal to answer, in CI or for an agent, nothing changes unless
--yesis passed.--dry-runshows the plan and stops, and Ctrl+C at any of its questions stops it with nothing changed. - Mix its changes with yours. The plan says when git has changes here you have not committed, so you can commit them first and see the setup's apart. In a terminal you answer knowing it; with
--yes, or without a terminal, nothing is changed unless--allow-dirtyis passed too. A project the command creates is its own, and is not checked. - Replace a file of yours. A file is only ever added. Where a file of yours stands where Courier's would go — your own
instrumentation.ts, say — it is kept, and the lines it lacks are listed for you. - Offer what you have. In a project whose
courier.config.tsdeclares APIs already, it adds no example — no API, page, mock or query hooks — and says how many APIs the config declares. It reads your code for what is wired up: the config's APIs registered, the server and the browser connected to Studio, the proxy route, Studio's plugin in your bundler's config. Only a real call counts, not one in a comment or a string, and only in a file the app loads — by the framework's own convention, as its entry, or imported by another file, through a relative path or one of your aliases (tsconfigpathsandbaseUrl, package.jsonimports): a router nothing mounts still has its step. A change it makes never imports a name your file binds already, nor adds a route whose URL path a route of yours has: those are left to you. A file that lacks a part is shown only that part. The config is found under any of the names Studio reads,courier.config.mjsamong them, and nocourier.config.tsis added beside it. A package you list as a dependency or a dev one is not installed again, nor a peer or optional one that Node finds installed, in your project or hoisted in a workspace; one listed there alone and not installed is added, and the plan says why. One of Courier's on another release line is named and left as it is, with what brings the two to one:npx @noverax/courier-cli@latest upgradefor a project on an older line,npx @noverax/create-courier@latestfor one on a newer line. Scripts are added topackage.jsonin its own layout:studiowhere Studio is set up, and — where pages call through your server and the project marks an endpoint with.expose()or has a routes module —routes, with@noverax/courier-clito run it. A script of yours under one of those names is kept as it is, and the step that would run Courier's runs its command instead. - Edit a file it cannot read. A change to a file of yours is made only where the file has a shape the command knows: one default export of a config object, one
const app = express(). It is shown line by line in the plan and checked against the file right before it is written; a file that changed meanwhile stops the setup with its name. Anywhere else, the change is left to you, with the lines to add. - Leave a project half set up. It installs the packages first, and writes nothing until the install is done. When the install fails, a file it writes cannot be written, the specification's import fails, or you press Ctrl+C, what it did is undone: the files it added are removed, the files it changed are put back, and
package.jsonand the lockfile are as they were before the install. Each file is written whole, under its name at once, and only inside the project: a path that leads out of it through a link stops the setup before anything is written there. A file someone changed after the setup wrote it is kept, and named.node_modulesmay still hold what the install added, which your package manager's install takes out again. A run after one whose packages were never installed, with--no-installsay, installs what the files Courier added import: the example's hooks, its schemas and its mock. Each program the setup runs has its time, named in the reference. - Take a port that is taken. Studio takes 6280 and the mock 7001 unless something listens there already, another project's Studio say; then the next free one, written in
courier.config.tsandcourier.mocks.ts.
Your own API
npx @noverax/create-courier --openapi https://petstore3.swagger.io/api/v3/openapi.jsonImports an OpenAPI, Swagger or Postman specification in place of the example, with Studio's own importer: the typed code is written and the API is declared in courier.config.ts. In a terminal, pick it as your API and give its URL or file: a URL that is none, or a file that is not there, is asked for again. The setup sends the server no credentials: where it answers 401 or 403, the setup says to download the specification and import its file. An address with a user or a password in it, which Studio reads nothing from, is refused before anything is installed, with SPEC_CREDENTIALS_IN_URL: import its file, or set Courier up without the import, then run npx @noverax/courier-studio import <address> --basic-env USER_VARIABLE:PASSWORD_VARIABLE, which reads the two from those environment variables. An address with a secret parameter, ?api_key= say, is imported, and Studio declares it nowhere, as the config would keep the secret in your repository: the plan, the summary and the JSON document leave you its entry, with from as a template that reads the secret from an environment variable, and name the variable to set. The address is shown without the secret. See Import an API.
Behind a corporate proxy, npm installs through the proxy its own settings or HTTPS_PROXY name, and the specification is fetched through it once NODE_USE_ENV_PROXY=1 is set — see Proxies & Certificates.
AI agents
npx @noverax/create-courier --mcpWrites agents: { offer: "reads" } into the config — every read is offered to agents, a write once you mark it .agent() — describes the example's reads with .agent(), and adds .mcp.json, which Claude Code reads, so your editor's agent can call your API through the same middleware as your app. An imported API's reads are offered the same way, each described by its specification's summary. In a project set up before, it adds the policy to the config you have, unless the config says already what agents may call. In a terminal, it asks, for a project you have and for one it creates; with --yes, or without a terminal, it leaves agents out unless --mcp is passed. See What agents may call.
Docs for your editor's agent
npx @noverax/create-courier --agents-mdInstalls @noverax/courier-docs, the docs of the Courier you install, and writes Courier's block into AGENTS.md, which agents read as they start: it points your editor's agent at the docs in node_modules/@noverax/courier-docs/docs/, so that it writes code for the version you have rather than for the one it remembers — see Docs for Your Agent. A project without AGENTS.md gets one with the block; one you have gets the block at its end, after an empty line; in one that holds it, the block is brought up to date between its markers, <!-- BEGIN:courier-agent-rules --> and <!-- END:courier-agent-rules -->. Nothing outside them changes, the file's line ends and BOM included. CLAUDE.md, which Claude Code reads in place of AGENTS.md, gets the line @AGENTS.md at its end, or is written with it; a link from it to AGENTS.md reads the block already. A file that is a link, read-only, larger than 1 MiB or not UTF-8, or whose markers are repeated or out of order, is left as it is, and the plan names what to add. Both files are written with the rest of the setup, and undone with it. From then on Studio brings the block up to date each time it starts, and npx @noverax/courier-cli upgrade as it moves Courier's packages: only between its markers, in a file that holds them. Delete the block, markers included, and nothing writes it again unless you pass --agents-md once more. In a terminal it asks, where the block would change anything; with --yes, or without a terminal, it writes none unless --agents-md is passed. In a project set up already, npx @noverax/courier-cli setup --agents-md writes it the same way.
In CI and for agents
npx @noverax/create-courier --json --dry-runWith --json the command asks nothing, and writes one JSON document to standard output as it ends — the plan, what was done and how it ended; Create Courier Reference says what each field holds, and how --yes and --dry-run go with it.
Options
Every option, with what it takes and what it is left at, is in Create Courier Reference.
It needs Node.js 22.13 or later, which Studio and its mock need too, and a project with a tsconfig.json: Courier is typed end to end.