~/tools / 02 / crud-api-endpoint
REST API Endpoint Generator
Frontend blocked on a backend that does not exist yet? Generate the endpoint yourself. Pick a canonical CRUD shape — a paginless user collection, a single product entity, or a 201 Created echo — edit the JSON to match your contract, and point your data layer at the exported URL.
— validating —
$ man crud-endpoint
Everything above is encoded into the #data= fragment of the exported URL — deflated and base64url-packed by your browser. Fragments are never sent to any server, so this mock is shareable and private. Paste the URL anywhere: a teammate's browser decodes it identically.
cat ./tldr.txt
A fake REST API endpoint generator returns realistic CRUD JSON — a collection of users, a single product entity, or a 201 Created response — from a URL your fetch() code can call, so frontend work can proceed before the real backend exists.
./when-to-use-this
- The API contract is agreed but the backend is weeks away, and you need the list view rendering against realistic data today.
- You want to demo a feature without pointing at staging data that may contain real customer records.
- You need a stable, unchanging response to write deterministic UI tests against.
./frequently-asked
- Can my JavaScript fetch() this URL and parse the JSON?
- Not directly. The payload lives in the URL fragment, which browsers never send to a server, so a fetch returns the page shell rather than your JSON. The generated URL is designed to be opened in a browser to inspect and share a response shape. For programmatic fetching you still need a running mock server.
- Does it support POST, PUT, and DELETE?
- You can model the response any HTTP method would return — the 201 Created template mirrors a POST result, complete with a Location header — but the mock is a static response, not a stateful API. It will not persist a created record or reflect it in a later collection request.
- How do I change the field names to match my own schema?
- Edit the JSON directly in the editor. The validator confirms the body parses as you type, and the shareable URL regenerates automatically, so you can shape the response to your exact contract and send the link to whoever needs it.