# {{projectName}} / {{appName}}

Voltro backend scaffold (template: **api-backend-sqlite**) — an embedded,
single-process **SQLite** store. No database server to run; one native
dependency (`better-sqlite3`, via `@voltro/sql-sqlite`).

## Boot

```bash
pnpm install                # at the repo root
pnpm --filter @{{projectName}}/{{appName}} dev
# → http://localhost:4000
# → ws://localhost:4000/ws
```

The database file is created on first boot at the `DB_URL` path
(`.env.example` defaults to `file:./.data/{{projectNameSnake}}.sqlite`, which is
gitignored). Use `DB_URL=:memory:` for an ephemeral, in-process database.

## What's in here

| File | Role |
|---|---|
| `app.config.ts`                         | App declaration (`store: 'sqlite'`); `voltro dev` reads this first. |
| `.env.example`                          | `DB_DIALECT` + `DB_URL` — copy to `.env`. |
| `database/schema.ts`                    | One example table (`notes`) with the `tenant()` mixin. |
| `queries/notes.query.ts`                | Streaming subscription example. |
| `mutations/notes.create.mutation.ts`    | Tenant-guarded mutation example. |

Drop more `*.query.ts`, `*.mutation.ts`, `*.action.ts`, or `*.workflow.tsx`
files anywhere in this tree — discovery is by file convention.

## When to reach for something else

SQLite is single-writer and single-process, so real-time subscriptions do not
fan out across replicas (there is no CDC bus — within the one process they work
as normal). Scale to `store: 'postgres'` / `'mysql'` / `'mariadb'` when you run
more than one replica.
