Skip to main content
vibld

Template

Tarnwick

A web editor for a documentation site built from Markdown/MDX files. Writers pick a file from the repository tree, edit source with line numbers and see the rendered page update beside it, then publish the change back to the connected repository.

Docs-site MDX editor with live preview · App screen: text editor · Small tools and apps · full-stack app (auth + DB)

A mock-up of the screen, drawn from its layout, palette and typefaces. A build follows the full prompt below.

Start from this screenRead the build prompt

Typefaces

The catalog's own faces. A screen composed into a template is drawn in that template's typefaces.

  • InterHeadings: Inter 700, 28px preview H1; 20px section heading
  • InterBody: Inter 400, 16px/1.6 preview body; UI 14px

Patterns

  • four-pane editor (nav / file tree / source / preview)
  • line-numbered source editor
  • live rendered preview
  • file tree with type badges
  • theme toggle + repo link icons
  • publish button disabled until changes
  • sidebar collapse control

States it is designed for

  • No changes (Publish disabled with tooltip)
  • Unsaved changes
  • Draft saved
  • Publishing (spinner) / published (toast with link)
  • Merge conflict from remote changes: show diff and choose
  • MDX compile error: inline error in preview with line number link
  • Large file performance warning
  • Read-only member (Publish hidden)

Who it is for

  • Developer-relations teams maintaining product docs
  • Engineers editing reference pages
  • Technical writers without a local setup

Layout

  1. App nav (150px): logo mark, Home, Editor (active), Analytics, Settings; user email at bottom
  2. Top bar: collapse control; right: theme toggle, language/globe, repository link icon, green 'Publish' (disabled until changes)
  3. File tree (145px): folders (_snippets, api-reference, essentials, images, logo) and files with small type labels (MD, MDX, JSON), active file tinted
  4. Source pane: line numbers gutter, monospace text with wrapped lines, markdown syntax visible
  5. Preview pane: page heading, rendered H1, paragraph with inline code, dash lists, H3, code blocks rendered as dark cards with copy
  6. Below 1280px preview toggles as a tab; below 768px only one pane at a time with a segmented switch

Palette

technical, tidy, trustworthy. What you type is what readers will see.

  • page#ffffff
  • nav/tree background#fcfcfc
  • primary text#15171a
  • muted text#5c5f66
  • line numbers#5c5f66
  • border#8d9096
  • publish green#177245
  • code block#16181c
  • code text#e6e8eb
  • link underline/accent#177245
  • focus ring#2563eb

Every checked pair, measured again

SampleWhereRatioNeeds
Aabody text17.96:14.5:1
Aamuted tree text6.23:14.5:1
Aaline numbers6.40:14.5:1
Aapublish label on green5.95:14.5:1
Aacode text on dark block14.48:14.5:1
Aaaccent link on page5.95:14.5:1
pane border3.20:13:1
focus ring5.17:13:1

As vibld’s tokens

The palette on the fifteen colour tokens vibld styles a project with, each text colour on the fill it is read on. Marked tokens are solved from the palette, because no swatch held that role at 4.5:1.

  • background
  • card
  • muted
  • primary
  • secondary
  • accent
  • destructive *

Type scale

Display
Inter 700, 28px preview H1; 20px section heading
Body
Inter 400, 16px/1.6 preview body; UI 14px

JetBrains Mono 14px/1.6 for the source pane and code blocks; similar to observed grotesk + mono.

Spacing and imagery

Four fixed panes separated by 1px borders; source pane padding 16px with 40px gutter; preview padding 32px max 640px; code cards radius 10px; buttons 32px radius 8px.

Icons only; code blocks as dark cards; no photos.

Components

  • App nav
  • Top bar with theme toggle, locale and repo icons
  • Publish button + confirm dialog (commit message)
  • File tree with type labels
  • New file / new folder actions
  • Source editor with line numbers
  • Live preview renderer
  • Code block with copy
  • Unsaved-changes dot on file
  • Diff view before publish

Interactions

  • Typing updates preview after 150ms debounce; scroll sync between source and preview
  • Selecting a file loads it; unsaved files show a dot and confirm on switch
  • Publish opens a dialog with changed files list, diff and commit message
  • Keyboard: ⌘S saves draft, ⌘P quick-open file
  • Copy on code blocks shows 'Copied'

Data

  • Project{id, name, repo_owner, repo_name, branch}
  • DocFile{project_id, path, type (md|mdx|json), sha, draft_content, updated_by, updated_at}
  • PublishEvent{id, project_id, commit_sha, message, files[], actor_id, at}

