I need to keep the wire format and the database schema separate in my head so I don't keep running into the "link or object"/"list or string" stuff.

The database can store normalised data, and then separately we can stringify and parse as needed, maybe using intermediate types of it makes life easier.

That should push much more of the complexity to the edge, where it belongs.


New thought: Since the protocol is based on "Actions", do I want to do this as an event sourced thing? Keep current state in memory, write events to disk ("Alice Followed Bob", "Bob Posted a thing", only using ids instead of names) and rebuild state at start time?

Doesn't really solve the "What types do I need" problem, but it makes the database schema easier: an event table with (id, verb, id) triples, and an object table with (id, bob) pairs.

Remote objects (anything I'm not hosting) need to have cache properties along with everything else: last updated, last validated, valid until. Management of that can be wrapped in the Dereference call that can pull from the cache or the network (and might want to do something clever like queue requests for an item while a fetch is in progress).