// Collaborative-editing backend for the {{projectName}} project. Read by `voltro dev`. // // This is the LOCAL-FIRST / CRDT template — it exposes a `documents` table // whose `body` is a `crdtText()` column. When two clients edit the same body // concurrently, the runtime folds each incoming update into the stored state // with an authoritative SERVER-SIDE CRDT merge (on the write path, before the // row is written) so their edits CONVERGE — no last-write-wins loser — and the // reactive engine broadcasts the merged result to every subscriber. // // `store: 'memory'` keeps it ZERO-INFRA: the merge + the broadcast are both // in-process, so two browser tabs pointed at one `voltro dev` collaborate with // no database, no Redis, no external service. Switch to `'postgres'` (or run // `voltro add redis` for a cross-instance broadcast) when you go distributed. import { defineEnv, envVar } from '@voltro/env' // Typed environment — declared once, validated at boot (fail-fast) and read on // the server via `serverEnv` / `getSecret` from '@voltro/env/server'. Run // `voltro env` for the manifest. export const env = defineEnv({ LOG_LEVEL: envVar.enum(['debug', 'info', 'warn', 'error'], { access: 'public', default: 'info' }), }) export default { type: 'api' as const, name: '{{capProjectName}}{{capAppName}}', store: 'memory' as const, env, }