// Backend app for the {{projectName}} project, backed by SQLite. Read by // `voltro dev` (local) and `voltro serve` (production). // // `store: 'sqlite'` is the simplest DURABLE store: an embedded, single-file // (or `:memory:`) database with no server to run and one native dependency // (`better-sqlite3`, pulled by `@voltro/sql-sqlite`). Great for a single // process — a CLI tool, an edge box, a small self-hosted app, or a durable // local dev store that survives restarts (unlike `store: 'memory'`). // // The database file + dialect come from env — see `.env.example`: // DB_DIALECT=sqlite // DB_URL=file:./.data/{{projectNameSnake}}.sqlite (or ':memory:') // // SQLite is single-writer and single-process by design, so it does NOT // fan real-time subscriptions across replicas (there is no CDC bus). Within // the one process, reactive queries work exactly as elsewhere. Reach for // postgres/mysql/mariadb when you scale to more than one replica. import { defineEnv, envVar } from '@voltro/env' // Typed environment — declare your env once; it's validated at boot (fail-fast) // and read on the server via `serverEnv` / `getSecret` from '@voltro/env/server'. // `access` is required: 'public' (browser-safe) or 'secret' (server-only, never // bundled). Run `voltro env` to see the manifest. See the Environment docs. export const env = defineEnv({ LOG_LEVEL: envVar.enum(['debug', 'info', 'warn', 'error'], { access: 'public', default: 'info' }), // Add your own, e.g.: // STRIPE_KEY: envVar.string({ access: 'secret' }), }) export default { type: 'api' as const, name: '{{capProjectName}}{{capAppName}}', store: 'sqlite' as const, env, }