Guardrails

Experience

  • Disable Publish when there is nothing to publish and say why
  • Show compile errors in the preview with a link to the source line
  • Always show a diff and commit message step before publishing
  • Keep drafts per user so unfinished edits don't block teammates
  • Keep scroll positions in sync so writers don't lose their place

Accessibility

  • Source editor is a labelled textarea/code editor with accessible line announcements
  • Panes are regions with headings; a skip link jumps to the editor
  • Disabled Publish explains itself via tooltip and aria-describedby
  • Code-block copy buttons labelled per block
  • Colour contrast holds in both light and dark themes

Security

  • Repository access via an app installation token stored server-side; never expose tokens to the client
  • RLS: projects and drafts scoped to members; publish restricted to editor role
  • Render MDX preview in a sandboxed iframe; disallow arbitrary script components
  • Audit publish events with commit SHA and actor

Build prompt

The baseline every prompt in the catalog assumes, then this design’s own ten sections, from goal to guardrails.

The baseline
### How to use these prompts
Paste an entry's build prompt into your coding agent as the first message. Each prompt names its own stack, tokens and acceptance criteria; the rules below apply to all of them and can be prepended once per project.

### Engineering baseline
- TypeScript strict mode, no `any`, small typed components, feature folders, and one source of truth for design tokens (CSS variables consumed by Tailwind).
- Validate every input with a shared zod schema on the client and again on the server or edge function. Never trust client-side checks alone.
- Show loading, empty and error states for every async view. Surface errors in plain language with a retry, and log details to the console in development only.
- Keep secrets out of the bundle. Only publishable keys (for example a Supabase anon key) belong in client code; service-role keys, API keys and webhooks live in server or edge-function environment variables.

### Data and auth baseline (full-stack entries)
- Enable Row Level Security on every table before inserting data. Default-deny, then add owner-scoped policies (`auth.uid() = user_id`) and explicit role checks for admin views.
- Store roles in a separate table checked by a security-definer function, never in a user-editable profile field.
- Upload files to private storage buckets with size and MIME limits, and serve them through signed URLs.
- Rate-limit public endpoints (forms, auth, AI calls) and add a honeypot field or captcha to anonymous forms.
- Take payments through a hosted checkout and verify webhooks by signature. Never handle raw card data.

### Accessibility and UX baseline
- Target WCAG 2.2 AA: 4.5:1 contrast for normal text and 3:1 for large text, input borders, focus rings and meaningful icons or chart lines. Every palette in this catalog lists its verified pairs; re-check with a contrast tool after any colour change.
- Keep body text at 16px or larger with 1.5 line height, nothing below 12px, no light weights under 24px, and uppercase only for short labels.
- Give every interactive element a visible focus ring, full keyboard support, semantic landmarks, labelled form fields, and alt text on meaningful images.
- Respect `prefers-reduced-motion` for every animation. Give drag-and-drop and carousels keyboard and button alternatives.
- Build mobile-first and test at 375px, 768px and 1280px.

### Content guardrails
- Use original copy, fictional sample data and placeholder or licensed imagery. Do not reuse another product's name, logo, screenshots or marketing text.
- Label demo testimonials and metrics as samples. Collect the minimum personal data the feature needs.

### SaaS screen baseline
- Design every screen for its full set of states: first-run empty, loading skeleton, partial data, error with retry, permission-denied, and success feedback. Each entry lists the states its screen needs.
- Keep destructive actions (delete, revoke, downgrade, remove member) behind a confirmation that names the object, and prefer undo over a second dialog where the action is reversible.
- Enforce authorisation on the server for every action a screen exposes. Hiding a button is not access control; check the role again in the API or RLS policy.
- Never show secrets (API keys, tokens) in full after creation. Show them once, then mask them, and offer rotate and revoke.
- Keep the app shell (navigation, workspace switcher, account menu) consistent across screens, and preserve filters, sort and scroll position when the user navigates back.
### Goal
Build **Tarnwick**'s docs editor: a browser-based editor for a documentation site stored as Markdown/MDX in a repository. Writers pick a file, edit source with line numbers, watch a live preview, and publish a commit when ready.

### Stack
React 18 + TypeScript + Vite, Tailwind CSS, shadcn/ui (Radix primitives) and lucide-react icons. TanStack Query for server state, react-hook-form + zod for forms, date-fns for dates. Supabase for Auth, Postgres and Row Level Security. A server route (Edge Function) talks to the connected code host with an installation token and compiles MDX for preview.

