Skip to main content
vibld

Template

Zenthmark

A settings sub-page for an AI agent and workflow platform showing how many credits remain on the plan and how tokens, agent runs, sandbox time and document pages were consumed. Operators use it to understand cost drivers per model and decide when to upgrade.

Credit and model-usage analytics settings screen · App screen: usage · 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 600, 20px section titles, 18px card titles
  • InterBody: Inter 400 16px / 1.5; stat captions 14px

Patterns

  • persistent left sidebar with grouped nav
  • nested settings sub-nav in a tinted rail
  • date-range dropdown top right
  • credit meter card with plan badge
  • stat cards row
  • chart section with empty message
  • theme toggle in sidebar footer

States it is designed for

  • Loading: skeletons for meter, stat strip and chart
  • No usage in period: centred muted message in the model table and an empty chart frame with axis
  • Credits under 10%: meter bar and number switch to the warning colour with a text label 'Low'
  • Credits exhausted: banner above cards and disabled run triggers elsewhere
  • Error per card with Retry, others still render
  • Custom range invalid (end before start): inline validation in the popover
  • Many models: table paginates at 10 with 'show all'

Who it is for

  • AI engineers running agents in production
  • ops leads managing a credit budget
  • workspace admins

Layout

  1. Left app sidebar (240px): wordmark, primary items (Trigger, Runs, Reviews, Monitoring), groups 'Agent', 'Workflow', 'Developer' with small uppercase labels, Settings as a dark filled pill when active; footer: documentation link, avatar, three-way theme toggle, collapse button
  2. Top bar: organisation switcher with avatar and breadcrumb 'Settings'
  3. Settings sub-nav: tinted rounded rail listing Organisation, Members, Model, Usage (active white pill), Email servers, Data retention, Billing, Monitoring
  4. Content column (max 500px): date-range dropdown right-aligned; credit card (title, plan badge, Upgrade button, big mono number, remaining vs total, progress bar); five-up stat card; 'Usage by model' section; 'Tokens over time' chart card
  5. Below 1100px the settings rail becomes a horizontal scrollable tab strip; below 768px the stat row wraps to 2 columns

Palette

Calm, engineered, budget-aware. Monochrome with a single green brand accent; numbers are the heroes.

  • canvas#f7f7f7
  • surface#ffffff
  • text#161616
  • muted#666666
  • border#e5e5e5
  • input-border#8e8e8e
  • primary#1c1c1c
  • on-primary#ffffff
  • accent-green#1a8a3c
  • warning#b35a00
  • focus#1a8a3c

Every checked pair, measured again

SampleWhereRatioNeeds
Aabody text18.10:14.5:1
Aamuted caption5.74:14.5:1
Aasidebar muted on canvas5.36:14.5:1
Aaactive nav label17.04:14.5:1
Aalow-credit warning text4.80:14.5:1
chart bar accent4.43:13:1
input border3.28:13:1
focus ring on canvas4.13: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 600, 20px section titles, 18px card titles
Body
Inter 400 16px / 1.5; stat captions 14px

Big figures in JetBrains Mono 500 at 28-32px; similar to the observed monospace numerals. Sidebar group labels 12px uppercase 0.06em.

Spacing and imagery

Medium density; 4px base; sidebar 240px, settings rail 170px, content 500px; cards radius 12px with 1px border; stat card is one card divided into five columns; progress bar 6px tall fully rounded; shadow 0 1px 2px rgba(0,0,0,.04).

No photos. Line icons in nav; the chart is a stacked bar per day (fresh input, cached input, output) in three tints of green and grey.

Components

  • AppSidebar with group labels
  • OrgSwitcher breadcrumb
  • SettingsRail
  • DateRangeSelect (7/30/90 days, custom)
  • CreditMeterCard with PlanBadge and Upgrade button
  • StatStrip (tokens, cached input, runs, sandbox time, pages)
  • UsageByModelTable
  • TokensOverTimeChart (stacked bars)
  • EmptyMessage
  • ThemeToggle (system/light/dark)

Interactions

  • Changing the date range refetches every card and shows skeletons in place, not a full-page spinner
  • Hovering a stat reveals a tooltip explaining what counts (e.g. cached tokens are not billed as fresh input)
  • Chart bars show a tooltip with the three series and total; legend items toggle series
  • Upgrade opens the plans dialog; theme toggle switches instantly and persists
  • Settings rail items are links; active item gets a white pill with subtle shadow

Data

  • Organization{id, name, plan (free|team|enterprise), credits_total, credits_used}
  • UsageDaily{org_id, day, model, fresh_input_tokens, cached_input_tokens, output_tokens, agent_runs, sandbox_seconds, ocr_pages, credits}
  • Membership{org_id, user_id, role (owner|admin|member)}

Guardrails

Experience

  • Show remaining credits as both a number and a bar with 'used / total'
  • Explain every metric in a one-line caption under its value
  • Keep the date range global to the page and visible at the top
  • Order the model table by total tokens so the biggest driver is first
  • Never mix billed and unbilled tokens in one figure without labelling

Accessibility

  • Progress bar uses role='progressbar' with aria-valuenow/max and a text equivalent
  • Chart has a 'View as table' toggle with the same data
  • Stacked series differ by pattern or position as well as tint; legend is text
  • Theme toggle is a radiogroup with labelled options
  • Minimum 12px for captions; big numbers have aria-label with units
  • Focus ring 2px #1a8a3c with offset, visible on both canvas and white cards

