Introduction
bananaDB is a π lightweight JSON database and REST API mock server.
It turns a simple .json
file into a live RESTful API with zero setup β ideal for prototyping, mocking, and testing front-end applications.
With one command:
npx bananadb --db db.json --port 4000
bananaDB will:
- π Spin up a REST server instantly using your JSON file as the database
- π Expose CRUD routes (
GET
,POST
,PATCH
,DELETE
) for each top-level array - π Support custom IDs, auto-increment numbers, or random string IDs
- π Watch your file for changes and hot-reload routes automatically
- π Enable CORS by default, making it front-end-friendly
- π¨ Print available endpoints in a clean, color-coded console view
Example
Given a db.json
:
{
"users": [
{ "id": 1, "name": "Alice" },
{ "id": 2, "name": "Bob" }
],
"posts": []
}
bananaDB generates routes like:
GET /users
GET /users/1
POST /users
PATCH /users/1
DELETE /users/1
GET /posts
Why bananaDB?
- β‘ Zero-config β no schemas, migrations, or servers to install
- π JSON-first β just edit your file and see instant changes
- π§ Drop-in replacement for
json-server
with familiar flags (--db
,--watch
) - π Perfect for front-end devs β mock APIs in seconds and focus on UI
π Next: Getting Started
Last updated on