Data
This page is generated from the project corpus and rewritten on every docs build. Edit the source in corpus/, not here.
SQLite — data/newspapper.db
Schema version: 6. Auto-created and migrated on boot. The path is resolved
from core/src/storage/db.ts via import.meta.url, never from the CWD.
Foreign keys are enforced (PRAGMA foreign_keys = ON).
The .wzd markup is the source of truth. posts.markup is the document; every
other column on posts — title, description, keywords — is derived from its
<head> block on save and exists only so the library can be listed, filtered
and searched without parsing every post. See
the decision and
markup.md for the <head> shape.
posts
| Column | Type | Notes |
|---|---|---|
id | INTEGER PK | autoincrement |
title | TEXT NOT NULL | derived from <head><title> |
description | TEXT NOT NULL DEFAULT '' | derived from <head><description> |
markup | TEXT NOT NULL | the .wzd document — the source of truth |
theme | TEXT NOT NULL DEFAULT warm-industrial-1 | one of the three themes |
status | TEXT NOT NULL DEFAULT draft | CHECK (status IN ('draft','published')) |
created_at / updated_at | TEXT ISO-8601 | updated_at bumped on every markup write |
published_at | TEXT ISO-8601 | NULL | stamped on publish, cleared on unpublish |
Index: idx_posts_status_updated_at on (status, updated_at).
v3 → v4 (2026-08-31) rewrote posts.theme, the defaultTheme setting and the
column default to 'warm-industrial-1'. The default needs a table rebuild, so
posts is copied and renamed with PRAGMA foreign_keys briefly off — DROP TABLE posts would cascade post_keywords and renders away. Skipped unless
sqlite_master still holds the legacy default, so a re-run is a no-op.
published is a manual state,
never automatic.
keywords / post_keywords
keywords | Type | Notes |
|---|---|---|
id | INTEGER PK | |
name | TEXT NOT NULL UNIQUE COLLATE NOCASE | Budget and budget are one keyword |
post_keywords | Type | Notes |
|---|---|---|
post_id | INTEGER → posts(id) ON DELETE CASCADE | |
keyword_id | INTEGER → keywords(id) ON DELETE CASCADE | |
PRIMARY KEY (post_id, keyword_id) |
Index: idx_post_keywords_keyword_id on (keyword_id).
Normalized rather than a comma-joined column because keywords are shared across
posts and used to filter the library — a text column would make that a scan.
Derived from <head><keywords>; setPostKeywords upserts and replaces the join
rows in one transaction.
renders
| Column | Type | Notes |
|---|---|---|
id | INTEGER PK | |
post_id | INTEGER → posts(id) ON DELETE CASCADE | |
output_dir | TEXT NOT NULL | absolute path |
slide_count | INTEGER NOT NULL DEFAULT 0 | |
optimized | INTEGER NOT NULL DEFAULT 0 | set by the publish-time pass |
created_at | TEXT ISO-8601 |
One row per render run; a post's export and thumbnail read the newest.
No app-owned users table since v5 (2026-09-06). Accounts came back on
2026-10-13 as the shared library's tables, in this same file but outside
user_version: auth_users (id, username, scrypt hash, role), auth_sessions
(hashed token, origin local or ward, the Ward session family),
auth_ward_links (user ↔ Ward subject) and auth_migrations. The library
creates and migrates them itself when the API boots (createSqliteStore), and no
app table references them: no row of the app's is keyed by a user, so there
was nothing to migrate when accounts arrived. See
decisions-accounts.md.
sources, articles, feed_items
The reading side's three tables (the Reader's columns on sources, the saved
library with its note, and the Reader's stored items) are in
data-reader.md.
uploads
| Column | Type | Notes |
|---|---|---|
id | INTEGER PK | |
filename | TEXT NOT NULL | original name |
stored_path | TEXT NOT NULL | the kept original |
normalized_path | TEXT | the derived copy, NULL until made |
mime | TEXT NOT NULL | |
width, height | INTEGER | |
bytes | INTEGER NOT NULL DEFAULT 0 | |
created_at | TEXT ISO-8601 |
Rows only — the files live under uploads/. settings is a key-value
table with exactly one key, defaultTheme.
Migration history
How the schema got here, and how a migration step stays crash-safe: migrations.md.
TNode — the .wzd compile target
Not an on-disk format: the JSON template files went with
the template system (2026-08-27).
TNode is in-memory only — core/src/wizard/compile.ts builds one per
<Slide>, and renderTemplate walks it into HTML.
TNode types
| kind | Fields | Description |
|---|---|---|
box | style?, children: TNode[] | Flex container div |
text | text: string, style? | Text node; supports {{binding}} |
repeat | source: string, style?, children: TNode[] | Iterates data[source] array |
TStyle
CSS property map. Supports:
- Numbers → appended with
px(except unitless:fontWeight,lineHeight,opacity,flex,flexGrow,flexShrink,zIndex,order) "$color.key","$spacing.key","$rounded.key"→ resolved from theme tokens"typography": "key"→ expands full typography token set into CSS properties- Any other string → passed through verbatim
Bindings in text nodes: {{fieldName}}, {{item.label}}, {{_index}},
{{_total}}, {{_date}}. The compiler resolves <head> fields before the
interpreter sees the tree; _index/_total come from renderTemplate's
options — that is how <PageCounter/> gets its numbers.
Output directory
output/
YYYY-MM-DD-1/
slide-01.jpg, slide-02.jpg, …slide-NN.jpg (1080×1080, one per slide)
slides.json
caption.txt (present only if a caption was set before render)
thumb.jpg (220×220 grid thumbnail of slide 1; not exported, not a slide)
YYYY-MM-DD-2/ (same-day re-render → increments N; reserved by mkdir when picked)
JPEG only, no .png (decisions.md) —
draft quality ~92; writeRun deletes any stale .png it finds in the target
dir. POST /api/posts/:id/publish (core/src/publish) re-encodes in place at
~85 and flags the render optimized, guarding a repeat publish from
re-degrading the image.
Each directory is recorded as a row in renders.