Suggestions appear as you type. Use the up and down arrows to choose one and Enter to open it.

This page's audience our own tag's counts — open to see them
–Visits
–Page views
–Clicks to vendors
–Time on page
–Reading now
Clicks to vendors, by tool
  • –
Top countries
  • –
Devices
  • –

– · visits, page views and clicks counted by our own tag, which counts more than our checked analytics; every figure rounded down · how we count

Pretender.js

Free#21 of 26 in API Mocking Tools

Pretender.js: A focused open-source choice for intercepting browser API requests in tests. Ranked #21 of 26 in API Mocking Tools by our editors (6.9/10); pricing: Open source; best for minimal browser request interception.

6.9/10Editor score
Pretender.js6.9 Visit Pretender.js

At a glance

  • Editor score
    6.9 / 10
  • Pricing
    Open source
  • Best for
    Minimal browser request interception
  • Paid from
    Free
  • Dynamic responses
    Yes
  • Facts checked
    20 Sep 2026
Pretender.js screenshot
  • Where it wins

    • Intercepts both XMLHttpRequest and Fetch requests
    • Supports dynamic routes, query parameters, and custom responses
    • Adds delays, passthroughs, request tracking, and manual resolution
  • Where it doesn't

    • Browser-only focus limits use in non-browser mock environments
    • No OpenAPI import or generated mock-data workflow
    • Not a hosted mock API service or standalone local server

Our verdict on Pretender.js

Pretender.js is an open-source JavaScript mock server library for browser applications and tests. It temporarily replaces native XMLHttpRequest and Fetch, then routes requests to developer-defined handlers. The Express- and Sinatra-inspired DSL supports GET, PUT, POST, DELETE, PATCH, and HEAD routes, making it suited to frontend developers who need controlled API behavior during browser testing without adopting a hosted mock service.

Its main strength is request-level control. Routes can use static or dynamic path segments, route parameters, and query-parameter access through request objects. Handlers can return custom status codes, headers, and response bodies, with promise-based, delayed, synchronous, or manually resolved responses. Passthrough routes allow selected requests to reach the real network, while request tracking and handler call counts help inspect interaction patterns during tests.

The trade-off is a narrow browser-first scope. Pretender.js is distributed as an npm package for web use rather than as a standalone local mock server or hosted mock API service. It also does not provide an OpenAPI import workflow or generated mock-data feature. Choose it when browser request interception, route matching, and programmable responses are the priority. Teams seeking specification-driven mocks, broader platform coverage, or a separately deployed mock API should choose a tool built around those needs instead.

Your product? Our editors can test Pretender.js in depth and publish a review, labelled as paid · from $149/mo →

Pretender.js pricing

Plans Open sourceFree Free to use — no paid tier required for the core job.
See plans on github.com

Pretender.js fact sheet

Free planNot verified
Paid fromFree
Dynamic responsesYes
OpenAPI importNot verified
Request matchingNot verified
Mock data generationNot verified
Local deploymentNot verified
Supported protocolsNot verified
DeploymentCloud
PlatformsWeb
SupportDocs
Built forSolo, Small business (editorial estimate)
PricingOpen source
Websitegithub.com
Facts checked20 Sep 2026

Alternatives to Pretender.js

See all Pretender.js alternatives →

Used Pretender.js? Be the first to review it

The editor score above is our own research. What this page doesn't have yet is a reader's view — what you used Pretender.js for, what worked and what didn't. No stars are seeded and no review is paid for; an editor reads every one before it appears.

Write a reviewTwo minutes · verified accounts only · read by an editor before it appears

Reviews come only from verified accounts. Sign in or create an account first — your e-mail is never shown.

Your rating

0 characters · at least 80, up to 3,000

Posted from your verified account. Reviews appear after an editor reads them, usually within two working days.

Featured on iTechGuides

Featured on iTechGuides — Pretender.js 6.9/10

Pretender.js is listed in our API Mocking Tools directory. Add the badge to your site — it links back to this page.

<a href="https://www.itechguides.com/products/pretender-js/"><img src="https://www.itechguides.com/best/badge/pretender-js.svg" alt="Featured on iTechGuides" width="230" height="46"></a>

Reviewed by iTechGuides Editors · Editorial team · Updated Oct 2026

Advertiser disclosure: iTechGuides is reader-supported. Vendors can pay for top positions in our rankings and for a place on other products' pages, and we may earn a commission when you click some links. Bought places stand at the number bought; this page and our disclosure say so. Paying vendors may get a fuller, more detailed review from our editors, and that review can change their score. How we rank.

Last updated · How we research and update