Skip to content
@mswjs

Mock Service Worker

Seamless REST/GraphQL API mocking for JavaScript applications.

Mock Service Worker banner

Mock Service Worker is an API mocking library for browser and Node.js that uses a Service Worker to intercept requests that actually happened. This means no request client stubs and unmatched resilience when it comes to request integrity, as your app now performs requests the same way it does in production.

Ecosystem

We favor composition in both how we write our code and how we distribute it. That's why instead of building a single monolithic package that's responsible for too many things, we distribute the core module with the essentials that everybody could use, and provide a set of standalone extensions that enable specific workflows and push the developer experience even further.

Native extensions

Package Description
@mswjs/data Model and query your mock data (fixtures).
@mswjs/http-middleware Spawn an HTTP server from your request handlers.

Third-party extensions

Package Description
msw-storybook-addon Official Storybook add-on for MSW to write and test your stories.

Support us!

This project is the result of hundreds of hours of work that our contributors spend so that you could enjoy the best API mocking experience there is to offer. If you'd like us to bring new features and mitigate issues more effectively, consider supporting us.

👉 Support Mock Service Worker via GitHub Sponsors

By becoming a baker you help us ensure a bright future for the project. We value and treasure every contribution, big or small. Thank you.

Pinned

  1. msw msw Public

    Seamless REST/GraphQL API mocking library for browser and Node.js.

    TypeScript 15.2k 474

  2. examples examples Public

    Examples of Mock Service Worker usage with various frameworks and libraries.

    649 204

  3. data data Public

    Data modeling and relation library for testing JavaScript applications.

    TypeScript 765 50

  4. interceptors interceptors Public

    Low-level network interception library.

    TypeScript 513 117

  5. msw-storybook-addon msw-storybook-addon Public

    Mock API requests in Storybook with Mock Service Worker.

    TypeScript 385 39

  6. http-middleware http-middleware Public

    Spawn an HTTP server from your request handlers or apply them to an existing server using a middleware.

    TypeScript 101 12

Repositories

Showing 10 of 21 repositories