# Sypnia Design documentation > Sypnia Design is where your project’s own design system lives: its guide, its colours, fonts and icons, its pieces and its gallery, and the screens of every use case. Your app looks like you, not like Sypnia. The agent designs with your guide, never invents, and every screen is designed before it is built. Sypnia comes two ways, and every page says which one it is about: - **Design tools** (open source, in your repository): Ingest, storage, aggregation, problem grouping, sessions, replay data and uptime checks. You read it through: The HTTP API, the MCP server, the CLI and the Console: one built-in page with the problems list and the session replay viewer. - **Sypnia Cloud** (the console, proposals and ai help, paid with credits): The same engine, run by us. You read it through: The full app: replay player, performance, uptime, daily summary, search and teams. Every page is also plain Markdown: add `.md` to its address (`https://design.docs.sypnia.com/start/open-source-and-cloud.md`). All pages in one file: https://design.docs.sypnia.com/llms-full.txt ## Start here What Sypnia Design is, how it works, what is open source and what is Sypnia Cloud, and the quickstarts. - [Start here: overview](https://design.docs.sypnia.com/start.md): Section index for Sypnia Design: each customer project's own design system (guide, tokens for colour/type/space/shape/motion in light and dark, voice, icons drawn for the project, logo and assets, PDF export) plus the project's component gallery and screen patterns; an unstyled accessible base (@sypnia/base) + the project's own styled components generated into its repository + a private gallery; screens of every use case designed before they are built; design check; skills so agents never invent. Not based on @sypnia/ui. [Engine, Cloud] - [What Sypnia Design is](https://design.docs.sypnia.com/start/what-it-is.md): What Sypnia Design is: per-project design system. Guide (design/guide.md + PDF): colour roles light/dark, typography, space and shape, motion, voice, icons drawn with Sypnia's construction discipline plus the brand's signature, logo and assets. Pieces: unstyled accessible base @sypnia/base + the project's own styled components generated into src/design/ in its repository (owned by the customer). Gallery: which piece for what, how to combine them, screen patterns per kind of use case. Screens: every use case with a `where` place is designed (every ending and failure) before it is built; `design check` keeps screens to the guide. Skills make agents design with the guide and never invent. Customer apps never look like Sypnia: Design does not start from @sypnia/ui. [Engine, Cloud] - [How it works](https://design.docs.sypnia.com/start/how-it-works.md): Design flow: 1 brand input (logo SVG/PNG, colours, fonts, words, examples) → 2 proposals (palettes, type pairs, shape and voice; the person picks) → 3 guide written (design/guide.md, design/tokens.json → tokens.css light/dark, icons, assets) → 4 pieces generated into src/design/ over @sypnia/base, gallery.yaml with uses, combinations and patterns → 5 screens per case (design/screens/.screen.yaml: where, pattern, regions, every ending and failure, phone and desktop), approved by a person → 6 the agent builds with the pieces, design check in CI. Repository is the source of truth; Cloud writes through pull requests. [Engine, Cloud] - [Open source and Sypnia Cloud](https://design.docs.sypnia.com/start/open-source-and-cloud.md): Design open source (MIT: @sypnia/design CLI/SDK with generator, checker, local gallery, PDF export with a local browser; @sypnia/base; skills. AGPL-3.0: the Design engine server with API, MCP, proposals, renderer) vs Sypnia Cloud (console design.app.sypnia.com, online private gallery shared with the team, proposals with before/after renders, review and approval in App, hosted renderer and PDF export, AI help through Sypnia AI paid with credits, sync with Sypnia Git or GitHub). Same files, same check, move either way. [Engine, Cloud] - [Quickstart: Sypnia Cloud](https://design.docs.sypnia.com/start/quickstart-cloud.md): Design Cloud quickstart: in app.sypnia.com open the project, drop the logo (SVG/PNG) in the chat or Design console → Design reads its colours and shapes, proposes 3 palettes, 3 type pairings, shape and voice → pick → guide drafted (light/dark, icons, assets) → approve (pull request to the project's repository) → gallery at design.app.sypnia.com///gallery → screens of place-order (where shop.order-for-today; endings: reserved, OutOfStock, Closed; phone and desktop) → approve → the agent builds with the pieces; design check passes. [Cloud] - [Quickstart: your repository](https://design.docs.sypnia.com/start/quickstart-repo.md): Design repo quickstart: npx @sypnia/design init (asks name, brand inputs, framework; --logo ./logo.svg, --from guide.md, --components src/design, --yes) writes the [design] table of sypnia.toml, design/guide.md, tokens.json → tokens.css, icons/, brand/, gallery.yaml, and src/design/ components over @sypnia/base; installs the Design skills into .claude/skills/; design gallery serves http://localhost:4520; design screens new place-order; design check exits 1 on findings. Proposals need a model key (SYPNIA_DESIGN_AI_URL/KEY) or are written by your agent with the skills. [Engine] - [How Sypnia uses it](https://design.docs.sypnia.com/start/how-sypnia-uses-it.md): Sypnia dogfooding: Sypnia's guide (night and paper themes, the «lid and light» icon construction, voice) is a Design project like any customer's. @sypnia/ui is the component set made for that guide; because many Sypnia apps share it, it is published as a package (ui.sypnia.com is its gallery) instead of generated into one repository. Telemetry (telemetry.app.sypnia.com), the pilot that uses every Sypnia product: its screens per use case live in design/screens/ of its repository in Sypnia Git, are designed before they are built, and design check runs on every pull request; new icons go through the icon rules; changes to the guide go through proposals with before/after. [Engine, Cloud] ## The design guide Your brand in words and values: colour, type, space, shape, motion, voice, icons and logo. - [The design guide: overview](https://design.docs.sypnia.com/guide.md): Section index: the design guide (design/guide.md in words + design/tokens.json values → tokens.css), colour roles in light and dark with contrast, typography (two families at most, type roles, licensed for the web), space and shape (spacing scale, radius, borders, elevation, layout, touch targets), motion (durations, easings, reduced motion), voice (words, buttons, failure messages), icons (construction discipline + brand signature), logo and assets (versions, clear space, favicon, PDF export for print). [Engine, Cloud] - [What the guide contains](https://design.docs.sypnia.com/guide/the-design-guide.md): Guide parts: brand (name, what the business is, who it is for, three words), colour, typography, space and shape, motion, voice, icons, logo and assets, pieces and gallery, do and don't. design/guide.md = the decisions in words with examples; design/tokens.json = W3C Design Tokens format (DTCG: $value, $type, groups color/font/space/radius/shadow/motion/size), with light and dark modes; design/tokens.css generated (CSS variables prefixed per project, e.g. --espiga-color-accent); guide.pdf exported. Every value in guide.md references a token; design check fails when they disagree. Versioned: each approved change is a new guide version. [Engine, Cloud] - [Colour and themes](https://design.docs.sypnia.com/guide/color-and-themes.md): Colour roles (tokens color.*): surface, surface-raised, surface-sunken, ink, ink-quiet, line, accent, on-accent, focus, success, warning, danger, info, plus brand extras (e.g. color.crust). Each role has a light and a dark value; dark is designed, not inverted. Contrast: text ≥ 4.5:1, large text and UI parts ≥ 3:1, focus ring ≥ 3:1 against neighbours (WCAG 2.2 AA); checked when tokens build and in design check. Theme follows the system by default; the guide decides whether a switch is offered. Status colours never carry meaning alone (icon or words too). Charts get a categorical palette derived from the guide. [Engine, Cloud] - [Typography](https://design.docs.sypnia.com/guide/typography.md): Typography: at most two families (display/headings + text), optionally a mono for codes; type roles font.role.* = display, title, heading, body, small, label, number (tabular figures), code; each with family, size (rem), line height, weight, letter spacing, and phone/desktop sizes. Fonts must be licensed for web use: open licences (SIL OFL, Apache) from the catalogue, or the customer's own licensed files (woff2/ttf/otf, licence recorded in design/brand/fonts/LICENSES.md). Fonts are self-hosted with the app (no third-party font CDN), subset to the guide's languages, font-display swap, two weights per family by default. Body text ≥ 16 px; line length 45–75 characters. [Engine, Cloud] - [Space and shape](https://design.docs.sypnia.com/guide/space-and-shape.md): Space and shape tokens: space.* scale (4 px base: 1=4, 2=8, 3=12, 4=16, 6=24, 8=32, 12=48, 16=64), radius.* (none, control, card, sheet, round), border.* widths, shadow.* (elevation levels 0–3, or borders-only brands), size.touch (minimum 44 px), layout (breakpoints phone < 640, tablet 640–1024, desktop > 1024; content width; gutters 16 px on phone), density (comfortable or compact). Shape language = the guide's choices that make pieces feel like the brand: corner style, fills vs outlines, elevation vs borders, weight of lines. [Engine, Cloud] - [Motion](https://design.docs.sypnia.com/guide/motion.md): Motion tokens: motion.duration.instant (100 ms), quick (180 ms), gentle (280 ms), slow (400 ms, page-level only); motion.easing.enter/exit/move (cubic-bezier values). Rules: motion explains (feedback, where something came from, continuity), never decorates; nothing loops except a loading skeleton's shimmer; prefers-reduced-motion replaces movement with a fade or nothing; no motion blocks input; no flashing more than 3 times a second. Per-piece motion lives in the generated components; screens never animate on their own. [Engine, Cloud] - [Voice](https://design.docs.sypnia.com/guide/voice.md): Voice section of guide.md: personality (three words), how to address people (tú/usted, you), words to use and avoid (glossary of the business: «pick-up», not «collection»), button labels = verbs that say the result («Reserve my bread»), messages: what happened + what to do now, no blame, no codes; failure messages come from each case's failures[].tell in Cases and must follow the voice (design check flags tell texts that break the voice rules it can test: length, blame words, codes); languages of the app and who translates. Also used by Mail templates. [Engine, Cloud] - [Icons](https://design.docs.sypnia.com/guide/icons.md): Icons: never from a stock set. Construction discipline shared with Sypnia's own set: 24 px grid, 2 px padding (20 px live area), one stroke width for the whole set (brand chooses, e.g. 1.5–2 px), one cap and join style, curves as arcs of circles with a few fixed radii, optical balance between round and square shapes, one idea per icon, no text, legible at 16/20/24 px. Plus the brand's signature: one recognizable trait (Sypnia: the open lid and the light; La Espiga: stroke ends cut like a grain, and a small grain dot as its accent). Rules in design/icons/rules.yaml; icons as design/icons/.svg using currentColor; design check icons verifies grid, padding, stroke, caps, signature and names. A screen that needs a missing icon triggers a proposal. [Engine, Cloud] - [Logo and assets](https://design.docs.sypnia.com/guide/logo-and-assets.md): Logo and assets in design/brand/: logo.svg (full), mark.svg, mono.svg, on-dark.svg; clear space and minimum size; favicon.svg + PNG sizes, app icons (192/512, Apple touch 180), social image (1200×630) generated from the guide. Upload SVG or PNG (PNG traced to SVG only with approval; the original is kept). Without a logo, Design proposes a wordmark from the chosen type and a simple mark, never imitating other brands. Print: design export --pdf --print writes guide.pdf with colour values in HEX, RGB and approximate CMYK (no Pantone matching), logo files for the printer, clear space and sizes; design export --assets zips the brand kit. [Engine, Cloud] ## Pieces and gallery The accessible base underneath, your own styled pieces on top, and the gallery that says what each one is for. - [Pieces and gallery: overview](https://design.docs.sypnia.com/components.md): Section index, three layers: (1) @sypnia/base — unstyled accessible React behaviour shared by every customer (focus, keyboard, screen readers, layers, dialogs, menus, phone behaviour), built on React Aria; (2) your components — styled with the project's tokens, generated into src/design/ of the customer's repository, owned by the customer; (3) the gallery — design/gallery.yaml + a private page: pieces, when to use and not, combinations, screen patterns per kind of use case. Customer apps never start from @sypnia/ui. [Engine, Cloud] - [The accessible base](https://design.docs.sypnia.com/components/the-base.md): @sypnia/base (MIT, React 19, built on React Aria; npm): unstyled primitives — Button, Link, TextField, NumberField, SearchField, Select, ComboBox, Checkbox, RadioGroup, Switch, Slider, Dialog, AlertDialog, Sheet, Popover, Menu, Tooltip, Tabs, Disclosure, Toast region, Table, GridList, Calendar, DatePicker, FileTrigger, DropZone, Toolbar, Breadcrumbs, Form, VisuallyHidden, SkipLink, Layer. Guarantees: visible focus only for keyboard, full keyboard use, ARIA roles/names/states, focus trapped in dialogs and returned on close, Escape closes the top layer, scroll lock, one layer manager for z-order, live regions for toasts, phone behaviour (44 px hit areas, sheets instead of popovers under 640 px, safe areas, virtual keyboard keeps fields visible, no hover-only actions), RTL. States as data attributes (data-pressed, data-focus-visible, data-open, data-invalid, data-disabled, data-selected) for plain CSS. No CSS, no tokens, no icons. Apps import pieces from their own src/design, never the base directly. [Engine, Cloud] - [Your components](https://design.docs.sypnia.com/components/your-components.md): Your components: generated by design components generate into src/design/ (configurable in the [design] table of sypnia.toml, components.dir): one folder per piece (Button.tsx + Button.module.css + README.md), index.ts exporting all, written as ordinary React + CSS modules over @sypnia/base using only tokens. The generator writes structure and accessibility wiring; the look comes from the guide's shape language and tokens; the agent with the sypnia-design-guide skill tailors pieces to the brand. Brand pieces beyond the base (ProductCard, PickupCode, Stepper) are composed from base pieces. Ownership: plain source in the customer's repo, edit freely; each file records generated-from guide version and a hash; components status shows untouched/edited/out of date; regeneration after a guide change is a three-way merge in a pull request; edited parts are never overwritten silently. Frameworks: React (Next.js, Vite, Astro with React); tokens.css usable anywhere. [Engine, Cloud] - [Your gallery](https://design.docs.sypnia.com/components/the-gallery.md): Gallery = design/gallery.yaml (source) + a page. gallery.yaml: pieces[] {id, component (path in src/design), for, not_for, variants[], states[], combines_with[], example}; combinations[] {id, pieces[], for, rule}; patterns[] (see Patterns). The page: design gallery serves http://localhost:4520 (engine); Cloud serves a private page at design.app.sypnia.com///gallery, team members only, share links expire (default 7 days); every piece live, light/dark, phone/desktop, every state, with for / not for and the screens that use it. The agent reads gallery.yaml before choosing a piece; a piece not in gallery.yaml cannot be used. [Engine, Cloud] - [Screen patterns](https://design.docs.sypnia.com/components/patterns.md): Patterns in gallery.yaml patterns[] {id, for (kind of case), regions[], pieces[], phone, desktop, states_required[]}. Default set the guide starts from (renamed and shaped per brand): do-something (form to an outcome: place-order), review-a-list (list and detail: today's orders), see-one-thing (detail), find (search and filter), summary (numbers and what needs attention), settings, sign-in, first-time (empty and onboarding). Required states for every pattern: loading (skeleton in the shape of the result), empty, each outcome, each failure of the case, offline. The pattern a case uses is chosen in its screen file; a case whose kind fits no pattern triggers a proposal. [Engine, Cloud] - [Design and @sypnia/ui](https://design.docs.sypnia.com/components/design-and-sypnia-ui.md): @sypnia/ui (ui.sypnia.com, MIT) is Sypnia's own styled library for Sypnia's guide (night/paper, «lid and light» icons). Design never starts a customer project from it: customer apps must not look like Sypnia. What is shared: only the invisible behaviour (both use React Aria underneath; customers get it through @sypnia/base). A customer who wants Sypnia's look can install @sypnia/ui like any open-source library, outside Design's generated pieces; Design then treats it as that project's pieces only if the guide adopts it explicitly. [Engine, Cloud] ## Screens The screens of every use case, designed before they are built, and the check that keeps them to the guide. - [Screens: overview](https://design.docs.sypnia.com/screens.md): Section index: screens per case (design/screens/.screen.yaml for every case with `where`, every ending and failure, phone and desktop, approved by a person before building), design check (tokens only, pieces only, icons only, every case and state designed, contrast, focus, touch targets, first screen), changing the guide (proposals with before/after, versions, regeneration by pull request). [Engine, Cloud] - [Screens per case](https://design.docs.sypnia.com/screens/screens-per-case.md): Screen file design/screens/.screen.yaml: format 1, case (id), where (place id in the Cases navigation tree, e.g. shop.order-for-today; path shown as breadcrumb), pattern (gallery pattern id), guide (version), status draft|approved|built, approved_by/at, regions {region: [pieces with content]}, states {loading, empty, outcome., failure. (message from case failures[].tell), offline}, phone/desktop notes, first_screen: true for entry screens. Cases without `where` (external, scheduled, event) need no screen; their effects on other screens are designed there. Renders: Cloud renders every state at phone 390×844 and desktop 1366×700 and 1876×951, light and dark. A screen is built only after approval; when the case changes (new failure) the screen file becomes out of date and design check reports the missing state. [Engine, Cloud] - [The check](https://design.docs.sypnia.com/screens/the-check.md): design check (CLI, SDK, CI, MCP check tool): reads design/, src/design/, the app's source (TSX/JSX/CSS/MDX/Astro) and cases/. Findings with codes: raw-color, raw-size (px/rem outside tokens), raw-font, unknown-piece (import not from src/design or not in gallery.yaml), base-import (imports @sypnia/base directly), unknown-icon (SVG or icon library not in design/icons), icon-rules, missing-screen (case with where and no screen file), missing-state (outcome/failure not designed), screen-out-of-date, contrast, focus (no visible focus state), touch-target (< size.touch on phone render), first-screen (main content below the fold at 1366×700 or 390×844), voice (tell text too long, codes, avoided words), guide-drift (tokens.json vs guide.md vs tokens.css), components-out-of-date. Severity error|warning; exit 1 on errors; --json; waivers in sypnia.toml [[design.checks.waive]] {code, path, reason, until}. Renders-based checks (touch-target, first-screen, contrast in context) need a browser (local Chromium) or Cloud. [Engine, Cloud] - [Changing the guide](https://design.docs.sypnia.com/screens/changing-the-guide.md): Guide changes are deliberate: a proposal (kind: tokens|piece|pattern|icon|voice|brand; author person or agent; reason) shows before/after renders of every affected screen and piece and the list of screens touched; contrast and check run on the 'after'; a person approves (never the agent that proposed it; MCP cannot approve); approval bumps the guide version and opens one pull request with tokens.json, tokens.css, guide.md, regenerated components (three-way merge for edited ones) and updated screen files; removing a piece lists the screens that use it and blocks until they move. Rejected proposals are kept with the reason. Engine: proposals are branches + pull requests; Cloud adds the review page and renders. [Engine, Cloud] ## Skills The Design skills that make an agent design with your guide, and never invent. - [Skills: overview](https://design.docs.sypnia.com/skills.md): Section index: Design skills (MIT, SKILL.md packages in sespinosav/sypnia-skills plugin sypnia and inside @sypnia/design, copied by design init into .claude/skills/): sypnia-design-guide, sypnia-design-icons, sypnia-design-screens, sypnia-design-build, sypnia-design-check. Rules: read the guide first, only tokens/pieces/icons/patterns of the guide, missing thing → proposal, never copy another brand, messages from Cases, check before proposing. Work in Claude Code, Cursor, Sypnia Agent and any agent that reads SKILL.md; MCP optional. [Engine, Cloud] - [The Design skills](https://design.docs.sypnia.com/skills/the-design-skills.md): Skills: sypnia-design-guide (interview at the person's level, read uploaded logo/brand, propose 2–3 options per decision shown on real screens, write guide.md + tokens.json, never copy a brand, licensed fonts only), sypnia-design-icons (draw SVG icons with rules.yaml construction + signature, show 16/20/24 px, run icon check), sypnia-design-screens (read the case and its where, pick the gallery pattern, write the screen file with every ending and failure, messages from tell, request renders), sypnia-design-build (implement an approved screen with src/design pieces only, no raw values, no direct @sypnia/base imports), sypnia-design-check (run design check, fix findings, propose guide changes for what is missing, never waive without a person). Each SKILL.md: when to use, what it reads, steps, checks that prove it is done. [Engine, Cloud] - [Working with your agent](https://design.docs.sypnia.com/skills/working-with-your-agent.md): Install: design init copies the skills into .claude/skills/ (and .cursor/rules pointer) and adds an AGENTS.md section; or the Claude Code plugin (/plugin marketplace add sespinosav/sypnia-skills; /plugin install sypnia@sypnia); Sypnia Agent loads them automatically in projects whose sypnia.toml has a [design] table. MCP optional (mcp.design.sypnia.com) for renders, proposals and the online gallery; without it the skills work on files only. Session example: «design the screens of Order for today» → reads case place-order (where shop.order-for-today, failures OutOfStock, Closed) → pattern do-something → screen file draft → renders → person approves → build → check 0 findings. [Engine, Cloud] ## SDK, CLI and MCP The @sypnia/design package, the design command and the MCP tools for agents. - [SDK, CLI and MCP: overview](https://design.docs.sypnia.com/tools.md): Tools: @sypnia/design (MIT): SDK subpaths /tokens, /check, /gallery, /files, CLI npx @sypnia/design (command design); @sypnia/base (MIT) unstyled React primitives; MCP server https://mcp.design.sypnia.com (or /mcp). [Engine, Cloud] - [The @sypnia/design package](https://design.docs.sypnia.com/tools/sdk.md): @sypnia/design subpaths: /tokens (readTokens(dir) → typed tokens with light/dark; token('color.accent') → CSS var name; for charts/canvas), /check (check({ root, renders?: 'local'|'cloud'|false }) → { findings[], errors, warnings }), /gallery (serveGallery({ port: 4520 })), /files (parse/validate the [design] table of sypnia.toml, gallery.yaml, screen files, rules.yaml against JSON Schemas), /client (createDesign({ token } | { baseUrl }) for the API: proposals, renders, exports). CLI npx @sypnia/design. ESM + types; Node 20+. [Engine, Cloud] - [The CLI](https://design.docs.sypnia.com/tools/cli.md): design CLI: login/logout/whoami/use ; init [--logo --from --components --framework --yes]; guide show|propose|versions; tokens build|lint; icons new|check|ls; components generate|status|diff; gallery [--port 4520]; screens new |ls|render |approve (person session only); check [--json --renders local|cloud|off --fix]; propose (opens a proposal from local changes); proposals ls|show|approve|reject (person only); export --pdf [--print] | --assets; pull|push (sync with Cloud). --json everywhere; SYPNIA_DESIGN_TOKEN or the session. [Engine, Cloud] - [MCP for agents](https://design.docs.sypnia.com/tools/mcp.md): Design MCP at https://mcp.design.sypnia.com (engine: /mcp): OAuth (PKCE, DCR) or PAT; project tokens limit to one project. Read tools: get_guide, get_tokens, list_pieces, get_piece, list_patterns, list_icons, get_screen, list_screens, check. Write tools (drafts only): draft_screen, draft_icon, propose_change (opens a proposal), render (pictures of a screen/piece/state), export_pdf. No approve tool: approving proposals and screens needs a person in the console, App or CLI session. Every call recorded. [Engine, Cloud] ## API reference The Design API: addresses, authentication, errors and limits. - [API reference: overview](https://design.docs.sypnia.com/api.md): Design API at https://design.api.sypnia.com/v1 (engine: /v1). Auth: Authorization: Bearer ; token scopes read, write (drafts, proposals, renders, exports), admin (keys, repository link); approving proposals and screens needs a person's session (tokens get 403 person_required). Error shape {error {code, message}}; 400 invalid_request/invalid_file, 401 unauthorized, 403 forbidden/person_required, 404 not_found, 409 conflict/out_of_date (guide version moved), 413 too_large, 415 type_not_allowed, 422 check_failed/contrast_failed/unsafe_svg/font_licence_missing, 429 rate_limited (retry-after), 402 insufficient_credits. [Engine, Cloud] - [Endpoints](https://design.docs.sypnia.com/api/endpoints.md): Design API endpoints under /projects/{project}: GET guide (?version), GET guide/versions, GET tokens (?format=json|css); proposals GET/POST, GET {id}, POST {id}/approve|reject (person); assets POST (multipart: logo, font with licence, image), GET, DELETE {id}; icons GET, POST (draft), GET {name}; gallery GET (pieces, combinations, patterns); screens GET, GET {case}, PUT {case} (draft), POST {case}/approve (person); renders POST {target: screen|piece|state, themes, widths} → 202 job, GET {id}; exports POST {kind: pdf|print|assets} → 202, GET {id}; checks POST {ref} → findings, GET {id}; repository GET/PUT (link to Sypnia Git/GitHub); tokens GET/POST/DELETE (API tokens). [Engine, Cloud] ## Architecture How Sypnia Design is built: its parts, where they run, and why your repository holds the truth. - [Architecture: overview](https://design.docs.sypnia.com/architecture.md): Design architecture: @sypnia/design (TypeScript: CLI, token builder, generator, checker with TS/CSS parsers, local gallery, local renderer with Chromium) and @sypnia/base (React, React Aria) run in the customer's repo; the Design engine (TypeScript, AGPL-3.0: API, MCP, proposals, Git writer, renderer and PDF exporter on headless Chromium, asset sanitizer) keeps proposals, renders, assets metadata and check results in Postgres (sypnia_design) and files in S3-compatible storage; writes approved changes as pull requests to Sypnia Git or GitHub; AI proposals through Sypnia AI (or any OpenAI-compatible endpoint); identities from Sypnia Data. The repository is the source of truth; the engine holds no second copy of the guide. [Engine, Cloud] - [Request paths](https://design.docs.sypnia.com/architecture/request-paths.md): Proposal: POST /proposals → validate against guide version (409 out_of_date if base moved) → apply on a temporary branch → generator + tokens build in a worker → render jobs (SQS) for every affected screen/piece, before and after, light/dark, 3 widths → contrast + check on after → ready; approve (person session) → guide version +1 → Git writer opens one PR (tokens.json, tokens.css, guide.md, regenerated components with three-way merge, screen files) → status merged when the PR merges (webhook). Render: job → headless Chromium loads the gallery build of the branch at the state → PNG to S3 → signed link. Check in CI: design check on runner; renders-based checks local Chromium or POST /checks. [Engine, Cloud] - [Data model](https://design.docs.sypnia.com/architecture/data-model.md): sypnia_design schema: projects (org, slug, repository, branch, guide_version, components_dir), guide_versions (project, version, commit_sha, approved_by, approved_at), proposals (id, project, kind, base_version, reason, changes jsonb, author, author_kind person|agent, status draft|rendering|ready|approved|rejected|merged, decided_by, pr_url), renders (target, state, theme, width, image_ref, expires_at), assets (kind logo|font|image, original_ref, sanitized_ref, licence, uploaded_by), exports (kind, ref), checks (ref, commit_sha, findings jsonb, errors, warnings), api_tokens (scopes, hash), audit (actor, action, at). Repository files are the source of truth for guide, tokens, icons, gallery, screens and components; the schema stores no copy of them beyond commit references. [Engine, Cloud] - [Reference implementation on AWS](https://design.docs.sypnia.com/architecture/reference-implementation-aws.md): Design on AWS (us-east-1): Lambda (Node 22) for the API, MCP, proposals and the Git writer; Lambda container images with headless Chromium for renders, checks with pictures and PDF export (up to 10 GB memory, 15 min); SQS + DLQ for render/export jobs; RDS PostgreSQL (sypnia_design schema, shared Sypnia Cloud instance); S3 for originals, sanitized assets, renders (30-day lifecycle) and exports, KMS-encrypted; CloudFront for design.api.sypnia.com and signed render links; Sypnia AI for proposals; Sypnia Git webhooks for merges; Sypnia Data for identities; Telemetry traces per use case; CloudWatch alarms on queue age and DLQ. [Cloud] - [Failures and scaling](https://design.docs.sypnia.com/architecture/failures-and-scaling.md): Design failures: render fails → retried 3 times, then the state shows «picture unavailable» and the proposal can still be reviewed from files; Sypnia AI unavailable → proposals by hand or by the agent still work, AI help returns 503 ai_unavailable; Git unreachable → approval kept, pull request retried with backoff for 24 h, then the proposal shows the error; repository moved on (conflict) → Design rebases its branch, conflicts shown in the PR; database down → API 503, local tools unaffected; DLQ alarm. Scaling: stateless Lambdas, render jobs in parallel per proposal, gallery build cached per commit, renders reused by (commit, target, theme, width). [Engine, Cloud] - [Codebase](https://design.docs.sypnia.com/architecture/codebase.md): sypnia-design repo: packages/design (@sypnia/design: cli, tokens, generator, check, gallery, files with JSON Schemas, client), packages/base (@sypnia/base on React Aria), engine/ (TypeScript server: api, mcp, proposals, git-writer, renderer, exporter, sanitizer), skills/ (sypnia-design-* SKILL.md, copied to sypnia-skills), migrations/, deploy/ (compose with Postgres and MinIO, AWS template), spec/openapi.yaml, spec/schemas/*.json, docs/ARCHITECTURE.md; tests: unit, rendered snapshots, accessibility tests of @sypnia/base with keyboard and screen-reader trees. [Engine, Cloud] ## Self-hosting Use Design with no server at all, or run the engine with Docker or on AWS. - [Self-hosting: overview](https://design.docs.sypnia.com/self-hosting.md): Self-hosting Design: level 1 — no server: @sypnia/design CLI in the repo does init, tokens, generation, gallery, check, local renders and PDF with local Chromium; proposals are branches + pull requests, AI help from your agent with the skills. Level 2 — the engine (Docker image ghcr.io/sespinosav/sypnia-design, port 7700, Postgres + S3-compatible storage, your OpenAI-compatible model endpoint, Git credentials) adds the API, MCP, shared proposals with renders and a team gallery. The console stays Sypnia Cloud. [Engine] - [Docker](https://design.docs.sypnia.com/self-hosting/docker.md): Design Docker: docker run -p 7700:7700 with DATABASE_URL, STORAGE_URL, PUBLIC_URL, GIT_PROVIDER + GIT_TOKEN, optional SYPNIA_DESIGN_AI_URL/KEY; image includes headless Chromium (about 1 GB memory per concurrent render; RENDER_CONCURRENCY). Compose file adds Postgres 16 and MinIO. Point the CLI with design use http://localhost:7700. [Engine] - [Configuration](https://design.docs.sypnia.com/self-hosting/configuration.md): Design engine env: DATABASE_URL, STORAGE_URL (S3-compatible; local folder default), PUBLIC_URL, PORT (7700), GIT_PROVIDER (sypnia|github|gitlab), GIT_URL, GIT_TOKEN, SYPNIA_DESIGN_AI_URL + SYPNIA_DESIGN_AI_KEY (OpenAI-compatible; empty = no AI help), RENDER_CONCURRENCY (2), RENDER_RETENTION_DAYS (30), UPLOAD_MAX_MB (10), JWKS_URL (accept JWTs from your issuer, e.g. Sypnia Data), TELEMETRY_ENDPOINT (OTLP). [Engine] - [Upgrades and backups](https://design.docs.sypnia.com/self-hosting/upgrades.md): Design upgrades: engine runs migrations on start; render jobs drain between versions. @sypnia/design and @sypnia/base follow semver; format version of the design/ files and of sypnia.toml — newer tools read older formats, design upgrade rewrites files to the new format in a pull request; @sypnia/base minor versions never change behaviour people rely on without a changelog entry. Back up: the repository holds the design (guide, tokens, icons, gallery, screens, pieces); the engine's database holds proposals, approvals and audit; storage holds uploaded originals. [Engine] ## Security Uploads, approvals, agents, licences, the threat model and the checklist. - [Security: overview](https://design.docs.sypnia.com/security.md): Design security: uploads sanitized (SVG scripts/external refs removed, fonts parsed and limited to WOFF2/TTF/OTF, images re-encoded); only a person approves proposals and screens (tokens and MCP cannot); every change reaches the app as a reviewed pull request; galleries and renders private to the organization, share links signed and expiring; uploaded brand files are data, never instructions to the agent; font licences recorded; nothing in the customer's app calls Design at run time. [Engine, Cloud] - [Threat model](https://design.docs.sypnia.com/security/threat-model.md): Design threats: malicious SVG (script, foreignObject, external href) → sanitized, original quarantined, unsafe_svg; malformed font → parsed, WOFF2/TTF/OTF only, size limit; prompt injection in uploaded brand files or screenshots → treated as data, proposals still need a person; agent approving its own change → impossible (no approve tool, person session required, proposer ≠ approver); leaked token → scopes, no approval, revoke; generated code carrying something unexpected → plain source in a PR, check runs, reviewed; unreleased brand leaking → private gallery, signed expiring links, audit; copying another brand or unlicensed fonts → skills refuse, licence recorded, font_licence_missing; regenerated pieces overwriting your edits → three-way merge in a PR. [Engine, Cloud] - [Checklist](https://design.docs.sypnia.com/security/checklist.md): Design checklist: design check runs on every pull request and blocks on errors; screens of every case with where approved; every failure state designed with its message; contrast, focus, touch targets pass on renders; fonts have recorded licences; logo and assets are yours or licensed; tokens used by CI are read-only; approvers are the right people; waivers have reasons and end dates; share links for outsiders expire. [Engine, Cloud] ## Sypnia Cloud Your account, the console, credits, limits and plans. - [Sypnia Cloud: overview](https://design.docs.sypnia.com/cloud.md): Design in Sypnia Cloud: belongs to a project of the organization (the same project as the other products); Sypnia account with roll-in on first use; console design.app.sypnia.com and the Design panel in App; approvals by members with the right role (owner and admin by default; configurable «brand approvers»); AI help and hosted renders/exports paid from prepaid credits. [Cloud] - [Credits and limits](https://design.docs.sypnia.com/cloud/credits-and-limits.md): Design metered items: AI help (proposals: palettes, type, icons, screens) through Sypnia AI, in credits by use; renders (pictures); exports (PDF, brand kit); asset storage (GB). Plans include amounts; overage from prepaid credits item by item at prices published with the plans; extra capacity per item; no charges afterwards. The console shows usage per day and what each proposal cost. Free with no metering: design check, the local tools, the gallery page. Limits per plan: projects with a guide, members who approve, renders per month, storage; values published with the plans; technical limits on Limits. [Cloud] - [Plans](https://design.docs.sypnia.com/cloud/plans.md): Design plans: Design on its own (free plan and paid plans), inside the global Sypnia subscription tiers, extra capacity per item; all prepaid (subscription in advance or credits topped up with PayPal); larger of product plan vs tier per item; prices published with the plans. [Cloud] ## Reference Glossary, Design files, limits, design decisions, the changelog and common questions. - [Reference: overview](https://design.docs.sypnia.com/reference.md): Glossary, Design files, limits, design decisions, the changelog and common questions. [Engine, Cloud] - [Glossary](https://design.docs.sypnia.com/reference/glossary.md): Sypnia Design vocabulary: design guide, guide version, token, colour role, theme, type role, shape language, signature, construction rules, piece, the base, your components, gallery, combination, pattern, screen file, place (where), state, proposal, brand approver, finding, waiver, render, export, brand kit. [Engine, Cloud] - [Design files](https://design.docs.sypnia.com/reference/files.md): Settings: the [design] table of sypnia.toml (the project's one configuration file; top-level format = 1 and project): guide (version), prefix (CSS variable prefix, e.g. espiga), components {dir: src/design, framework: next|vite|astro}, languages [es, en], themes {light, dark, switch: bool}, checks {renders: local|cloud|off, first_screen_sizes, [[design.checks.waive]] {code, path, reason, until}}. Content files in design/, format 1: tokens.json: W3C Design Tokens ($type, $value, $description; dark values in $extensions.sypnia.dark); required groups color (roles), font (families, role.*), space, radius, border, shadow, motion (duration, easing), size (touch), layout (breakpoints, content). gallery.yaml: pieces[] {id, component, for, not_for, variants, states, combines_with, example}, combinations[] {id, pieces, for, rule}, patterns[] {id, for, regions, pieces, phone, desktop, states_required}. screens/.screen.yaml: format, case, where, pattern, guide, status draft|approved|built, approved_by, approved_at, first_screen, regions, states, phone, desktop. icons/rules.yaml: grid 24, padding 2, stroke, cap round|square, join, radii[], signature {description, picture}, sizes [16,20,24]. JSON Schemas in spec/schemas/ of the engine repo; unknown fields kept and warned, x- prefix for your own. [Engine, Cloud] - [Limits](https://design.docs.sypnia.com/reference/limits.md): Design limits: upload 10 MB per file (UPLOAD_MAX_MB in the engine); SVG up to 1 MB after cleaning; fonts WOFF2/TTF/OTF up to 5 MB each, 2 families + 1 mono per guide, 4 weights per family; logo formats SVG, PNG; icons 500 per project; pieces 300 per gallery; patterns 40; screen file 256 KB; render widths 320–2560 px; renders kept 30 days; share links 7 days by default, at most 30; PDF up to 80 pages; proposal renders up to 200 pictures; API 60 requests per minute per token for writes, 600 for reads (Cloud). Plan amounts (renders, AI help, storage) are published with the plans. [Engine, Cloud] - [Design decisions](https://design.docs.sypnia.com/reference/decisions.md): Sypnia Design decisions: 1 Design comes before screens; 2 customer apps never start from @sypnia/ui; 3 three layers: shared unstyled @sypnia/base (React on React Aria) + generated components in the customer's repo + private gallery; 4 the repository is the source of truth, Cloud writes by pull request; 5 W3C Design Tokens for values, Markdown for reasons; 6 roles not colours, dark designed not inverted, WCAG 2.2 AA; 7 icons drawn per project with shared construction rules + brand signature, never stock; 8 only licensed fonts, self-hosted; 9 screens per case with every ending and failure, approved before built; 10 design check blocks merges; waivers expire; 11 only people approve; 12 React first, tokens.css anywhere; 13 licences MIT for tools/base/skills, AGPL-3.0 for the engine; 14 no colour matching to printing ink catalogues. [Engine, Cloud] - [Common questions](https://design.docs.sypnia.com/reference/faq.md): Design FAQ: no designer needed (Design proposes, you choose); works with an existing brand (upload logo, colours, fonts, brand book); not a template catalogue; does not use @sypnia/ui; you own the components; works without Sypnia Cloud; Figma not required (files and pictures; export the guide as PDF; tokens in the W3C format other tools read); React first, tokens anywhere; existing app: design init + check with waivers to move step by step; my agent can use it (skills, MCP). [Engine, Cloud] - [Changelog](https://design.docs.sypnia.com/reference/changelog.md): What changed in Sypnia Design, newest first. [Engine, Cloud]