{"id":21651054,"url":"https://github.com/iansinnott/json-db","last_synced_at":"2026-05-10T15:33:48.867Z","repository":{"id":66111810,"uuid":"27107729","full_name":"iansinnott/json-db","owner":"iansinnott","description":null,"archived":false,"fork":false,"pushed_at":"2014-11-25T04:48:31.000Z","size":204,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T05:41:56.785Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iansinnott.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-25T03:43:09.000Z","updated_at":"2014-11-25T04:48:31.000Z","dependencies_parsed_at":"2023-02-19T22:45:39.641Z","dependency_job_id":null,"html_url":"https://github.com/iansinnott/json-db","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansinnott%2Fjson-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansinnott%2Fjson-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansinnott%2Fjson-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansinnott%2Fjson-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iansinnott","download_url":"https://codeload.github.com/iansinnott/json-db/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244547604,"owners_count":20470103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T07:46:32.310Z","updated_at":"2026-05-10T15:33:43.844Z","avatar_url":"https://github.com/iansinnott.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON DB\n\nAn interface for storing collections as JSON.\n\n## Under Development\n\nThis module is very much in alpha stage. What I consider to be the core functionality (CRUD JSON collections) is complete and mostly tested, but there's still a lot of work that that would need to go into this before it is production ready. \n\n## Purpose\n\nThis project was inspired by an [article by the creator of][article] [NomadList][nomadlist]. If JSON is good enough for NomadList and it's traffic then it's viable for most small/medium sized projects. If you building a large web app, my guess is you aren't reading this because you've already decided Postgres/MySQL/Redis/etc.\n\n[article]: https://levels.io/how-i-build-my-minimum-viable-products/\n[nomadlist]: https://nomadlist.io/\n\n_So why use JSON to store collections when there are so many free, stable database solutions out there?_\n\nMost web sites \u0026 web apps need some means of persisting data. Databases are great, but I don't like writing SQL. This is almost certainly because I don't know it that well, but I also have no desire to really learn it right now.\n\nSo, here are a number of reasons I don't _always_ want to use a full-blown database:\n\n* **Configuration**:  Databases require you to setup the database server and pass configuration variables to your app. That's _really_ annoying when all you want to do is build an app.\n* **Schemas**: It's not possible to know _exactly_ what information each of your models will need to store unless you're rewriting an old codebase. It's also counterintuitive to try to reason out the necessities of your data before the fact. This is fully reflected in the existence of \"migrations\", which let you edit your schema after the fact. NoSQL DBs admittedly do not necessarily suffer from this issue.\n* **Specific APIs**: Every DB has their own API. Even SQL syntax can differ between different relational databases. Mongo uses JS as it's API (which is great) but you still need to know Mongo to use it, an excellent grasp of JS is not enough. ORMs suffer from the same problem. Learning a new ORM is fine, but it's only a means to an end. I'd rather just use my existing knowledge of JS to write code that does what I want.\n* **Overhead**: Running a DB in production uses server resources. If you're running your bootstrapped MVP on a VPS with 512mb of RAM it's great to not have to run a separate process for you Database.\n\n## The case for JSON\n\n_So why JSON?_\n\nIn short, it does not have any of the afformentioned issues that \"real\" databases have.\n\n* No configuration: It's JSON, so all you need to interact with it is the `fs` module. That's not even necessary if you just want to read JSON, in which case you can use Node's `require` function directly.\n* No Schemas: Do whatever you want with your data, whenever you want. It won't complain. \n* API? What API?: JSON is basically just a bunch of string representations of JS data structures.\n* No Overhead: There is no separate process that needs to run. The \"database\" is just written directly to disk.\n\n[Local Storage][ls] is also an appealing option for the front-end, but it's browser specific and can be unwittingly wiped by the user. In my mind Local Storage is a great _complement_ to server-side persistence. It allows you to quickly save a users work on the fly without a round-trip to the server. This is great for preserving work that might otherwise have been lost during a browser/computer crash. However, if you're serious about preserving a users data the only option is server-side.\n\n[ls]: https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Local_Storage\n\n## Docs\n\nThere are no docs. As of this writing the source is under 300 LoC and commented so just skim through it and you're good to go.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiansinnott%2Fjson-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiansinnott%2Fjson-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiansinnott%2Fjson-db/lists"}