logo
json-db

A flexible local file-based JSON database

Mix Objects and Relations

The datamodel of the database is based on JSON and supports both complex and nested object structures as well as relations as used in a relational database.

Both worlds can be mixed for optimal ease and flexibility.

Open Database

Create and Edit Locally

The database is stored on your local filesystem which by first sight can seem counter-intuitive but has the following benefits:

  • Sensitive data does not leave your computer
  • No hosting required
  • Use data-collections in other contexts as they are just plain JSON

Read the Docs

Flexible Schema

The schema is an easy to edit JSON file which makes it simple to add or change fields as the project evolves.

Parts of an existing JSON structure can easily be edited where only the parts which require editing needs to be defined in the schema. Fields not defined in the schema will be left as is.

Read the Schema Docs

json-db editor
The json-db create/edit form for a book database

Example of a schema.json schema definition file and a books.json collection file from a books database.

schema.json

{
  "name": "Books",
  "collections": [
    {
      "name": {
        "singular": "book",
        "plural": "books"
      },
      "fields": [
        {
          "propName": "title",
          "title": "Title",
          "type": "text",
          "required": true
        }, {
          "propName": "totalSales",
          "title": "Total Sales",
          "type": "number",
          "required": true
        }, {
          "propName": "author",
          "title": "Author",
          "type": "relation",
          "targetCollection": {
            "name": "authors",
            "titleField": "name",
            "inversedByPropName": "books"
          }
        }
      ]
    }, {
      "name": {
        "singular": "author",
        "plural": "authors"
      },
      "fields": [...]
    }
  ]
}			

books.json

{
  "lastInsertId": 46,
  "entries": [
    {
      "title": "Lord of the Rings",
      "totalSales": 150000000,
      "author": 100003,
      "_meta": {
        "created": 1697533822531,
        "edited": 1697533822531
      },
      "id": 44
    },
    {
      "title": "To Kill a Mockingbird",
      "totalSales": 40000000,
      "author": 100004,
      "_meta": {
        "created": 1697533984507,
        "edited": 1697533984507
      },
      "id": 45
    },
    {
      "id": 46,
      "title": "Gone with the Wind",
      "totalSales": 30000000,
      "author": 100005,
      "_meta": {
        "created": 1697534102826,
        "edited": 1697620854879
      }
    }
  ]
}