Quick start
Quick start
Build a small task list: one model, one team and one app. You need Bun and Git.
Start from the blank template
The blank template is an empty workspace with Bolt and its tools already pinned.
git clone https://github.com/norbital-ai/templates.git
cd templates/blank
bun install --frozen-lockfile
bunx bolt check bolt check compiles the workspace and checks its types. It also writes generated types to .norbital/. Never edit that folder.
Add a model
A model is one kind of record. Create src/data/model/tasks/+model.ts, then run bunx bolt check once so the generated import it uses exists.
// src/data/model/tasks/+model.ts
import { model } from '@norbital-ai/bolt';
export default model('tasks', {
description: 'Work someone has to do.',
icon: 'lucide:list-checks',
record_label: 'record.title',
fields: {
title: { kind: 'text' },
status: {
kind: 'enum',
values: ['open', 'done'],
default: 'open',
transitions: { open: ['done'], done: ['open'] }
},
due_on: { kind: 'date', optional: true }
},
outputs: { default: { fields: 'all' } },
create: { fields: ['title', 'due_on'] },
update: { fields: ['title', 'status', 'due_on'] }
}); fields are the stored columns. outputs.default is what readers see. create and update list the columns people may write. transitions says which status may follow which.
Let a team use it
Members can only use what a policy grants them. A policy grants access to models and apps; a team holds policies; members join a team. The policy is source; the team is a row, seeded from seed/public/sys_team.json and edited under Settings → Organization → Teams.
// src/access_control/policy/+tasks.policy.ts
import { policy } from '@norbital-ai/bolt';
export default policy({
description: 'Read, add and update tasks.',
capabilities: { apps: ['tasks'] },
grants: {
tasks: { outputs: { default: {} }, create: {}, update: {} }
}
});
// seed/public/sys_team.json: the team a new workspace starts with
[{ "id": "staff", "name": "Staff", "policies": ["tasks"] }] Add an app
An app is a folder under src/app/. +app.ts lists its pages, and each page is a +<page>.page.svelte file. Titles are message keys, so the text can be translated.
// src/app/tasks/+app.ts
import { app } from '@norbital-ai/bolt';
export default app({
title: 'app.tasks.title',
description: 'app.tasks.description',
icon: 'lucide:list-checks',
pages: { list: { title: 'app.tasks.title' } }
});
// src/i18n/+messages.ts: add these keys
'app.tasks.title': 'Tasks',
'app.tasks.description': 'Everything the team has to do.',
'models.tasks.label': 'Tasks',
'models.tasks.singular': 'Task', <!-- src/app/tasks/+list.page.svelte -->
<script lang="ts">
import type { PageContext } from '@norbital-ai/bolt/page';
import { Table } from '@norbital-ai/ui';
import { AppShell } from '@norbital-ai/ui/layout';
let { ctx }: { ctx: PageContext } = $props();
</script>
<AppShell
icon="lucide:list-checks"
title={ctx.t('app.tasks.title')}
description={ctx.t('app.tasks.description')}
>
<Table
{ctx}
of="tasks"
columns={['title', 'status', 'due_on']}
order_by={{ due_on: 'asc' }}
toolbar={{ title: ctx.t('app.tasks.title'), new: true }}
/>
</AppShell> Table reads the model through the viewer's policies and stays live. Its toolbar adds a New button, filters, search, import and export. Opening a row shows the record with its history.
What happens when it runs
- Open the Tasks app. The table reads
tasksthrough your policies and lists them. - Click New, type a title and save. The row is created and appears in every open copy of the table.
- Change a task's status to
done. Changing it to anything thetransitionslist does not allow is refused.
Check, test and build
bunx bolt check # compile and type-check
bunx bolt test # run tests/ against a temporary database
bunx bolt build # write the release to .norbital/ and the next migration to migrations/ bolt build writes a SQL migration that creates the tasks table. Commit it under migrations/ with your source. bolt build regenerates the catalogue counts in norbital.template.json from source roles.
Run it
On Norbital, create a workspace from a template and change it in Workspace Studio. To run it on your own machine, copy the example host file from @norbital-ai/bolt-server to norbital.host.ts and run bunx bolt dev.