# pretenderjs/pretender

A mock server library with a nice routing DSL

Repository: https://github.com/pretenderjs/pretender
Canonical: https://ross.abutalabs.com/products/pretenderjs-pretender
Language: JavaScript
License: MIT
License Family: permissive
Last push: 2024-01-29T03:56:02+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 4525, "days_push": 947, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1262, forks 155 (observed 2026-08-28T04:04:10.318969+00:00)

## What it is
Pretender is a browser-only mock server library that intercepts XMLHttpRequest and Fetch requests and routes them to handlers defined with an express/sinatra-style DSL. It is commonly used in frontend testing to simulate backend APIs without a real server.

## Use cases
- mock api responses in browser tests
- intercept fetch and xmlhttprequest requests
- stub backend endpoints for frontend development
- test ajax calls without a real server
- define fake rest routes with an express-style dsl

## When to choose
- you need to mock XHR or Fetch in browser-based tests like Ember or QUnit suites
- you want a lightweight, express-style routing DSL for fake endpoints
- you're developing a frontend against an unfinished backend API

## When to avoid
- you need to mock requests in Node.js or server-side code (Pretender is browser-only)
- you need full HTTP server simulation with networking, TLS, or websockets
- your project uses modern alternatives like MSW and wants active maintenance

## Facets
- artifact type: library
- maturity: maintenance
- function: mocking, http-client, routing, testing
- domain: testing, web-development, frontend, developer-tools
- platform: browser
- tags: mock-server, xhr, fetch, request-interception, express-style-dsl, frontend-testing, javascript, nodejs

## Member repositories
- pretenderjs/pretender (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:10.318969+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T05:04:14.833511+00:00, confidence not recorded.
  - readme: https://github.com/pretenderjs/pretender (fetched 2026-08-28T04:04:10.318969+00:00, sha f5c1b9c1c710)
  - registry_npm: https://registry.npmjs.org/pretender (fetched 2026-08-29T12:16:26.722400+00:00, sha 9cf1313b1a66)
- Data as of 2026-08-30T08:39:29.467469+00:00.
