Important
Viewing beta v1 documentation – usable but expect breaking changes. For stable version, see here
👋 Hey! Using React, Vue or Astro? Check my new project MistCSS to write 50% less code.
Create a db.json or db.json5 file
You can read more about JSON5 format here.
Pass it to JSON Server CLI
Get a REST API
Run json-server --help for a list of options
![]() |
Become a sponsor and have your company logo here
Note
This project uses the Fair Source License. Only organizations with 3+ users are kindly asked to contribute a small amount through sponsorship sponsor for usage. This license helps keep the project sustainable and healthy, benefiting everyone.
For more information, FAQs, and the rationale behind this, visit https://fair.io/.
Based on the example db.json, you'll get the following routes:
- → ==
- lt → <
- lte → <=
- gt → >
- gte → >=
- ne → !=
- start
- end
- limit
- page
- per_page (default = 10)
- _sort=f1,f2
- x.y.z...
- x.y.z[i]...
If you create a ./public directory, JSON Server will serve its content in addition to the REST API.
You can also add custom directories using -s/--static option.
- id is always a string and will be generated for you if missing
- use _per_page with _page instead of _limitfor pagination
- use Chrome's Network tab > throtling to delay requests instead of --delay CLI option