datascript

Filipe Silva 2022-04-25T12:27:34.311639Z

@chase-lambert @jtth not tiny, but that’s what’s happening in https://github.com/athensresearch/athens

Filipe Silva 2022-04-25T12:29:00.070049Z

well… not quite quite what’s happening there

Filipe Silva 2022-04-25T12:30:56.718279Z

in athens it goes something like: • user interaction triggers an event • frontend resolves that event locally to datascript, then forwards the event to backend • backend also resolves the event to datascript, and forwards the event to all clients • all clients use the event forwarded from the backend to update their state

Filipe Silva 2022-04-25T12:32:15.828389Z

using datascript transactions as the communication medium between the frontend and the backend is not great because the state of each can differ, and thus generate different datascript transactions

Filipe Silva 2022-04-25T12:34:43.770659Z

in athens we model the event stream first, and derive datascript transactions from the events

Filipe Silva 2022-04-25T12:35:01.860959Z

part of this was to be database agnostic and make it easier to change database in both frontend and backend

Filipe Silva 2022-04-25T12:35:25.145429Z

so if you want to go from datascript to sql, you add new SQL resolvers

Filipe Silva 2022-04-25T12:36:21.124349Z

there are our events, as a malli schema https://github.com/athensresearch/athens/blob/main/src/cljc/athens/common_events/graph/schema.cljc

Filipe Silva 2022-04-25T12:36:44.334929Z

this is our event->datascript resolver https://github.com/athensresearch/athens/blob/main/src/cljc/athens/common_events/resolver/atomic.cljc

Filipe Silva 2022-04-25T12:38:14.043529Z

we have information about our design decisions in this space in the ADR folder https://github.com/athensresearch/athens/tree/main/doc/adr

Filipe Silva 2022-04-25T12:43:20.303669Z

happy to talk about anything in this space really, lmk if you want to know more

🙏 1
jtth 2022-04-25T16:42:05.199119Z

thank you! this gives me a good entry point to learn about this!

👍 1