This site counts visits with analytics cookies only if you accept. Read the consent

Skip to content

StudioStudio

Studio

A development server with a web UI: inspect requests, explore endpoints, call them from a playground, and run mock servers.

8 min readUpdated both modes

Overview

Courier Studio is a development server with a web UI: a request inspector, an endpoint explorer, an API playground, mock servers, and more. You run it next to your app, and your app connects to it — the server side through attachRuntime(), the browser side through one of the build integrations below.

What each view shows of a call — a search through its whole answer, why a request got no answer, a stream that cannot connect, the variables the Playground starts with, what Cancel does — is on Inspector and Playground.

Install

In one command

npx @noverax/create-courier sets Studio up with the rest: both packages, the integration for your framework, a mock API to work against, and a studio script to start it with. See Create Courier.

By hand:

bash
npm install --save-dev @noverax/courier-studio
npm install @noverax/courier-studio-core

Studio needs Node.js 22.13 or newer. Studio is a development tool, so it is a dev dependency. @noverax/courier-studio-core is what your server instrumentation imports attachRuntime() from, so it is a dependency: a production install leaves dev dependencies out, and a server that imports the runtime does not start without it — even one that calls it only in development. attachRuntime() runs in production too, where it registers the config's sources. An app that only connects its browser through a build integration can leave it out.

Start Studio

bash
npx @noverax/courier-studio

Studio listens on http://localhost:6280 — at both 127.0.0.1 and ::1, so it answers whichever one a client dials — or on the studio.host and studio.port of your courier.config.ts. Server runtimes and the build plugins read the same block, so moving Studio there moves them with it: a server runtime reads the nearest config at or above its working directory, and a build plugin the nearest at or above Vite's root — or, for webpack, esbuild and Rollup, the working directory. Flags: --port, --host, --cwd (project root), --dotenv (the .env files to read, instead of the project's development set), --open (open a browser), --version. Studio writes the routes module a page's proxy client takes each time it loads the config, unless studio.routes is false, as in a project whose build gives the pages their routes with Courier's plugin; courier-cli routes writes it without Studio, and checks it in CI. Its commands run without the server: courier-studio openapi writes the sources as OpenAPI documents, courier-studio verify checks recorded calls against the definition, courier-studio diff reports what a change to the definition breaks for its callers, and courier-studio mcp serves Studio to an editor's agent. Studio keeps its working files — imported API state, copies of the files it replaced or removed, saved sessions — in .courier/, which ignores itself in git.

What Studio keeps in .courier/ — the requests, the mocks' logs, the Playground's history, the saved sessions — how much room each part takes, which values it never writes down and what it does with a large body is on What Studio Keeps.

Studio loads courier.config.ts from the project root, with the courier.mocks.ts beside it, and loads them again whenever either one, or a module either imports, is saved: see How Studio loads the project.

A project that has no API sources yet starts with this courier.config.ts at its root — the APIs page offers it to copy while there is no config, and keeps Import API off until one loads:

ts
import { defineConfig } from "@noverax/courier/config";
export default defineConfig({ sources: {} });

Import API then writes the project's first API into its output directory — src/api/<source name>/ by default — where source.ts exports the source under its source name. Add it to sources under that name, and the APIs page lists it as imported:

ts
import { defineConfig } from "@noverax/courier/config";
import { petstore } from "./src/api/petstore/source";

export default defineConfig({ sources: { petstore } });

Studio makes changes only for a page opened from the link it prints in its terminal, http://localhost:6280/#token=…. The token is the project's: Studio keeps it in .courier/studio-token, readable by your account alone, and prints the same one each time it starts, so a page you opened once keeps working; the page takes the token out of its address bar and keeps it for its next visits. A page or process without it still sees everything Studio shows — the live traffic, the requests it replays as the page loads, a saved session the pages show, a request's whole body or a mock's records the page asks for, the Playground's drafts and history — with every credential, every value named like a secret and every secret written into a string redacted, as a session file has them; but Studio refuses its every change: writing the project's files, driving the mocks, sending from the Playground, saving, loading or deleting sessions, and clearing the log. Nor does Studio read past what it shows for it. It opens no file such a page names and shows it none of the project's code — where an endpoint is called or declared, the files of an import in a preview of a change, a line of courier.config.ts — fetches a specification from no host on this machine or its network, only pasted or from the public internet, checks no import for updates, and runs none of the project's formatters on code it generates for it. Every other path under /api asks for the token too, so even one Studio does not have is answered 401, and such a page may send Studio's socket only what reads: a request's or a mock's body, a mock's records. Its errors and live messages name the project's files relative to it, never by their path on this machine. Studio answers only its own page and the apps running on this machine, so on the default localhost nothing else can reach it; bound to the network (--host 0.0.0.0), anyone on that network can see what it shows, and a change still needs the token. Its pages refuse to be shown in a frame, so another site cannot put Studio under a page of its own. The Playground runs a call through your application's server, which has the same token: its runtime reads .courier/studio-token beside courier.config each time it connects to Studio. Studio sends Playground calls, and the headers typed into them, only to a runtime that presented it; any other process that connects as a runtime has its traffic shown in the Timeline and is sent no call, and the Playground says why.

