{"schemaVersion":1,"id":"mock-service-worker","name":"Mock Service Worker","locale":"en","canonicalUrl":"https://base.akulich.dev/en/library/mock-service-worker/","officialUrl":"https://github.com/mswjs/msw","isCatalog":false,"description":"Intercepts network requests in browsers and Node.js, allowing application checks with realistic API mocks without a separate server.","tasks":["Check an interface with reproducible API responses","Connect interception to a browser or Node.js test environment"],"categoryIds":["quality"],"subcategoryIds":["quality.testing"],"tags":["Mock Service Worker","test","Development"],"aliases":["mswjs/msw","mock-service-worker","msw-api-mocking"],"platforms":[],"stack":[],"compatibility":null,"pricing":"free","freeUsage":"Code and local use under MIT.","paidUsage":"Compute, your own hosting, and external services are paid for separately if selected.","license":"MIT: code; dependencies have separate licenses.","selectionGuide":{"purpose":"Check an interface with reproducible API responses","chooseWhen":["Check an interface with reproducible API responses","Connect interception to a browser or Node.js test environment"],"considerInstead":[],"requirements":["Choose browser/node setup and configure request handlers for the APIs in use."],"limitations":["Costs and limits of free use: Compute, your own hosting, and external services are paid for separately if selected.","Terms of use: MIT: code; dependencies have separate licenses.","Browser and Node interception use different mechanisms; the browser route requires a Service Worker, while Node does not."],"faq":[{"question":"What can you use for free in Mock Service Worker?","answer":"Code and local use under MIT."},{"question":"What additional costs might arise with Mock Service Worker?","answer":"Compute, your own hosting, and external services are paid for separately if selected."},{"question":"What terms of use matter for Mock Service Worker?","answer":"MIT: code; dependencies have separate licenses."},{"question":"How do you get started with Mock Service Worker?","answer":"Define request handlers for the required endpoints and response states. Connect interception to a browser or Node.js test environment. Run the check locally and save the report in CI."},{"question":"Does MSW use the same mechanism in browsers and Node.js?","answer":"In a browser, MSW uses a Service Worker to intercept requests at the network level; handlers execute on the client rather than inside the worker. Node.js has no Service Worker and uses low-level interception. Shared request handlers can be reused for development, unit/integration tests, and E2E, adding browser setupWorker or node setupServer according to the environment."}],"related":[],"sources":["https://github.com/mswjs/msw","https://raw.githubusercontent.com/mswjs/msw/HEAD/README.md","https://raw.githubusercontent.com/mswjs/msw/HEAD/LICENSE.md","https://www.open-source-tools.com/"]},"selectionCheckedAt":null,"applicationGuide":{"goal":"Check an interface with reproducible API responses.","inputs":["One important workflow and its expected result.","A test environment with controlled data."],"steps":["Define request handlers for the required endpoints and response states.","Connect interception to a browser or Node.js test environment.","Run the check locally and save the report in CI."],"checks":["The check detects a deliberately broken workflow.","The result can be reproduced without depending on a personal session."]},"sources":["https://github.com/mswjs/msw","https://raw.githubusercontent.com/mswjs/msw/HEAD/README.md","https://raw.githubusercontent.com/mswjs/msw/HEAD/LICENSE.md","https://www.open-source-tools.com/"],"checkedAt":"2026-10-06","reviewScope":"Purpose, the current repository license, and the boundaries between code, services, and models were reviewed. The product was not run or security-audited.","relatedIds":[],"dataVersion":"cbbe7123b47a5ae80983","type":"Test automation","kind":"tool","pricingNote":"Code and local use under MIT. Compute, your own hosting, and external services are paid for separately if selected.","notes":null,"labeledSources":[{"url":"https://github.com/mswjs/msw","label":"Official source"},{"url":"https://raw.githubusercontent.com/mswjs/msw/HEAD/README.md","label":"Official source"},{"url":"https://raw.githubusercontent.com/mswjs/msw/HEAD/LICENSE.md","label":"License"},{"url":"https://www.open-source-tools.com/","label":"Catalog / discovery source"}],"licenseGuides":[{"id":"mit","title":"MIT — permissive license","scope":null,"summary":"You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.","url":"https://opensource.org/license/mit"}],"entryIds":[],"composition":null}