learn and share notes on atproto (wip) 馃
malfestio.stormlightlabs.org/
readability
solid
axum
atproto
srs
1# Data Model Mapping
2
3This document maps the public AT Protocol Lexicon records to our internal SQL database schema.
4
5## Principles
6
71. **Separation of Concerns**
8 We store "my view" of the world (private state) separate from "the network's view" (public records).
92. **Hydration**
10 We allow hydrating public records into local DB rows for efficient query/indexing, but the source of truth for the record itself is the signed commit in the repository.
113. **Private State**
12 User progress, scheduling, and local-only drafts live ONLY in the internal DB.
13
14## Mapping Table
15
16| Public Lexicon | Internal DB Table(s) | Notes |
17| :----------------------------- | :------------------- | :------------------------------------------------------------- |
18| `app.malfestio.deck` | `decks` | Public metadata. |
19| `app.malfestio.card` | `cards` | Content. |
20| `app.malfestio.note` | `notes` | Standalone notes. |
21| `app.malfestio.source.*` | `sources` | Metadata for articles/lectures. |
22| `app.malfestio.collection` | `collections` | |
23| `app.malfestio.thread.comment` | `comments` | |
24| _(None)_ | `reviews` | **Private**. Logs of every review event. |
25| _(None)_ | `study_progress` | **Private**. Current SRS state for a card (box/interval/ease). |
26| _(None)_ | `user_settings` | **Private**. Daily goals, UI references. |
27| _(None)_ | `drafts` | **Private**. Content being authored before publishing. |
28
29## Sync Strategy
30
31- **Publishing**:
32 Write to `drafts` -> User clicks "Publish" -> Sign record -> Push to PDS -> Move `drafts` content to `decks`/`cards` tables (or mark as synced).
33- **Consuming**:
34 Pull from PDS (firehose or direct sync) -> Validate signature -> Upsert into local tables.