Security

  • RLS: usage_daily rows readable only by members of the org; only owners/admins can open the plan change flow
  • Usage is written by server jobs with the service role; clients cannot insert or edit
  • Do not store prompt contents in usage tables, only counts
  • Validate date-range params server-side and cap at 365 days

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 **Zenthmark**, the Settings > Usage page of an AI agent and workflow platform. It shows remaining plan credits, a five-metric summary (LLM tokens, cached input, agent runs, sandbox time, document pages), usage by model and tokens over time for a chosen date range.

### Stack
React 18 + TypeScript + Vite, Tailwind CSS, shadcn/ui (Radix), lucide-react, Recharts for the stacked bar chart, TanStack Query, date-fns for ranges, zod for params. Supabase Auth + Postgres with a materialised daily usage table.

### Pages & layout
1. **Shell**: left sidebar with wordmark, primary items, grouped sections (Agent, Workflow, Developer), Settings item; footer with docs link, avatar, theme toggle, collapse. Top bar with org switcher and breadcrumb.
2. **Settings layout**: tinted rail of settings links on the left of the content, Usage active.
3. **Usage content** (500px column): date-range select right-aligned; credit card (title + plan badge + Upgrade; big mono remaining number; 'used / total' right; 6px progress bar); stat strip with five columns (value, caption, sub-caption); 'Usage by model' section title, description and table or empty message; 'Tokens over time' card with stacked daily bars.
4. **Plans dialog** opened by Upgrade (three plan cards, current plan marked).
5. Responsive: rail turns into a scrollable tab strip below 1100px; stat strip wraps to two columns below 768px.

### Design system
- Colors: `--canvas: #f7f7f7`, `--surface: #ffffff`, `--text: #161616`, `--muted: #666666`, `--border: #e5e5e5`, `--input-border: #8e8e8e`, `--primary: #1c1c1c`, `--on-primary: #ffffff`, `--accent-green: #1a8a3c`, `--warning: #b35a00`, `--focus: #1a8a3c`.
- Fonts: Inter 400/500/600 (16px/1.5 body, 18-20px titles); JetBrains Mono 500 28-32px for big figures, tabular numerals.
- Spacing: 4px scale; card padding 20px; 20px between cards.
- Radius: 12px cards, 8px buttons and rail items, 999px progress bar and badges.
- Shadows: 0 1px 2px rgba(0,0,0,.04) on cards; rail active pill 0 1px 3px rgba(0,0,0,.08).
- Motion: 150ms fades; progress bar animates width over 300ms on load (off with reduced motion).
- Dark theme mirrors tokens (surface #161616, text #f2f2f2) and must re-verify contrast.

### Components & interactions
AppSidebar, OrgSwitcher, SettingsRail, DateRangeSelect (presets + custom popover with validation), CreditMeterCard (progressbar with text), PlanBadge, UpgradeButton + PlansDialog, StatStrip with metric tooltips, UsageByModelTable (sortable by tokens), TokensChart (stacked bars, legend toggles, tooltip, 'View as table'), EmptyMessage, per-card ErrorState with Retry, ThemeToggle.

### Data & state
Tables `organizations(id, name, plan, credits_total)`, `memberships(org_id, user_id, role)`, `usage_daily(org_id, day, model, fresh_input_tokens, cached_input_tokens, output_tokens, agent_runs, sandbox_seconds, ocr_pages, credits)`. One RPC returns aggregates for a range; TanStack Query keys include the range. Range lives in the URL. Seed two orgs: one untouched free org (all zeros, empty states) and one with 30 days across three invented model names.

### Accessibility
Progress bar exposes values and a text equivalent; chart has an accessible table alternative; theme toggle options are labelled; stat values include units in their accessible names; low-credit state is shown with the word 'Low', not colour only.
Verified contrast: body text: #161616 on #ffffff = 18.1:1; muted caption: #666666 on #ffffff = 5.74:1; sidebar muted on canvas: #666666 on #f7f7f7 = 5.36:1; active nav label: #ffffff on #1c1c1c = 17.04:1; low-credit warning text: #b35a00 on #ffffff = 4.8:1; chart bar accent: #1a8a3c on #ffffff = 4.43:1; input border: #8e8e8e on #ffffff = 3.28:1; focus ring on canvas: #1a8a3c on #f7f7f7 = 4.13:1.

### Security
RLS on `usage_daily` and `organizations`: select where the org is in the caller's memberships; no client writes. Plan changes go through an Edge Function that checks role = owner/admin and hands off to a hosted checkout provider. Store counts only, never prompt text. Validate ranges server-side (max 365 days).

### Performance & SEO
Aggregate in SQL, not in the browser. Lazy-load Recharts. Cache aggregates for 60s. Console routes noindex.

### Guardrails
- Invented model names and numbers only.
- Never estimate credits client-side; show server figures.
- Acceptance criteria: (1) range change updates every card; (2) zero-usage org shows clean empty states; (3) low-credit state appears below 10%; (4) chart data available as a table; (5) members without admin role cannot open plan change.

Open the builderAll templatesThis palette on its own