Workspace
Workspace
A workspace is a folder of source files. Bolt finds each declaration by its file name and folder, so this tree is the whole map:
src/
├── +workspace.ts time zone, language, app order
├── +secrets.ts encrypted settings for server code
├── data/
│ ├── model/<name>/+model.ts one model per folder; folders may nest
│ ├── model/<name>/+representation.svelte optional record view
│ └── custom_field/<name>/+custom_field.ts a value type of your own
├── access_control/
│ └── policy/+<name>.policy.ts one policy per file
├── automation/+<name>.automation.ts scheduled and on-demand jobs
├── integration/<name>/+integration.ts connections to outside systems
├── app/<app>/+app.ts, +<page>.page.svelte apps and their pages
├── agent/+agent.md the agent's brief
├── i18n/+messages.ts every text, by key
└── lib/ ordinary helpers
seed/ rows for tests and new workspaces
migrations/ generated SQL, committed with the source
tests/ Vitest suites run by bolt test Names come from paths
The path names a declaration. src/data/model/orders/+model.ts is the model orders, and src/automation/+orders_duplicate.automation.ts is the automation orders_duplicate. Model folders may nest to keep related models together; the innermost folder is still the name, so src/data/model/sites/job_assignments/+model.ts is job_assignments. Each file exports one call, such as export default automation({ … }); a model and an integration repeat their name as the first argument, export default model('orders', { … }), and bolt check refuses a name that differs from the path.
Workspace settings
// src/+workspace.ts (construction)
import { workspace } from '@norbital-ai/bolt';
export default workspace({
tz: 'Asia/Singapore',
locale: 'en-SG',
currency: 'SGD',
apps: ['operations', 'configuration'],
ai: {},
convert: { to: ['pdf'] }
}); tz and locale are required. apps sets the order of the app launcher. Other keys turn on features: signup lets outsiders join with a proven email or phone number, ai asks the host for AI, and convert names document formats such as PDF.
Theme
A workspace sets its own colours, fonts and corner radius with theme in +workspace.ts. Pick high-level presets — palette ('warm', 'neutral', 'crisp'), accent (preset name or #rrggbb hex with automatic light/dark contrast), and radius ('sharp', 'default', 'soft') — and optionally layer per-mode light and dark token overrides on top. The build compiles them into static CSS for the whole workspace: the shell, every page, dialogs and menus. Each person still chooses light, dark or system in their own settings.
// src/+workspace.ts
import { workspace } from '@norbital-ai/bolt';
export default workspace({
tz: 'Asia/Singapore',
locale: 'en-SG',
theme: {
palette: 'crisp',
accent: '#1467a6',
radius: 'default',
light: {
'font-sans': 'Inter, system-ui, sans-serif'
}
}
}); - Surfaces & content. Semantic roles (
surface-canvas,surface-card,surface-popover,surface-muted,surface-subtle,surface-active,content-primary,content-secondary) plusbackground,card,popover,muted,secondaryandaccentwith-foreground. - Actions and states.
primary,destructive,success,infoandwarning, each with a-foreground. - Lines and focus.
border,inputandring. - Brand.
brand,brand-foreground,brand-text,brand-mutedand the scalebrand-50tobrand-950. - Sidebar and charts.
sidebarwith its-foreground,-primary,-accent,-borderand-ringtokens, andchart-1tochart-5. - Type and shape.
font-sans,font-monoandradius.
Each value must be one CSS colour, font stack, or length (e.g. #1467a6, oklch(0.55 0.15 250), 0.5rem) using tweakcn token names without --. The build rejects unknown tokens, values over 512 characters, and anything containing ;, braces, url(…), or comments. Use system fonts, pair each foreground with its background, and verify contrast in both modes.
A theme is source like any other. Edit it in Workspace Studio, or ask Norbius in words ("use our navy as the primary colour"), look at the preview in light and dark, then merge. Pages need no CSS of their own: the shared views and the kit read the tokens.
Text and translations
Every word a person reads comes from a message catalogue. src/i18n/+messages.ts is the base. Other languages, such as +zh.messages.ts, use the same keys. Captions for models and fields follow a naming pattern, so most need no code at all.
// src/i18n/+messages.ts
import { messages } from '@norbital-ai/bolt';
export default messages({
'models.job_assignments.label': 'Jobs',
'models.job_assignments.singular': 'Job',
'models.job_assignments.fields.scheduled_for': 'Date',
'errors.job_not_yours': 'This job is assigned to someone else.',
'errors.short': 'Only {have} of {need} left.'
}); Pages show text with ctx.t(key, values). Server code refuses with a key, as in ctx.refuse('errors.short', { values: { have, need } }), so each person reads the message in their own language.
Secrets
src/+secrets.ts declares settings such as API tokens: secrets({ SERVICE_TOKEN: { label } }). An administrator enters each value in the app. It is stored encrypted, and only server code reads it. Credentials for an outside system belong to its integration connection instead.
Generated files
bolt check and bolt dev write .norbital/: the typed names of every model, page and automation. Do not edit or commit it. A new name appears after the next check.