← All reportsPublic report

typicode/json-server

Get a full fake REST API with zero coding in less than 30 seconds (seriously)

76k stars JavaScript View on GitHubprofiled 11d ago
Try GitZoid
0PRs this week
0Contributors
22Deps scanned
0Issues found
01 · Repo overview

How json-server is put together

json-server is a zero-config REST API mock server that turns a JSON/JSON5 file into a full CRUD API. It is written in TypeScript (ESM, run natively on Node >=22.12 with --experimental-strip-types) and built on the tinyhttp micro-framework rather than Express. Data flow: the CLI (src/bin.ts) loads db.json/db.json5 through lowdb adapters (with an Observer wrapper for read/write events), createApp wires a Service layer over the Low instance, and HTTP handlers translate query params (_sort, _page/_per_page, _embed, _where, field:operator filters) into service calls whose results are rendered as JSON or via Eta HTML views. Static assets are served from ./public plus optional extra directories via sirv.

Languages

TypeScriptJavaScript

Frameworks

@tinyhttp/applowdbetasirvmilliparsec@tinyhttp/cors

Infrastructure

Node.js >=22.12 runtime (native TS strip-types)GitHub Actions CI (node.js.yml badge)npm package published as 'json-server' CLI binary

Major components

CLI entrypoint (src/bin.ts)

Parses command-line options, loads the db.json/db.json5 data file, watches it with chokidar, and boots the HTTP server.

App factory (src/app.ts)

Builds the tinyhttp application: static serving, CORS, JSON body parsing, route registration, and Eta-rendered index page.

Service layer (src/service.ts)

Implements find/findById/create/update/updateById/patch/patchById/destroyById operations over the lowdb Data store, including _embed relations and _dependent cascading deletes.

Query parsing (src/parse-where.ts, src/matches-where.ts, src/where-operators.ts)

Converts field:operator query params and the _where JSON object into filter predicates and evaluates them against items.

Pagination (src/paginate.ts)

Normalizes _page/_per_page values and produces paginated envelopes with first/prev/next/last metadata.

Adapters (src/adapters/observer.ts, src/adapters/normalized-adapter.ts)

Wrap lowdb adapters to emit read/write lifecycle events and normalize stored data.

ID generation (src/random-id.ts)

Generates string IDs for created resources when none is supplied.

Views & schema (views/index.html, schema.json)

Eta template for the landing page listing db.data, and a JSON schema advertised to users for editor support.

02 · Weekly changes

No digest this week

1 weeksWeek of

03 · Security check

Dependencies and code review

22 dependencies scanned

Dependency advisories

Security Watch

No known advisories across 22 scanned dependencies.

No known advisories in the scanned dependencies.

Code review

No concrete code-level issues confirmed.

Get this report every week for your repos.

GitZoid learns each repo, reports what changed, and flags what needs attention. One flat price for the whole team.

$19 a month, flat · First 10 outputs free · No card required