Skip to content
@mswjs

Mock Service Worker

Industry standard API mocking for JavaScript.

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
@msw/data Model and query your mock data (fixtures).
@mswjs/source Generate request handlers from various sources (HAR files, OpenAPI documents).
@mswjs/http-middleware Spawn an HTTP server from your request handlers.

Third-party extensions

Package Description
@msw/playwright Official Playwright integration.
msw-storybook-addon Official Storybook add-on.

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 Loading

  1. msw msw Public

    Industry standard API mocking for JavaScript.

    TypeScript 17.2k 562

  2. examples examples Public

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

    711 210

  3. data data Public

    Data querying library for testing JavaScript applications.

    TypeScript 939 59

  4. interceptors interceptors Public

    Low-level network interception library.

    TypeScript 614 149

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

    Mock API requests in Storybook with Mock Service Worker.

    TypeScript 467 43

  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 121 12

Repositories

Showing 10 of 23 repositories
  • msw Public

    Industry standard API mocking for JavaScript.

    mswjs/msw’s past year of commit activity
    TypeScript 17,182 MIT 562 49 (5 issues need help) 11 Updated Oct 11, 2025
  • mswjs.io Public

    Official website and documentation for the Mock Service Worker library.

    mswjs/mswjs.io’s past year of commit activity
    TypeScript 171 214 12 (1 issue needs help) 16 Updated Oct 11, 2025
  • msw-storybook-addon Public

    Mock API requests in Storybook with Mock Service Worker.

    mswjs/msw-storybook-addon’s past year of commit activity
    TypeScript 467 MIT 43 17 (1 issue needs help) 2 Updated Oct 10, 2025
  • source Public

    Generate MSW request handlers from various sources (HAR files, OpenAPI documents, etc).

    mswjs/source’s past year of commit activity
    TypeScript 192 MIT 10 10 1 Updated Oct 9, 2025
  • data Public

    Data querying library for testing JavaScript applications.

    mswjs/data’s past year of commit activity
    TypeScript 939 MIT 59 2 1 Updated Oct 8, 2025
  • interceptors Public

    Low-level network interception library.

    mswjs/interceptors’s past year of commit activity
    TypeScript 614 MIT 149 24 (1 issue needs help) 17 Updated Oct 7, 2025
  • codemods Public

    Automate repetitive and painful MSW migrations & breaking changes.

    mswjs/codemods’s past year of commit activity
    TypeScript 5 MIT 0 0 0 Updated Oct 2, 2025
  • .github Public

    Mock Service Worker organization GitHub files.

    mswjs/.github’s past year of commit activity
    0 0 0 0 Updated Sep 29, 2025
  • examples Public

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

    mswjs/examples’s past year of commit activity
    711 210 12 (1 issue needs help) 10 Updated Sep 16, 2025
  • jest-fixed-jsdom Public

    A superset of the JSDOM environment for Jest that respects Node.js globals.

    mswjs/jest-fixed-jsdom’s past year of commit activity
    JavaScript 90 8 13 0 Updated Aug 30, 2025