### Pages & layout
1. **App nav** (150px): logo mark; Home, Editor (active), Analytics, Settings; user email + menu at bottom.
2. **Top bar**: collapse sidebar; right: theme toggle, locale, repository icon link, 'Publish' (disabled until changes).
3. **File tree** (145px): folders `_snippets`, `api-reference`, `essentials`, `images`, `logo`; files `README.md`, `development.mdx`, `introduction.mdx`, `docs.json`, `quickstart.mdx` with type labels; new file/folder icons.
4. **Source pane**: line numbers, JetBrains Mono, wrapped lines, markdown visible (headings, lists, links, fenced code).
5. **Preview pane**: page heading 'Editor' then the rendered document: H1 'Starter kit', paragraph with inline code, dash list, H3 'Development', dark code card with copy.
6. **Publish dialog**: changed files, unified diff, commit message, Publish.
7. Responsive per layout.

### Design system
- Colors: `--bg: #ffffff` (page), `--panel: #fcfcfc` (nav/tree background), `--fg: #15171a` (primary text), `--muted: #5c5f66` (muted text), `--gutter: #5c5f66` (line numbers), `--border: #8d9096` (border), `--primary: #177245` (publish green), `--code-bg: #16181c` (code block), `--code-fg: #e6e8eb` (code text), `--accent: #177245` (link underline/accent), `--ring: #2563eb` (focus ring).
- Fonts: Inter 400/600/700 (preview H1 28px 700; body 16px/1.6; UI 14px); JetBrains Mono 14px/1.6 in source and code.
- Spacing: 4px base; source padding 16px; preview padding 32px.
- Radius: 8px buttons, 10px code cards, 6px type labels.
- Shadows: none; 1px pane borders; dialogs `0 16px 40px rgb(0 0 0 / 0.15)`.
- Motion: preview crossfade 100ms on update; toast 200ms.

### Components & interactions
`AppNav`, `EditorTopBar`, `ThemeToggle`, `PublishButton` (disabled reason), `PublishDialog` (file list, `DiffView`, commit message), `FileTree` (type labels, unsaved dots, new file/folder, rename), `SourceEditor` (textarea with gutter or a lightweight code editor), `PreviewFrame` (sandboxed iframe), `CompileError`, `CodeBlock` (copy), `QuickOpen` (⌘P).

### Data & state
`projects(id, workspace_id, name, repo_owner, repo_name, branch)`, `doc_drafts(project_id, path, user_id, content, base_sha, updated_at)`, `publish_events(id, project_id, commit_sha, message, files text[], actor_id, at)`, `project_members(project_id, user_id, role)`. Source of truth is the repository; drafts are per user until published. Conflicts detected by comparing `base_sha` with remote.

### Accessibility
Skip link to the editor; panes are labelled regions. Line numbers aria-hidden; editor exposes current line via status text. Disabled Publish has a description. Code copy buttons 'Copy code block 2'. Test both themes for contrast.
Verified contrast: body text: #15171a on #ffffff = 17.96:1; muted tree text: #5c5f66 on #fcfcfc = 6.23:1; line numbers: #5c5f66 on #ffffff = 6.40:1; publish label on green: #ffffff on #177245 = 5.95:1; code text on dark block: #e6e8eb on #16181c = 14.48:1; accent link on page: #177245 on #ffffff = 5.95:1; pane border: #8d9096 on #ffffff = 3.20:1; focus ring: #2563eb on #ffffff = 5.17:1.

### Security
Installation token and code-host secrets only in server env; the client never sees them. RLS: `doc_drafts` owner-only; `projects` select for members; publish via server function checking editor role. Preview runs in a sandboxed iframe (`sandbox` without `allow-same-origin`) under a strict CSP; MDX components whitelisted. Audit `publish_events`.

### Performance & SEO
Compile MDX in a worker; debounce 150ms; cache compiled output per sha. Lazy-load the diff view. App routes `noindex`.

### Guardrails
- Invent project and file contents.
- Refer to the code host generically.
- Never commit without an explicit confirm.

Acceptance criteria:
- [ ] Preview updates while typing
- [ ] Compile errors link to the source line
- [ ] Publish shows diff and commits with a message
- [ ] Readers cannot publish (role check)
- [ ] Contrast pairs pass

Open the builderAll templatesThis palette on its own