Json-Base – Database built as JSON files
Someone at my old company basically did this and put it into production.<p>The first problem he encountered was that multiple connections couldn&#x27;t both be using the database at a time without clobbering each other.  &quot;No problem,&quot; he thought, this is a good use case for micro services.  A service sitting on top would ensure that there was only one operation being performed at a time.<p>Next, his problem was that the database would get corrupt sometimes when something bad happened in the middle of writing the file.  His solution was to put the entire JSON format inside of a JSON string.  If it could be parsed successfully, then he knew the whole file was written.  Then all he needed were &quot;backup&quot; files for each table, in case the current one was corrupt.<p>Next, his problem was that querying and iterating through a large table performed badly, since it required parsing the entire thing first.  Querying several times required the whole file to be parsed every time.  The solution was to move SOME of the tables over to JSON-inside-SQLite.<p>EDIT:  Oh yeah, the next problem was how to structure the data inside of sqlite.  He decided to make a single table called &quot;kitchen_sink&quot; that held every JSON value.  There was a column that said which &quot;collection&quot; it belonged to.  There was another column that represented the row&#x27;s primary key.  So you could quickly query for a collection name, and a primary key, and get the full JSON row.<p>So the next problem was that you couldn&#x27;t query quickly for things that weren&#x27;t the primary key.  So new columns had to be added called &quot;opt_key1&quot; and &quot;opt_key2&quot; where certain rows could put key values, and indexes could be added on those columns, so you could quickly query by it&#x27;s first optional key, or it&#x27;s second optional key.