Compare · json-server

A hosted json-server alternative, for when the mock has to go live

json-server turns a db.json file into a REST API in seconds, and for local prototyping it is hard to beat. It isn't built for production, though: there is no login, no access control, and the data lives in one file on one machine. CodeFreeAPI is the next step: a similar REST API, hosted for you, with real users and rules.

Last reviewed October 2026. Something out of date? Tell us.

Choose json-server if

  • You need a throwaway mock API on your own machine
  • You're writing tests or demos that should run offline
  • You want something free, open source and unlimited, and nobody else will use it

Choose CodeFreeAPI if

  • Your app has to work for real people, not only on localhost
  • You need sign-up, login and records that each user can only see for themselves
  • You want hosting and HTTPS taken care of
  • You need logic beyond CRUD, like sending an email or creating a Stripe checkout

Side by side

How json-server and CodeFreeAPI compare, feature by feature.

Where it runs

json-server

Your machine, or a server you set up

CodeFreeAPI

Hosted, at your-project.codefreeapi.com

Data storage

json-server

One JSON file

CodeFreeAPI

PostgreSQL

Defining data

json-server

Edit db.json by hand, any shape is accepted

CodeFreeAPI

Entities and typed fields in a dashboard

CRUD endpoints

json-server

Yes

CodeFreeAPI

Yes, and each method can be turned off

Filtering, sorting, pagination

json-server

Yes

CodeFreeAPI

Yes, with operators like gte, in and contains

Relations

json-server

Embed related records

CodeFreeAPI

Relation fields, loaded with ?populate=

User sign-up and login

json-server

No

CodeFreeAPI

Yes, with password reset emails

Access control

json-server

No, anyone who can reach it can change data

CodeFreeAPI

Per method: public, signed-in users, record owner or admins

Custom logic

json-server

Write your own Node.js code around it

CodeFreeAPI

Custom endpoints built from steps, no code

File uploads

json-server

No

CodeFreeAPI

Yes, into file fields

API docs

json-server

No

CodeFreeAPI

Swagger UI and an OpenAPI 3.0 file

Price

json-server

Free and open source

CodeFreeAPI

Free plan; Pro (coming soon) at $9/mo

json-server is a great mock

Point json-server at a JSON file and every top-level array becomes a REST resource you can list, filter, create, update and delete. There is nothing to sign up for and nothing to configure, which is exactly what you want when the backend doesn't exist yet.

It is built for prototyping and mocking. Everything lives in a single file, every request can read and write everything, and nothing stands between your data and whoever can reach the port. That's fine on localhost and a problem anywhere else.

What changes when real people use your app

Once an app is public it needs to be hosted somewhere, keep data safe when many people write at once, let people sign up and log in, and stop one user from reading or deleting another user's records. With json-server that means writing a real server: a database, an auth system, middleware for every rule.

CodeFreeAPI gives you those pieces without the server code. Your entities live in PostgreSQL, your app's users get register and login endpoints, and each method of each entity has an access rule, down to "only the person who created this record".

What you give up

json-server is free, unlimited and works offline. CodeFreeAPI's free plan is limited to one project, 10 entities and 100 requests per hour, which is plenty for building and small apps but not for hammering an API in automated tests. Your data also lives on our servers rather than in a file you own, though you can export it as JSON or CSV at any time.

There is no db.json import yet, so moving over means recreating your entities in the dashboard (or starting from a template) and adding records there or with a short script that POSTs them.

Moving a json-server app over

Create an entity for each top-level array in db.json, then point your fetch calls at your project and add an API key. IDs are UUIDs rather than numbers, lists come back as { data, pagination }, and the query syntax differs a little.

json-server
const res = await fetch('http://localhost:3000/tasks?_sort=dueDate');
const tasks = await res.json();
CodeFreeAPI
const res = await fetch('https://my-app.codefreeapi.com/api/v1/tasks?sort=dueDate', {
  headers: { 'X-API-Key': import.meta.env.VITE_API_KEY },
});
const { data: tasks } = await res.json();

Query syntax is in Filtering & sorting, and keeping keys safe in the browser in Access rules.

Questions

Can I import my db.json?
Not yet. Create the entities in the dashboard or start from a template, then add records in the dashboard or with a short script that loops over your db.json and POSTs each record.
Is there a free hosted json-server?
My JSON Server, from the author of json-server, serves a db.json from a GitHub repository, but write requests are not saved, so it is read-only in practice. CodeFreeAPI's free plan stores every write in PostgreSQL.
Should I use CodeFreeAPI for mocking in tests?
For automated tests that send many requests, json-server running locally is the better tool: it is free, fast and has no rate limit. Use CodeFreeAPI for the API your deployed app talks to.

Give your app a real backend today

Free plan, no credit card. Your first API is live in a few minutes.