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).
@msw/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 Playwright integration.
msw-storybook-addon Official Storybook add-on.
@msw/cloudflare Cloudflare (workerd) integration.
@msw/sveltekit Official SvelteKit 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 18.2k 621

  2. examples examples Public

    Mock Service Worker usage examples.

    730 215

  3. data data Public

    Data querying library for testing JavaScript applications.

    TypeScript 1.1k 67

  4. interceptors interceptors Public

    Low-level network interception library for Node.js.

    TypeScript 684 173

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

    Mock API requests in Storybook with Mock Service Worker.

    TypeScript 494 45

  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 126 13

Repositories

Showing 10 of 25 repositories
  • interceptors Public

    Low-level network interception library for Node.js.

    mswjs/interceptors's past year of commit activity
    TypeScript 684 MIT 173 19 (1 issue needs help) 9 Updated Sep 10, 2026
  • mswjs.io Public

    Official website and documentation for the Mock Service Worker library.

    mswjs/mswjs.io's past year of commit activity
    TypeScript 178 227 11 (1 issue needs help) 13 Updated Sep 10, 2026
  • msw Public

    Industry standard API mocking for JavaScript.

    mswjs/msw's past year of commit activity
    TypeScript 18,202 MIT 621 34 (3 issues need help) 7 Updated Sep 10, 2026
  • data Public

    Data querying library for testing JavaScript applications.

    mswjs/data's past year of commit activity
    TypeScript 1,064 MIT 67 4 2 Updated Aug 30, 2026
  • msw-storybook-addon Public

    Mock API requests in Storybook with Mock Service Worker.

    mswjs/msw-storybook-addon's past year of commit activity
    TypeScript 494 MIT 45 3 2 Updated Jul 29, 2026
  • sveltekit Public

    Mock API requests in SvelteKit with Mock Service Worker.

    mswjs/sveltekit's past year of commit activity
    JavaScript 12 1 0 0 Updated Jul 17, 2026
  • source Public

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

    mswjs/source's past year of commit activity
    TypeScript 218 MIT 14 9 3 Updated Jul 8, 2026
  • url Public

    Utilities for working with URLs.

    TypeScript 6 MIT 0 0 0 Updated Jul 7, 2026
  • .github Public

    Mock Service Worker organization GitHub files.

    mswjs/.github's past year of commit activity
    0 0 0 0 Updated Jul 7, 2026
  • cloudflare Public

    Develop and test Cloudflare applications with Mock Service Worker.

    mswjs/cloudflare's past year of commit activity
    TypeScript 96 1 0 0 Updated Jul 7, 2026