News for hackers. Stuff that matters.
Re:Show HN: Sir – Git-diff-able JSON database on yer filesystem by yodon on Thursday November 05, 2020 @11:01PM (#25004762)
I've often looked for a simple human readable file-based DB-like system like this. Are there other competing packages like this?
Re:Show HN: Sir – Git-diff-able JSON database on yer filesystem by jitl on Thursday November 05, 2020 @11:54PM (#25005021)
I feel like many static site generators have more-or-less filesystem-as-database. Some are more specialized than others. Many SSGs have standardized around the format of `YAML: Metadata\n\n---\n\nContent`, and expose a query interface over the YAML metadata. But, most static site generators don't generally have create/update API - just a read API.

A reason you don't see much in the "tree of simple files as my DB" space is that the whole point of it is to be trivially simple to understand, and thus, to implement.

Now, with file DBs, it's actually quite important to use atomic writes, so that a crash or concurrent operations don't produce errors. For example, the package posted above can corrupt data if there's concurrent writers to the same data file, because all the writes are non-atomic fs.writeFileSync(). What this database should do instead is write to a tempfile, and then rename the tempfile to replace the destination. That way, you get simple last-write-wins semantics with no possibility of creating invalid JSONs.

Re:Show HN: Sir – Git-diff-able JSON database on yer filesystem by asaibx on Thursday November 05, 2020 @11:34PM (#25004929)
There's always recutils [0] which uses a plain text database format stored in files called recfiles.

[0] https://labs.tomasino.org/gnu-recutils/

Re:Show HN: Sir – Git-diff-able JSON database on yer filesystem by graderjs on Thursday November 05, 2020 @11:44PM (#25004983)
I should add that I was inspired by recutils and considered using it before making this. The appeal of using common Unix tools to play with a database is a motivation for me
Re:Show HN: Sir – Git-diff-able JSON database on yer filesystem by leoncvlt on Friday November 06, 2020 @05:10AM (#25006504)
This is something I wrote for a small electron application that needed some simple database functionality: https://www.npmjs.com/package/minim-json-db

Like the OP, stores data locally in .json files, and uses a simple MongoDB-inspired API

Re:Show HN: Sir – Git-diff-able JSON database on yer filesystem by graderjs on Friday November 06, 2020 @05:24AM (#25006571)
Thanks! I'll add to related projects
Re:Show HN: Sir – Git-diff-able JSON database on yer filesystem by graderjs on Thursday November 05, 2020 @11:30PM (#25004915)
I just had a quick search, didn't turn up much but there is this

https://github.com/pksunkara/nosqlite

I could add a section

Re:Show HN: Sir – Git-diff-able JSON database on yer filesystem by LVB on Thursday November 05, 2020 @11:29PM (#25004905)
This is sort of in the space: https://github.com/msiemens/tinydb
Re:Show HN: Sir – Git-diff-able JSON database on yer filesystem by legulere on Friday November 06, 2020 @02:25AM (#25005739)
DBASE is largely text-based