# Installing bun
curl -fsSL https://bun.com/install | bash
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shThere are 2 important protocols in this app:
- commands.ts: Data storage & sync protocol = all data that is persisted; this is like EventSource data stream.
- ditto Back-end & front-end communication protocol = backend accesses files, metadata etc. Front-end request what to display and sends what front-end controls are used, the backend reacts to that by emitting new data to be displayed.
For peers, pictures are added to the Ditto storage as ATTACHMENT. The metadata in the storage contains a small base64 thumbnail, but the full picture is only downloaded upon request.
https://docs.ditto.live/sdk/latest/crud/working-with-attachments
The typical flow of a Ditto session:
- user A opens app
- user A opens folder
- list of photos is added to storage; metadata is embedded
- user B opens app
- user B's client shows the list of photos
- user B's client downloads the full photos (attachments) for the currently displayed images
In this flow there is also front-end - back-end communication which follows logically from the Ditto session: the Ditto changes will constantly inform the front-ends (on both clients) about the latest state of the storage and the front-end will then request the metadata & images it wants to display.