Swagger UI renders interactive API documentation in the browser from an OpenAPI/Swagger specification file.
stoplightio/prism
A CLI and HTTP server that turns OpenAPI v2/v3 and Postman Collection files into mock APIs with request validation and a validation proxy.
Open-source alternative to:Postman
- Stars
- 5,052
- Forks
- 414
- Open issues
- 147
- Last commit
- 10 days ago
What is it?
Prism is a set of packages for API mocking and contract testing. Given an OpenAPI v2, OpenAPI v3.x, or Postman Collection document, it starts an HTTP server that returns responses shaped by the spec, so frontend and client teams can work before the backend exists.
The same tool can run as a validation proxy placed in front of a real API. It checks traffic against the API description and reports discrepancies between the implementation and its contract. It also supports content negotiation and security validation. Prism is run from the command line with commands such as `prism mock` and `prism proxy`, and it requires Node.js 18.20.1 or later.
Hosted mock servers are also offered through Stoplight's commercial platform and Stoplight Studio, which use Prism under the hood. Recording traffic to generate an OpenAPI document and persisting mock data are listed as planned features rather than current ones.
Key features
- 01Generates a mock HTTP server from OpenAPI v2, v3.0, v3.1 or Postman Collection files.
- 02Validates requests and responses against the API specification.
- 03Runs as a validation proxy in front of a live API to flag contract mismatches.
- 04Supports content negotiation and security validation.
- 05Runs from the command line and can be used in continuous integration.
Use cases
- Letting frontend developers build against an API before its backend is implemented.
- Checking that a live API still matches its OpenAPI contract during testing.
- Running mocked API dependencies in CI pipelines.
- Demoing an API design to stakeholders with realistic sample responses.
Quick start
- 1
Install Prism CLI with npm (requires Node.js 18.20.1 or newer)
npm install -g @stoplight/prism-cli - 2
Run a mock server from an OpenAPI document
prism mock https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml - 3
Or run the validation proxy in front of an existing API
prism proxy examples/petstore.oas2.yaml https://petstore.swagger.io/v2
Things to know
- Requires Node.js 18.20.1 or newer, and Node 18.x needs at least 18.16.
Topics
FAQ
- What is prism?
- A CLI and HTTP server that turns OpenAPI v2/v3 and Postman Collection files into mock APIs with request validation and a validation proxy. Prism is a set of packages for API mocking and contract testing. Given an OpenAPI v2, OpenAPI v3.x, or Postman Collection document, it starts an HTTP server that returns responses shaped by the spec, so frontend and client teams can work before the backend exists.
- Is prism free to use? What license does it have?
- prism is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is prism still maintained?
- Actively maintained. The last commit to prism was on Oct 12, 2026.
- What can I use prism for?
- Letting frontend developers build against an API before its backend is implemented. Checking that a live API still matches its OpenAPI contract during testing. Running mocked API dependencies in CI pipelines. Demoing an API design to stakeholders with realistic sample responses.
- How do I install prism?
- Install Prism CLI with npm (requires Node.js 18.20.1 or newer): npm install -g @stoplight/prism-cli Run a mock server from an OpenAPI document: prism mock https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml Or run the validation proxy in front of an existing API: prism proxy examples/petstore.oas2.yaml https://petstore.swagger.io/v2
- Where can I get prism?
- The source code and installation instructions are on GitHub: https://github.com/stoplightio/prism
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Desktop app and CLI for designing and running local mock REST APIs, with no account or remote deployment required.
Open-source tool that generates a responsive, three-panel API reference site from OpenAPI, Swagger, AsyncAPI, or GraphQL definitions.
Open-source API client that stores collections as plain-text files on your filesystem, an offline alternative to Postman and Insomnia.
Hurl is a command line tool that runs and tests HTTP requests written in a plain text file format.
A friendly, fast command-line HTTP client that reimplements much of HTTPie's syntax with better startup performance.