DEV Community

Kobby Owen
Kobby Owen

Posted on

Stop Mocking Manually — Generate a Full Fake API in Seconds

If you’ve ever built a frontend and thought:

“I just need a quick API… why am I writing a whole backend?”

I hit that problem one too many times.

So I built data-server — a tool that lets you spin up a fully working fake REST API in seconds from a JSON or CSV file.


Giff image

⚡ What it actually does

Give it a file like this:

{
  "todos": [
    { "id": 1, "title": "Write docs", "done": false },
    { "id": 2, "title": "Ship feature", "done": false }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Run:

mock-data-server ./todos.json --port 2400
Enter fullscreen mode Exit fullscreen mode

And instantly you get:

GET    /todos
GET    /todos/1
POST   /todos
PUT    /todos/1
PATCH  /todos/1
DELETE /todos/1
Enter fullscreen mode Exit fullscreen mode

No FastAPI. No Express. No setup.


🤯 Why this is useful

Instead of:

  • Writing a backend just for testing
  • Maintaining mock endpoints manually
  • Fighting with fake data tools

You can:

✅ Spin up a real API in seconds
✅ Test full CRUD flows
✅ Persist changes back to your file
✅ Simulate real backend behavior


🔥 Features

  • 📦 Auto-generates REST routes from your data
  • ✏️ Full CRUD support
  • 💾 Writes changes back to JSON/CSV
  • 🔍 Filtering, sorting, pagination
  • ⏱ Optional request delay (simulate latency)
  • 🌍 CORS enabled by default

Example:

curl "http://127.0.0.1:2400/todos?done=false&sort_by=title&order=asc&page=0&size=5"
Enter fullscreen mode Exit fullscreen mode

🚀 Getting started

python3 -m venv venv
source venv/bin/activate
pip install mock_data_server
Enter fullscreen mode Exit fullscreen mode

Then:

mock-data-server data.json --port 2400
Enter fullscreen mode Exit fullscreen mode

🎯 The goal

Make it stupidly easy to go from:

“I need an API”

to

“My API is running”

in under 3 seconds.


🔗 Check it out

👉 https://github.com/kobbyowen/data-server


🙌 Feedback welcome

Still early — I’d love feedback:

  • What would make this more useful?
  • What features would you want next?

If you’ve ever wasted time mocking APIs… this is for you.

Top comments (0)