---
title: Templates
slug: templates
summary: Start an App from a dashboard, list, detail or finance template, or add a blank Function or Query, then run it locally and publish it.
---

# Templates

`limilake add` writes the starting files for an App, a Function or a Query
into your Workspace checkout. Apps come in five templates, from a blank page
to a finance dashboard with eight Queries. Functions and Queries have one
blank starting point each.

`add` only writes files on your machine. Nothing reaches LimiLake until you
commit and push to `main`.

## Before you start

You need the CLI, a signed-in profile and a clone of your Workspace. See
[Setup and access](./getting-started.md).

```bash
limilake workspace clone finance
cd finance
```

A Workspace created on LimiLake already has its root files. Run
`limilake workspace init` only in a checkout that has no `limilake.toml`, for
example a new, empty Git repository. It writes five files and nothing else:

```text
limilake.toml
package.json
pnpm-lock.yaml
pyproject.toml
uv.lock
```

Every `add` command and `workspace init` takes `--dry-run`. It prints the
files the command would create or update and writes nothing:

```bash
limilake add app sales --template dashboard --dry-run
```

## Add an App from a template

1. Pick a slug (lowercase letters, digits and inner hyphens) and a template:

   ```bash
   limilake add app sales --template dashboard
   ```

   Without `--template` you get `blank`. The App goes to `apps/sales/`. The
   first App in a Workspace also updates the root `package.json` and
   `pnpm-lock.yaml`. A template with Queries writes them to `queries/`, and
   the command writes the App's typed client to
   `apps/sales/src/generated/limilake.ts`.

2. Read the `Next:` lines the command prints. The first one is the exact
   `pnpm` command that installs the App's dependencies. Run it before you
   start the App.

> **Note:** Running the same command again changes nothing. If a file it
> would write already exists with other content, the command stops before it
> writes anything.

### App templates

| Template | What you get | Queries it adds | Data it needs |
| --- | --- | --- | --- |
| `blank` (default) | One page with a heading. You build the rest. | None | None |
| `dashboard` | A sidebar layout, three key figure cards, a filter bar, a table with 10 rows per page and a detail sheet that opens on a row. | `<slug>-records` | None at first. See below. |
| `list` | A sidebar layout, a filter bar, a full-width table with 20 rows per page and a detail sheet. | `<slug>-records` | None at first. See below. |
| `detail` | A sidebar layout, a filter bar, a table with 12 rows per page and a detail panel beside it. On narrow screens the detail opens as a sheet. | `<slug>-records` | None at first. See below. |
| `financial-dashboard` | Five pages behind a month picker: Overview, Profit and loss, Revenue (by customer and by business area), Cash and Time, drawn as charts and tables. | `<slug>-status`, `-periods`, `-kpis`, `-monthly-results`, `-profit-and-loss`, `-revenue-split`, `-cash-balance`, `-time-report` | Eight tables in a Lakehouse named `finance_app`. See below. |

Every template except `blank` is built with React, TypeScript, Tailwind and
shadcn/ui, works on phones (the sidebar becomes a menu below 768 pixels wide)
and calls its Queries through the generated client.

### Data for the `dashboard`, `list` and `detail` templates

These three show data at once. Their Query, `queries/<slug>-records.sql`,
generates 100 placeholder rows and reads no table of yours. It still runs in
a Lakehouse, so the Workspace needs at least one.

To show your own data:

1. Replace the SQL in `queries/<slug>-records.sql`. Keep its `filter`,
   `offset` and `limit` parameters and its `total_count` column. Rename the
   other columns as your data needs.
2. Refresh the Query's reviewed schema and the App's typed client:

   ```bash
   limilake query capture sales-records --lakehouse sales
   ```

3. Update `src/lib/records.ts` and the components that show the columns.
4. If the Workspace has more than one Lakehouse, set `APP_LAKEHOUSE` in
   `src/lib/limilake.ts` to the one the App reads.

### Data for the `financial-dashboard` template

This template reads finished figures and does no sums of its own. Before it
shows anything, the Workspace needs:

