Local mock server
Run a realistic mock API locally
Mock API Studio separates cloud configuration from local execution. The npm package synchronizes the project definition, then serves mock endpoints and stores generated records on the developer’s machine.
What runs in the cloud and what runs locally?
The dashboard stores project configuration, TypeScript model files, endpoint settings, relationships, and team access. The CLI downloads that configuration when it starts a project.
Express request handling, Faker record generation, and the project SQLite database run locally. Mock records created or changed through CRUD requests are stored in .mock-api-studio/<project-slug>.db under the directory where you launch the CLI.
Cloud dashboard → project configuration → npm sync → local Express API → local SQLite dataStart a local server
Run the interactive picker on the first launch, or pass a project slug directly. The CLI asks for an API token when needed, authenticates, synchronizes the selected project, prints every enabled route, and binds to 127.0.0.1.
npx mock-api-studio-cli
# Or start a known project and choose a port
npx mock-api-studio-cli start customer-portal --port 4500Persistent and stateful CRUD behavior
POST, PUT, PATCH, and DELETE update the local SQLite store, so a later GET sees those changes. The generated OpenAPI document is available at /openapi.json and interactive Swagger documentation is available at /docs on the local server.
The runtime can apply authentication, fixed latency, injected 503 errors, pagination, search, sorting, and relationship-aware routes using the synchronized settings.
Reset, seed, and synchronization limits
POST /_mock/reset regenerates local resources. A deterministic seed reproduces generated values when the schema and settings stay the same. When the schema changes, the CLI asks before regenerating existing local data in an interactive terminal; in a non-interactive run it regenerates automatically.
Starting a project requires a connection to synchronize its current cloud configuration. After startup, requests are served locally. Do not describe the whole product as offline-only because account access and synchronization depend on the cloud service.
POST http://localhost:4000/_mock/reset
GET http://localhost:4000/openapi.json
GET http://localhost:4000/docsRelated questions
Does Mock API Studio send mock records to the cloud?
The cloud service holds the project definition. Generated records and CRUD changes are stored by the local runtime in its SQLite database.
Can the local API preserve changes between requests?
Yes. The CLI runtime uses SQLite, so creates and updates remain available to later requests and can persist across restarts.
What happens when cloud configuration changes?
The CLI synchronizes the new definition at startup. If the stored schema differs, it may ask to reset local data; non-interactive starts regenerate automatically.
Keep exploring
Last updated September 17, 2026. Product behavior described here is verified against the current Mock API Studio runtime.