---
title: "Deploy prism-mock-server"
description: "Instant mock API server from any OpenAPI spec, with validated responses"
category: "Starters"
url: https://railway.com/deploy/prism-mock-server
---

# Deploy prism-mock-server

Instant mock API server from any OpenAPI spec, with validated responses

**[Deploy prism-mock-server on Railway](https://railway.com/template/prism-mock-server)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/prism-mock-server/manifest.json

- **Creator:** Nameless 's Projects
- **Category:** Starters

## Template content

### prism-mock-server

- **Source:** https://github.com/lNamelessl/prism-mock-server
- **Health check:** /health
- **Public domain:** Yes

## Documentation

**Prism API Mock Server** — turn any OpenAPI/Swagger spec into a live mock API. This template runs [Prism](https://github.com/stoplightio/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.

[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/prism-mock-server)

## 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` |

```bash
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

1. Fork the repo, edit `openapi.json` (OpenAPI 2/3 or Postman collections work), deploy your fork.
2. Set `SPEC_PATH` to a spec URL and redeploy.
3. Attach a Railway volume at `/specs` and set `SPEC_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 `422` for 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 root `Dockerfile`.
- Base image: `stoplight/prism:4` pinned by digest `sha256: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.


## Similar templates

- [open-excalidraw](https://railway.com/deploy/open-excalidraw) — Self-hostable collaborative drawing built on Excalidraw
- [caring-vibrancy](https://railway.com/deploy/caring-vibrancy) — Deploy and Host caring-vibrancy with Railway
- [Appsmith](https://railway.com/deploy/appsmith-1) — Low-code platform for internal tools, dashboards, and admin panels.

Open this page in a browser: https://railway.com/deploy/prism-mock-server
