typicode/json-server
typicode/json-server has 75,732 GitHub stars and 7,279 forks. GitHot measured -3 stars in 24 hours. Last checked 2026-11-08 16:53 UTC. Last push 2026-03-23.
코딩 없이 30초 안에 완전한 모의 REST API를 사용할 수 있습니다(정말입니다)
측정된 스타 증가
- in 24h
- -3
- in 7 days
- 업데이트 지연
- in 15 days
- 업데이트 지연
- in 1 month
- 업데이트 지연
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalJSON-Server
[!IMPORTANT] Viewing beta v1 documentation – usable but expect breaking changes. For stable version, see here
[!NOTE] Using React ⚛️ and tired of CSS-in-JS? See MistCSS 👀
Install
npm install json-server
Usage
Create a db.json or db.json5 file
{
"$schema": "./node_modules/json-server/schema.json",
"posts": [
{ "id": "1", "title": "a title", "views": 100 },
{ "id": "2", "title": "another title", "views": 200 }
],
"comments": [
{ "id": "1", "text": "a comment about post 1", "postId": "1" },
{ "id": "2", "text": "another comment about post 1", "postId": "1" }
],
"profile": {
"name": "typicode"
}
}
View db.json5 example
{
posts: [
{ id: "1", title: "a title", views: 100 },
{ id: "2", title: "another title", views: 200 },
],
comments: [
{ id: "1", text: "a comment about post 1", postId: "1" },
{ id: "2", text: "another comment about post 1", postId: "1" },
],
profile: {
name: "typicode",
},
}
You can read more about JSON5 format here.
Start JSON Server
npx json-server db.json
This starts the server at http://localhost:3000. You should see:
JSON Server started on PORT :3000
http://localhost:3000
Access your REST API:
curl http://localhost:3000/posts/1
Response:
{
"id": "1",
"title": "a title",
"views": 100
}
Run json-server --help for a list of options
Sponsors ✨
Gold
Silver
Bronze
Become a sponsor and have your company logo here
Query Capabilities
JSON Server supports advanced querying out of the box:
GET /posts?views:gt=100 # Filter by condition
GET /posts?_sort=-views # Sort by field (descending)
GET /posts?_page=1&_per_page=10 # Pagination
GET /posts?_embed=comments # Include relations
GET /posts?_where={"or":[...]} # Complex queries
See detailed documentation below for each feature.
Routes
Array Resources
For array resources like posts and comments:
GET /posts
GET /posts/:id
POST /posts
PUT /posts/:id
PATCH /posts/:id
DELETE /posts/:id
Object Resources
For singular object resources like profile:
GET /profile
PUT /profile
PATCH /profile
Query params
Conditions
Use field:operator=value.
Operators:
- no operator ->
eq(equal) ltless than,lteless than or equalgtgreater than,gtegreater than or equaleqequal,nenot equalinincluded in comma-separated listcontainsstring contains (case-insensitive)startsWithstring starts with (case-insensitive)endsWithstring ends with (case-insensitive)
Examples:
GET /posts?views:gt=100
GET /posts?title:eq=Hello
GET /posts?id:in=1,2,3
GET /posts?author.name:eq=typicode
GET /posts?title:contains=hello
GET /posts?title:startsWith=Hello
GET /posts?title:endsWith=world
Sort
GET /posts?_sort=title
GET /posts?_sort=-views
GET /posts?_sort=author.name,-views
Pagination
GET /posts?_page=1&_per_page=25
Response:
{
"first": 1,
"prev": null,
"next": 2,
"last": 4,
"pages": 4,
"items": 100,
"data": [
{ "id": "1", "title": "...", "views": 100 },
{ "id": "2", "title": "...", "views": 200 }
]
}
Notes:
_per_pagedefaults to10if not specified- Invalid
_pageor_per_pagevalues are automatically normalized to valid ranges
Embed
GET /posts?_embed=comments
GET /comments?_embed=post
Complex filter with _where
_where accepts a JSON object and overrides normal query params when valid.
GET /posts?_where={"or":[{"views":{"gt":100}},{"author":{"name":{"lt":"m"}}}]}
Delete dependents
DELETE /posts/1?_dependent=comments
Static Files
JSON Server automatically serves files from the ./public directory.
To serve additional static directories:
json-server db.json -s ./static
json-server db.json -s ./static -s ./node_modules
Static files are served with standard MIME types and can include HTML, CSS, JavaScript, images, and other assets.
Migration Notes (v0 → v1)
If you are upgrading from json-server v0.x, note these behavioral changes:
- ID handling:
idis always a string and will be auto-generated if not provided - Pagination: Use
_per_pagewith_pageinstead of the deprecated_limitparameter - Relationships: Use
_embedinstead of_expandfor including related resources - Request delays: Use browser DevTools (Network tab > throttling) instead of the removed
--delayCLI option
New to json-server? These notes are for users migrating from v0. If this is your first time using json-server, you can ignore this section.
관련 프로젝트 살펴보기
freeCodeCamp/freeCodeCamp
freeCodeCamp.org의 오픈 소스 코드베이스와 커리큘럼입니다. 수학, 프로그래밍, 컴퓨터 과학을 무료로 배울 수 있습니다.
458,792 스타donnemartin/system-design-primer
대규모 시스템 설계 방법을 배우고 시스템 설계 면접을 준비할 수 있습니다. Anki 플래시카드가 포함되어 있습니다.
377,400 스타react/react
웹과 네이티브 사용자 인터페이스를 위한 라이브러리.
252,436 스타vuejs/vue
Vue 2 저장소입니다. Vue 3은 https://github.com/vuejs/core를 방문하세요.
212,626 스타