- A Lakehouse named `finance_app`.
- Eight tables in its `app` schema: `status`, `periods`, `kpis`,
  `monthly_results`, `profit_and_loss`, `revenue_split`, `cash_balance` and
  `time_report`, with the exact column names and types that
  `apps/<slug>/CONTRACT.md` lists.

`CONTRACT.md` explains every column, and how to compute it from Fortnox
accounting data with the BAS chart of accounts. You usually fill the
tables with a scheduled [Function](./functions.md) that rebuilds all of them
in one run. Some data is not in the books:

- Forecasts. Leave `forecast` empty and the chart shows actual figures only.
- Time reporting. Leave `time_report` empty and the Time page says there is
  no data.
- Business areas. A company without them has no `area` rows in
  `revenue_split`.

An empty table is valid. Each card shows "Loading…" until its Query answers,
then its figures or an empty state that names the table it reads.

Check one Query against your data:

```bash
limilake query test finance-kpis --lakehouse finance_app --param year_month=2026-10
```

## Make the App yours

Branding lives in three places only:

- `src/brand.ts`: the company name, a short name, logo paths, the primary
  and accent colours, the locale for number and date formats, and the
  currency.
- `public/`: the logo files. The template ships a placeholder `logo.svg`.
- `src/styles.css`: theme tokens derived from the brand colours.

Each template App also has an `AGENTS.md`, and a `CLAUDE.md` that imports it.
It tells a coding agent how to adapt the App: take the branding from the
company's website, connect the data, keep the components and the layout,
check the App at desktop and phone width, and publish. Point your agent at
the App's folder and ask it to follow that file.

To add more shadcn/ui components to the App:

```bash
npx shadcn@latest add dialog --cwd apps/sales
```

## Add a Function

```bash
limilake add function recalculate-invoice
```

This writes one file, `functions/recalculate-invoice/function.py`. It
declares the Function with a generated `id`, `access="private"` and
`run_as="caller"`, and has one `@fn.action` handler that takes a
`dict[str, str]` and returns one. Replace the handler with your code.

To run Functions on your machine, add the version-matched `limilake[serve]`
runtime to `pyproject.toml` and run `uv lock`. The command prints this step. See [Functions](./functions.md) for routes, syncs and
schedules.

## Add a Query

```bash
limilake add query active-customers
```

This writes two files:

- `queries/active-customers.sql`: placeholder SQL, `SELECT 1 AS example_value`.
- `queries/active-customers.schema.json`: the reviewed schema of its
  parameters and columns. Apps call the Query through a typed client built
  from this file.

After you write the SQL, refresh the schema from your data. Add `--app` to
let an App call the Query:

```bash
limilake query capture active-customers --lakehouse sales --app sales
```

## Pick from a menu

Run `limilake add` with no arguments in a terminal. It asks what to add (App,
Function or Query), then for a name, then for confirmation. The menu always
adds a blank App; use `limilake add app <slug> --template <name>` for a
template. Outside a terminal, or with `--no-input`, the bare command exits
with code 2 and names the kinds it accepts.

## Run it locally

From the Workspace root:

```bash
limilake dev
```

This starts every App and HTTP Function in the Workspace on your machine and
prints the address of each App. Queries and Functions run against your live
data. If the Workspace has several Lakehouses, pass the one the App reads:

```bash
limilake dev --lakehouse sales
```

## Publish

Commit the new files, including the updated root `package.json`,
`pnpm-lock.yaml` and generated clients, then push to `main`:

```bash
git status --short
git add -- apps/sales queries package.json pnpm-lock.yaml
git commit -m "Add sales dashboard"
git push origin HEAD:main
```

The push publishes the Workspace. Follow the build with
`limilake publication show`, then open the address that
`limilake app show sales` prints. See
[Publish a Workspace](./getting-started.md#publish-a-workspace).

## Next steps

- [Apps](./apps.md): who can open an App, public Apps and their limits.
- [Functions](./functions.md): actions, HTTP routes and syncs.
- [Schedules](./schedules.md): fill the finance tables on a schedule.
- [Custom domains](./custom-domains.md): serve the App on your own hostname.
