Repository navigation
Data
The database is PostgreSQL, the schema is created by tide-server at startup (models in core/domain/): missing tables, indexes and columns are added, the rest goes through one-time migrations. This page follows v1.25.0.
erDiagram
users ||--o{ sessions : "logs in"
users ||--o{ api_tokens : "scripts, agents"
users ||--o{ oauth_codes : "MCP over HTTP"
users ||--o{ invites : "invites"
users ||--o{ items : "owns"
users ||--o{ tags : "owns"
users ||--o{ files : "owns"
users ||--o| graph_layouts : "graph"
items ||--o{ items : "parent_id"
items ||--o| metadata_notes : "note"
items ||--o| metadata_folders : "folder"
metadata_notes ||--o{ notes_on_tags : ""
tags ||--o{ notes_on_tags : ""
metadata_notes ||--o{ notes_on_links : "source_id"
metadata_notes ||--o{ notes_on_links : "target_id"
metadata_notes ||--o{ notes_on_files : ""
metadata_notes ||--o{ note_versions : "versions"
metadata_notes ||--o{ metadata_notes : "fork_of"
files ||--o{ notes_on_files : ""
users {
uuid id PK
text name "unique, case-insensitive"
text password_hash
text data_key "notes key, encrypted by TIDE_SECRET"
text locale "fr | en"
text theme "notes, dracula, ..., tokyo, vue"
text color_mode "system | light | dark"
text view "list | grid"
text sort "folder order: title, created, updated, pinned"
text plan "base | pro | ultra"
bool admin "creates, invites and deletes accounts"
int trash_retention_days "0 = never"
int neighbors_limit "notes with the same tags, 0 = all"
text after_merge "ask | delete | keep"
bool note_previews "grid tiles show the text"
uuid avatar "id of a file, NULL = initials"
jsonb snippets "encrypted"
jsonb saved_searches "smart folders, encrypted"
jsonb sidebar_sections "order and visibility of the lists"
timestamp created_at
timestamp updated_at "version of the settings"
bigint items_version "bumped when a path changes"
}
sessions {
uuid id PK
uuid user_id FK
text token_hash "unique"
timestamp created_at
timestamp expires_at
}
api_tokens {
uuid id PK
uuid user_id FK
text name "encrypted"
text token_hash "unique"
bool read_only
text kind "api | cli"
bool oauth "an OAuth client's connection"
text client_id
text refresh_hash
timestamp created_at
timestamp last_used_at
timestamp expires_at "NULL = no limit"
timestamp access_expires_at
}
oauth_codes {
text code_hash PK
uuid user_id FK
text client_id
text redirect_uri
text code_challenge "PKCE"
bool read_only
timestamp expires_at "one minute"
}
throttles {
text key PK "a password from an address..."
int count
timestamp last_at
timestamp expires_at
}
invites {
uuid id PK
uuid user_id FK "the inviting admin"
text token_hash "unique"
text token "encrypted by the admin's key"
timestamp created_at
timestamp expires_at "7 days"
timestamp used_at "NULL = still usable"
}
items {
uuid id PK
uuid user_id FK
uuid parent_id FK "NULL = root"
text kind "note | folder"
text title "encrypted, NULL = untitled note"
text title_hash "HMAC fingerprint of the title"
timestamp created_at
timestamp updated_at
timestamp deleted_at "NULL = not in the trash"
}
metadata_notes {
uuid item_id PK
text content "markdown, encrypted"
bool readonly "locked"
bool pinned "pinned"
smallint_array grams "search index, fingerprints"
smallint_array headings "search index of the headings"
text_array heading_names "fingerprints of the headings"
text_array waiting "titles its links wait for"
bool linked "has a link or a file to check"
uuid fork_of "the original of a copy"
text fork_base "encrypted, base of the merge"
text fork_undo_base "encrypted, undo of a merge"
text fork_undo_content "encrypted"
timestamp fork_merged_at
bool fork_merged_trash
}
metadata_folders {
uuid item_id PK
bool pinned "favorite"
}
tags {
uuid id PK
uuid user_id FK
text value "encrypted"
text value_hash "HMAC fingerprint, unique per account"
}
notes_on_tags {
uuid tag_id PK
uuid note_id PK
}
notes_on_links {
uuid source_id PK
uuid target_id PK
}
files {
uuid id PK
uuid user_id FK
text name "encrypted, NULL for the oldest"
text content_type "image, pdf, zip, sound, video"
bigint size
timestamp created_at
timestamp orphaned_at "no longer cited since, NULL = cited"
}
notes_on_files {
uuid note_id PK
uuid file_id PK
}
note_versions {
uuid id PK
uuid item_id FK
text content "replaced markdown, encrypted"
uuid_array file_ids "cited images, in clear"
bool conflict "a text refused by a 409, kept"
timestamp created_at
}
graph_layouts {
uuid user_id PK
bytea data "the graph's layout, encrypted"
}
| Table | Role |
|---|---|
users |
The accounts and their settings: language, theme and mode, view, sort, plan, the sidebar's lists, the notes with the same tags, the previews, what follows a merge, the snippets, the avatar and the encryption key. updated_at refuses a settings change made over an older read. |
device_codes |
The code tide login shows, between the CLI asking and the account allowing it from the web app: short-lived and single-use. |
sessions |
One login per device. The client keeps the token, the database only its fingerprint. |
api_tokens |
The API tokens of a script or an agent, read-only or not, and the connections of OAuth clients (the MCP over HTTP). The database keeps only fingerprints. |
oauth_codes |
An OAuth client's authorization code, between the consent and the token: single-use, valid for a minute. |
throttles |
The wrong tries in a row (a password from an address...), kept in the database so a restart does not forget them. |
invites |
An admin's invitations a single-use link, valid for 7 days. |
items |
Notes and folders in a single tree, by parent_id. A deletion fills deleted_at: the item is in the trash. |
metadata_notes |
A note's content, encrypted, its lock and its pinning. The title is in items and is read from the content. The search index (grams, headings, heading_names) holds only fingerprints. A copy made from a version remembers its original (fork_of) and the text to merge from. |
metadata_folders |
A folder's favorite flag. |
tags |
An account's tags, drawn from the #words of the notes. |
notes_on_tags |
Which note carries which tag. |
notes_on_links |
The resolved [[links]]: the note source_id points to the note target_id. |
files |
An account's images, and the PDFs, zips, sounds and videos attached to a note. The file itself is in Silo, under <user_id>/<id>; the app reads it through GET /api/files/{id}. |
note_versions |
A note's old texts one version per writing session, at least one per hour, with no limit on the number, encrypted like the content. Deleted with the note. |
notes_on_files |
Which note cites which file. A file that no note cites anymore gets orphaned_at, and goes after the account's trash delay. |
graph_layouts |
The layout of an account's whole graph, computed by the server and shared by its devices, encrypted. |
- An account name is unique, in any case.
- A tag is unique within an account, in any case.
- Two folders in the same folder do not carry the same name, in any case (
Projectsandprojectsclash). Folders in the trash do not count. - All reads filter by
user_id: an account never sees another's data.
Since v0.25.0, the notes' text (metadata_notes.content) and the snippets (users.snippets) are encrypted in AES-256-GCM, with a key specific to each account. This key is stored in users.data_key, itself encrypted by the server secret TIDE_SECRET. Since v0.26.0, the titles (items.title, which also carry folder names), the tags (tags.value) and the images in Silo are too; since v0.28.0 the file names (files.name), and since then the smart folders, the API token names, the copies' merge texts and the graph layout.
An encrypted name cannot be compared in SQL. The database therefore keeps an HMAC fingerprint of the lowercase name (items.title_hash, tags.value_hash), computed with a key derived from the account's. The unique indexes on tags and folder names are on it, and it is how a tag or the note of a [[link]] is found. Paths and sorting are done in the API, after decryption. The search index of the notes (grams, headings) holds such fingerprints too, so a search never reads the text in clear from the database. Still in clear: the dates and the tree structure.
Tide
Using Tide
Terminal and agents
Hosting and development