News for hackers. Stuff that matters.
Re:Json-Base – Database built as JSON files by russnewcomer on Thursday July 02, 2020 @02:20PM (#23716317)
I did something vaguely similar to this recently, and I still maintain it was a good choice.

I volunteered to write a medical visit recording app for an NGO in a developing country (a friend works with the NGO and asked me if I would help), and they have almost no budget, no guarantees of internet connectivity when their folks are in the field, and the likelihood that they may be using this software for years.

So I wrote a C# app that uses Winforms, and stores all data as JSON files, the 'table' structure is basically directories in the file system.

It lets them share visit file by import/exporting a zip file of the JSON via sneakernet USB drives [super naive last record written wins], does not rely on an internet connection anywhere at all ever, and all files are stored in plain JSON so that they can conceivably in the future do some data analysis on it. Their alternate plan was to continue using paper, or some terrible regular reconciliation of excel spreadsheets.

Having said all that and defending my decision on this single use-basically-I-wanted-to-have-independent-JSON-instead-of-SQLite-so-in-the-future-maybe-have-a-web-function-to-sync solution,

This feels like a different use case.

Re:Json-Base – Database built as JSON files by jaspax on Thursday July 02, 2020 @02:29PM (#23716415)
I strongly approve of this sort of thing. Using dead-simple and human-readable formats is a big win for things like this, even if it isn't architecturally "correct". It sounds like your decision was a good one for the use case you were looking at.
Re:Json-Base – Database built as JSON files by wilsonrocks on Thursday July 02, 2020 @02:35PM (#23716467)
I made a weekly zoom quiz that stores questions: text, audio, image, video links as json files and it works fine when parsed with Gatsby.
Re:Json-Base – Database built as JSON files by sangfroid_bio on Thursday July 02, 2020 @02:37PM (#23716491)
It is great until your charity gets acquihired by a big think tank/bigger charity/international aid group and most doctors/charity operators are not known for their talent at scaling software.
Re:Json-Base – Database built as JSON files by russnewcomer on Thursday July 02, 2020 @03:43PM (#23717185)
In this case, this NGO is not going to get acquihired. It's more likely that I'll get an email in 5 years from someone who I don't recognize asking me if I know anything about this program because my email has been attached to this thing they got gifted from a dead project, and have been using after all of the original people have moved on. :)
Re:Json-Base – Database built as JSON files by waltpad on Thursday July 02, 2020 @02:37PM (#23716498)
The difference is that your DB is the FS, and each JSON file is an individual record. You're not storing each table in a single JSON document.
Re:Json-Base – Database built as JSON files by dpedu on Thursday July 02, 2020 @06:36PM (#23718915)
How did you get involved with this kind of work?
Re:Json-Base – Database built as JSON files by russnewcomer on Thursday July 02, 2020 @08:14PM (#23719586)
Short version - I worked in that country for a few years and still care deeply about it.

If you want the long version, or you are interested in ways you could also be involved in that kind of project (or know C# and WinForms and want to help??? :) ) my email is my hn username at gmail.

Re:Json-Base – Database built as JSON files by marci on Thursday July 02, 2020 @03:05PM (#23716779)
> use-basically-I-wanted-to-have-independent-JSON-instead-of-SQLite-so-in-the-future-maybe-have-a-web-function-to-sync solution

sounds like you should use CouchDB, it a database/webserver, so you could make a simple html form on localhost[0], CouchDB is built with replication/sync (over HTTP) as one of it's main feature[1], and on the field, an offline-first webapp with PouchDB[2] and Service Workers[3] could have the exact same form

[0] https://docs.couchdb.org/en/stable/best-practices/forms.html

[1] https://pouchdb.com

[2] https://github.com/pouchdb-community/worker-pouch

Re:Json-Base – Database built as JSON files by russnewcomer on Thursday July 02, 2020 @03:47PM (#23717231)
Nope, that's too much complexity.

Because then someone has to run and manage a webserver, and there is no guarantee that ServiceWorkers will work like they do in 5 years or on an ancient Windows7 laptop running IE7.

I want this to be able to run for years without my intervention. :)

Re:Json-Base – Database built as JSON files by marci on Thursday July 02, 2020 @04:25PM (#23717618)
something that will work in 5 years on ancient windows7 and ie7?

couchdb

there's nothing to manage.

On Windows, you install couchdb.msi or whatever, installed as a windows service, it automatically boots at startup time.

Start IE7 go to localhost:5984/_utils, you get the DB's UI. At that point, all you did was installation.

One click later, you created the first db called 'somedb', a click later, you created the first json doc called 'somedoc'. Now you can access it from localhost:5984/somedb/somdoc.

For the HTML form, just after you created 'somedoc', you can click on "add attachment" and upload someform.html, then go to localhost:5984/somedb/somdoc/someform.html from IE7, no need for anything fancy. After you're gone, someone with the most basic HTML knowledge can make some changes if need be. No Internet required. Will work as long as the laptop works.

Re:Json-Base – Database built as JSON files by russnewcomer on Thursday July 02, 2020 @04:55PM (#23717967)
That is a little more complex than, "Here's a .exe, it will save files into your My Documents. Click Export to make a zip, import to read someone else's zip." Plus generating instructions on how to do that would have been tough, and this way should be much easier to spread the app around.

Basically, you don't have a bad idea, and if I were a couch expert or were not on the other side of the world, I might have chosen that. But since I know C#/WinForms well enough, and if we went with the browser I would have to support mobile phones and I don't want to support mobile phones for this use case for a lot of other reasons.

Re:Json-Base – Database built as JSON files by marci on Thursday July 02, 2020 @10:25PM (#23720481)
I understand, it was mostly or the-in-the-future-maybe-have-a-web-function-to-sync.

I also suggested Couch because outside of western countries, you seldom find laptops or desktops (outside of cities), but smartphones with a recent browser are ubiquitous, so if it worked on IE7 it would run anywhere, even in the most remote area with no/crappy network. And the first time I used couch, my programming "knowledge" was very basic HTML (no JS).

> if we went with the browser I would have to support mobile phones and I don't want to support mobile phones for this use case for a lot of other reasons.

Yeah... all in all I completely misinterpreted the requirement of your use-case.

Re:Json-Base – Database built as JSON files by jfkebwjsbx on Friday July 03, 2020 @12:52AM (#23721110)
> And the first time I used couch, my programming "knowledge" was very basic HTML (no JS).

That probably explains a lot: you have a hammer and everything looks like a nail.

CouchDB makes no sense whatsoever for the requirements described.

Re:Json-Base – Database built as JSON files by marci on Friday July 03, 2020 @06:14AM (#23722718)
> you have a hammer and everything looks like a nail.

Actually, that comment made me see things differently on a project that had me scratch my head for the last couple of weeks, so thanks a lot!

Don't know if it's related but I tend to feature creep.

Re:Json-Base – Database built as JSON files by jfkebwjsbx on Friday July 03, 2020 @05:32PM (#23727848)
You're welcome! I am glad you took it in a good way and helped you.