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
@mswjs/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-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 Loading

  1. msw msw Public

    Industry standard API mocking for JavaScript.

    TypeScript 16.1k 530

  2. examples examples Public

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

    688 213

  3. data data Public

    Data modeling and relation library for testing JavaScript applications.

    TypeScript 837 52

  4. interceptors interceptors Public

    Low-level network interception library.

    TypeScript 575 130

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

    Mock API requests in Storybook with Mock Service Worker.

    TypeScript 416 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 111 13

Repositories

Showing 10 of 22 repositories
  • mswjs.io Public

    Official website and documentation for the Mock Service Worker library.

    mswjs/mswjs.io’s past year of commit activity
    TypeScript 160 180 8 (1 issue needs help) 9 Updated Dec 18, 2024
  • msw Public

    Industry standard API mocking for JavaScript.

    mswjs/msw’s past year of commit activity
    TypeScript 16,118 MIT 530 37 (4 issues need help) 13 Updated Dec 18, 2024
  • interceptors Public

    Low-level network interception library.

    mswjs/interceptors’s past year of commit activity
    TypeScript 575 MIT 130 19 (1 issue needs help) 14 Updated Dec 16, 2024
  • socket.io-binding Public

    Binding to mock Socket.IO connections with Mock Service Worker.

    mswjs/socket.io-binding’s past year of commit activity
    TypeScript 5 2 2 0 Updated Dec 4, 2024
  • examples Public

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

    mswjs/examples’s past year of commit activity
    688 213 11 (1 issue needs help) 12 Updated Nov 14, 2024
  • 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 52 5 4 0 Updated Nov 13, 2024
  • msw-storybook-addon Public

    Mock API requests in Storybook with Mock Service Worker.

    mswjs/msw-storybook-addon’s past year of commit activity
    TypeScript 416 MIT 39 17 (1 issue needs help) 1 Updated Nov 5, 2024
  • source Public

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

    mswjs/source’s past year of commit activity
    TypeScript 152 MIT 6 7 1 Updated Oct 30, 2024
  • http-middleware Public

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

    mswjs/http-middleware’s past year of commit activity
    TypeScript 111 13 5 0 Updated Oct 25, 2024
  • data Public

    Data modeling and relation library for testing JavaScript applications.

    mswjs/data’s past year of commit activity
    TypeScript 837 MIT 52 48 (5 issues need help) 12 Updated Sep 9, 2024