mockttp
Mockttp is a TypeScript HTTP mock server and proxy library that lets you intercept, transform, and test HTTP requests in JavaScript and browser environments. It's commonly used for integration testing without stubbing code in-process, enabling accurate testing of real HTTP behavior across Node.js and browser contexts.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | httptoolkit/mockttp |
| Owner | httptoolkit |
| Primary language | TypeScript |
| License | Apache-2.0 — OSI-approved |
| Stars | 868 |
| Forks | 107 |
| Open issues | 40 |
| Latest release | v4.0.0 (2025-06-17) |
| Last updated | 2026-07-02 |
| Source | https://github.com/httptoolkit/mockttp |
What mockttp is
Mockttp provides a promise-based, strongly-typed API for HTTP mocking and transparent proxying, supporting HTTPS with self-signed certificate generation, dynamic port allocation for parallel testing, and request/response inspection. It works as both a mock server (direct stubbing) and intercepting proxy, with support for Node.js subprocesses, browser tests, and remote devices.
Get the mockttp source
Clone the repository and explore it locally.
git clone https://github.com/httptoolkit/mockttp.gitcd mockttp# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Requires Node.js runtime for server; browser tests still need a running Mockttp instance (local or remote), adding infrastructure overhead to test environments.
- HTTPS interception requires installing and trusting auto-generated certificates on the client side; setup varies by browser/OS and may require custom CA configuration.
- Parallel test execution requires careful lifecycle management (start/stop per test or suite) to avoid port conflicts; dynamic port allocation mitigates but adds debugging complexity.
- Request matching and response stubbing are synchronous at setup but async at assertion time; care needed to avoid race conditions or missing request captures in high-concurrency tests.
- Full request/response introspection is powerful but can increase test verbosity; clear documentation of assertion patterns needed to keep tests maintainable.
When to avoid it — and what to weigh
- Simple Stub-Based Unit Tests — If your testing needs are lightweight unit tests with in-process HTTP stubbing (e.g., using nock or msw for isolated component tests), Mockttp's full server overhead may be unnecessary complexity.
- Non-JavaScript/TypeScript Environments — Mockttp is built for JS/TS ecosystems. If your primary testing infrastructure uses Java, Python, Go, or other languages without Node.js bridges, integration and maintenance will be awkward.
- Production Traffic Mocking or Load Testing — Mockttp is designed for test automation and development; it is not intended for production traffic simulation, load testing, or high-throughput proxy scenarios where performance and stability at scale are critical.
- Minimal Dependencies Constraint — If your project requires minimal external dependencies or has strict supply-chain constraints, Mockttp's transitive dependencies and maintenance surface should be reviewed.
License & commercial use
Apache License 2.0 (Apache-2.0) is a permissive OSI-approved open-source license that permits commercial use, modification, and redistribution with attribution and a copy of the license. No warranty is provided.
Apache 2.0 explicitly permits commercial use and modification. No proprietary license, royalties, or commercial restrictions apply. Verify compliance with your organization's OSS policy; attribution and license copy in distributions are required. No commercial support or indemnification provided by the licensor unless negotiated separately.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Strong |
| Assessment confidence | High |
Mockttp is designed for testing and development, not production. Self-signed certificate generation for HTTPS testing is appropriate for test environments. In CI/CD, ensure certificates are not trusted system-wide unless isolated to test runners. No public security audit data available; treat as a test-only tool. Verify that interception of HTTPS does not expose credentials or sensitive data in test logs.
Alternatives to consider
MSW (Mock Service Worker)
Browser-first, service-worker-based HTTP mocking with no server overhead; better for frontend unit/integration tests but less flexible for backend/proxy scenarios.
Nock
Lightweight, in-process HTTP request mocking for Node.js; simpler for unit tests but does not support browser or transparent proxying.
Wiremock
Language-agnostic, standalone HTTP mock server (Java-based); better for multi-language or microservice testing but heavier deployment and less JS/TS native integration.
Build on mockttp with DEV.co software developers
Evaluate Mockttp for your integration test suite. Start with the npm package and examples, then assess HTTPS setup and CI/CD integration needs for your environment.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
mockttp FAQ
Can I use Mockttp in both Node.js and browser tests with the same code?
Does Mockttp work with HTTPS?
Can I run tests in parallel with Mockttp?
Is Mockttp suitable for load testing or production use?
Work with a software development agency
DEV.co helps companies turn open-source tools like mockttp into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source testing stack.
Ready to improve your HTTP testing?
Evaluate Mockttp for your integration test suite. Start with the npm package and examples, then assess HTTPS setup and CI/CD integration needs for your environment.