The build integrations connect your app to Studio; they do not start it.

Connect the browser

Every integration connects only a development build, as the bundler tells one: the dev server of Vite, Astro or Nuxt, next dev, webpack's mode: "development", an esbuild build that neither minifies nor defines process.env.NODE_ENV as "production", and Rollup's watch mode (rollup -c -w). A production build — vite build, webpack --mode production or webpack with no mode, a minified esbuild build, a one-off rollup -c — is left untouched, whether or not NODE_ENV is set, and NODE_ENV=production rules out any build. Pass { enabled: true } or { enabled: false } to decide yourself.

Import pathForRegister
@noverax/courier-studio/viteVite, and the frameworks built on itplugins: [courierStudio()]
@noverax/courier-studio/react, /vue, /sveltekit, /remix, /solidReact, Vue, SvelteKit, React Router (Remix), SolidStart — the Vite plugin under a framework nameplugins: [courierStudio()] in vite.config.ts
@noverax/courier-studio/astroAstrointegrations: [courierStudio()]
@noverax/courier-studio/nuxtNuxt, with any of its buildersmodules: [courierStudioModule]
@noverax/courier-studio/nextNext.js under webpackwithCourierStudio()(nextConfig), imported in next dev alone — see Next.js
@noverax/courier-studio/webpackwebpackplugins: [courierStudio()]
@noverax/courier-studio/esbuildesbuildplugins: [courierStudio()]
@noverax/courier-studio/rollupRollupplugins: [courierStudio()]
@noverax/courier-studio/angularAngularsetupCourierStudio() in main.ts
ts
// vite.config.ts
import { courierStudio } from "@noverax/courier-studio/vite"
import { defineConfig } from "vite"

export default defineConfig({
  plugins: [courierStudio()],
})

Next.js

Next.js 16 builds with Turbopack, which runs no webpack plugins. Connect the browser from instrumentation-client.ts (Next.js 15.3 and later, under either bundler):

ts
// instrumentation-client.ts
import { attachRuntime } from "@noverax/courier-studio-core/runtime"

if (process.env.NODE_ENV === "development") {
  attachRuntime("next-browser")
}

A browser bundle cannot read courier.config.ts, so when Studio is not at the default address, pass it through env: { COURIER_STUDIO_URL: "http://localhost:6290" } in next.config.ts.

Under webpack — Next.js 14 and 15 by default, next dev --webpack since — withCourierStudio() connects the browser without that file. Since next start loads next.config as well, and Studio is a dev dependency an install for production leaves out, import it only in the development phase, as the Next.js guide shows. It also keeps ws, which the server's Studio connection runs on, out of the server bundle: bundled, ws fails on every frame of 48 bytes or more, and the server never reaches Studio. Without the wrapper, add serverExternalPackages: ["ws"] to the config. Under Turbopack it leaves your config untouched and prints the snippet above if the file is missing.

Nuxt

Import the module rather than naming it as a string, and pass options in the tuple form:

ts
// nuxt.config.ts
import { courierStudioModule } from "@noverax/courier-studio/nuxt"

export default defineNuxtConfig({
  modules: [courierStudioModule],
})

Angular

ts
// src/main.ts
import { setupCourierStudio } from "@noverax/courier-studio/angular"

setupCourierStudio() // or setupCourierStudio({ studioUrl: "http://localhost:6290" })

bootstrapApplication(AppComponent, appConfig)

Connect the server

ts
import { attachRuntime } from "@noverax/courier-studio-core/runtime"

await attachRuntime()

Call it once at startup — from instrumentation.ts in Next.js, a Nitro plugin in Nuxt, hooks.server.ts in SvelteKit, or before listen() in a Node server. The runtime is @noverax/courier-studio-core's; its README describes the options attachRuntime() takes. In development it loads courier.config.ts from disk, registers its sources and opens the connection to Studio; in production, where it is not called, the app's own registerSources() registers them.

The Playground runs a call in Proxy mode from this runtime, through your app's own proxy route, at the app's origin. Under Vite and Nuxt, the integration that connects the browser also tells the server where the dev server listens, and Next.js records it as it starts; elsewhere the app learns it from the first request a Courier route serves — see How the app learns its origin.

Studio keeps the latest 2000 requests your app makes in memory, so a Studio page that opens or reloads shows the ones made before it; clearing the Timeline clears them there too, except the pinned ones when Preserve log is on. A request or stream still open when its app stops, or loses its connection to Studio, is shown as failed: the app can no longer say how it ended.

Host a public demo

Studio can show your project to people who do not have it, on a public address, each visitor held to limits of their own: see Host a Public Demo.

Next steps

  • Import an API — turn an OpenAPI, Swagger or Postman specification into typed API code
  • Mock servers — declare mocks Studio runs, and add them from its UI
  • Network conditions — make a mock slow or failing, from the Network tab or in code, and halt a run on its own
  • How Studio loads the project — reloads, failures, the transform cache, and running Studio from code
  • VS Code extension — Studio's figures above each call in your code, and the call one click from Studio