Deploy prism-mock-server
Instant mock API server from any OpenAPI spec, with validated responses
prism-mock-server
Just deployed
Prism API Mock Server — turn any OpenAPI/Swagger spec into a live mock API. This template runs Prism — Stoplight's open-source mock server (Apache-2.0, 15M+ Docker pulls) — and boots healthy immediately with a bundled demo API. Zero configuration, zero credentials.
What you get on day one
A working mock API the moment your deployment turns green:
| Route | Method | Response |
|---|---|---|
/health | GET | 200 {"status":"ok"} |
/pets | GET | 200 list of pets |
/pets | POST | 201 created pet — bodies are validated against the spec (invalid → 422) |
/pets/{id} | GET | 200 a pet, with named examples rex and whiskers |
curl https://your-app.up.railway.app/health
# {"status":"ok"}
Control responses with the Prefer header
| Header | Effect |
|---|---|
Prefer: example=whiskers | Return a named example from your spec |
Prefer: code=404 | Force a specific status code, response body from your spec |
Prefer: dynamic=true | Generate fresh random data from your schemas (faker) |
CORS is enabled by default — browsers can call your mock from anywhere.
Mock your own API
- Fork the repo, edit
openapi.json(OpenAPI 2/3 or Postman collections work), deploy your fork. - Set
SPEC_PATHto a spec URL and redeploy. - Attach a Railway volume at
/specsand setSPEC_PATH=/specs/my-spec.json.
Deploy and Host
About Hosting
Hosting this template provisions a single Railway service, prism-mock-server, built from the pinned stoplight/prism:4 Docker image (digest-pinned for reproducibility) with the demo spec baked in at /spec/openapi.json. Railway assigns a public domain automatically and healthchecks the real GET /health route, so a green deployment means Prism is actually serving. No database, no workers, no credentials to manage. Optional variables: SPEC_PATH (default /spec/openapi.json, accepts a file path or URL) to serve your own spec.
Why Deploy
Deploying Prism manually means wiring a Dockerfile, picking a port, baking a spec, and hoping the healthcheck aligns. This template does all of it: the listen port follows Railway's injected PORT, the demo spec is bundled so the first deploy is green with zero input, and the spec is validated at boot so a broken spec fails loudly instead of serving an empty mock. You get a contract-validated fake API in about a minute instead of an afternoon.
Common Use Cases
- Unblock frontend or mobile development while the real backend is still being built.
- Demo an integration against a stable, predictable API without staging data.
- Contract testing: send real requests and get spec-conformant responses, including validation errors like
422for malformed bodies. - Prototype API designs before writing server code — iterate on the spec, not the plumbing.
Dependencies for
The template has no external dependencies: one stateless service, no database, no message broker, no API keys.
Deployment Dependencies
- GitHub source:
lNamelessl/prism-mock-server(public), built on Railway with the repo's rootDockerfile. - Base image:
stoplight/prism:4pinned by digestsha256:08dc16243047a3263beca814b544a5be81e9ec25ca5757cdc4170c84f7431355(Apache-2.0). - Runtime configuration comes from the image (
SPEC_PATH=/spec/openapi.json) plus Railway-injected networking; nothing to provision outside this one service.
Template Content
prism-mock-server
lNamelessl/prism-mock-server