A decorated template is a whole designed page kept as data: full document elements in fractions of the page they were drawn on, with roles for the photos and words a page brings, links to the theme for its colours and faces, groups for its lockups (a title with its date line, a badge with its words, a stamp with its postmark) and an archetype with tags. Seven cover archetypes in three variants each and sixteen double spreads ship in shared/src/book/templates/data. Laying a page out on one pours its photos into the photo roles in order and its words into the title, subtitle, date, story and caption roles, takes the words it has none for from the book or the journal entry, sets the template in the book theme, scales it to the page format with its bleeds on the bleed of that page, and parks what has no room, a date line the date mark was not made of included. A text set on a colour is made to read there at the size it was fitted to, on a band of ink or paper when neither reads. A mark set as text, such as a large quotation mark, is design to every layout and never taken for the words of a page. A fitted text keeps the size it was drawn at as its ceiling, so a shorter title grows back, and every fitted text is now solved with eight percent of headroom on letter width: set in the browser, the bold condensed faces and several scripts run that much wider than the letter measure, and a fit at exactly the measure wrapped its last word out of the frame. The layout operation of edit_book_page and revise_book_design takes the new ids as a checked string and keeps the name of a locked group, list_book_layouts lists them with archetype, tags and roles, and the design prompt names them. A sibling extract script reads a page drawn in the Studio back into the format, roles, tints and groups kept.
@trek/shared
Single source of truth for TREK's API contracts, expressed as Zod schemas and consumed by both the server (request validation + inferred DTO types) and the client (typed requests/responses).
This package is part of the incremental NestJS + React 19 migration (see the "Brownfield Rewrite" board). It is intentionally dormant until modules start importing it — adding it changes nothing for users.
Rules
- One folder per domain:
src/<domain>/<domain>.schema.ts(+.spec.ts). - Domain-agnostic building blocks live in
src/common/. - A route is only considered migrated once its contract lives here.
- Schemas are the source of truth; server DTOs and client types are inferred from them
(
z.infer<typeof schema>), never hand-duplicated.
Consumption (dev)
Both apps resolve @trek/shared to this package's TypeScript source:
- Server (
tsx): viapathsinserver/tsconfig.json. - Client (
vite): viaresolve.aliasinclient/vite.config.ts(+pathsfor the type-checker).
Production packaging (Docker / workspace wiring) is introduced in card F2, when the server first depends on this package at runtime. Until then prod builds are untouched.
Not yet here
The canonical error envelope is finalised in card F5 (it must match TREK's current Express error responses byte-for-byte), so it is deliberately not invented in F1.