DEV Community

Kotaro Takaoka
Kotaro Takaoka

Posted on

I built a tool that turns JSON into a REST API in 5 seconds

Have you ever been stuck waiting for the backend team to finish an API endpoint while your frontend was ready to go?

I built SnapAPI to solve exactly that. Drop your JSON, get a fully functional REST API in 5 seconds. No signup required.

How it works

Step 1: POST your JSON

curl -X POST https://snapapi.akokoa1221.workers.dev/api/mock \
  -H "Content-Type: application/json" \
  -d '{"users": [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]}'
Enter fullscreen mode Exit fullscreen mode

You get back an endpoint ID and a URL. That's it — your API is live.

Step 2: Use your API

Full CRUD out of the box:

  • GET /api/mock/{id}/users — List all
  • POST /api/mock/{id}/users — Create
  • PUT /api/mock/{id}/users/1 — Update
  • DELETE /api/mock/{id}/users/1 — Delete

CORS is enabled for all origins, so it works from any frontend.

Auto-Generate Realistic Mock Data

Don't want to write sample data by hand? Define a schema:

curl -X POST https://snapapi.akokoa1221.workers.dev/api/mock \
  -H "Content-Type: application/json" \
  -d '{"_generate": {"users": {"count": 10, "schema": {"id": "autoincrement", "name": "name", "email": "email", "age": "number:18-65"}}}}'
Enter fullscreen mode Exit fullscreen mode

Supported types: autoincrement, name, email, number:min-max, boolean, text:sentence, text:paragraph, url:image, date:past, date:future, uuid

Simulate Slow or Flaky APIs

Test how your frontend handles failures:

curl -X POST https://snapapi.akokoa1221.workers.dev/api/mock \
  -H "Content-Type: application/json" \
  -d '{"_config": {"delay": 2000, "errorRate": 0.3, "errorStatus": 503}, "items": [{"id": 1, "name": "Test"}]}'
Enter fullscreen mode Exit fullscreen mode

Every request gets a 2s delay and 30% chance of a 503 error.

Tech Stack

  • Next.js 16 + TypeScript
  • Cloudflare Pages + D1
  • MIT licensed — source on GitHub

Try it now

snapapi.akokoa1221.workers.dev

Drop your JSON or click Generate sample data to see it in action.

Top comments (0)