// Web app for the {{projectName}} project. Read by `voltro dev` / `voltro start`. // // This is the COLLABORATIVE-EDITING frontend — a textarea bound to a // `crdtText()` document body over the framework's reactive loop. Open it in two // browser tabs and type in both: the edits CONVERGE (no last-write-wins loser) // because the api's server-authoritative CRDT merge folds every update into the // stored state, then the reactive engine broadcasts the merged row back. Zero // infra — the merge + broadcast are in-process on a single `voltro dev`. // // `port` is allocated by `voltro create-project` / `voltro add-app` from the // project's portRange (in project.json), hard-pinned per app. import { defineEnv, envVar } from '@voltro/env' // Typed PUBLIC environment — public vars are validated + baked into the browser // bundle at build time and read via `publicEnv` from '@voltro/env/public'. // NEVER put a secret here (it ships to every visitor). export const env = defineEnv({ VOLTRO_PUBLIC_APP_NAME: envVar.string({ access: 'public', default: '{{capProjectName}}' }), }) export default { type: 'web' as const, name: '{{capProjectName}}{{capAppName}}', port: {{port}}, env, // Bilingual by default — the framework auto-wires a cookie-driven // from these codes and loads the matching // `src/locales/.ts` catalog, so `` / `useT()` work app-wide. locales: ['en', 'de'] as const, defaultLocale: 'en' as const, // The api this frontend consumes. The NAME ('app') is the lookup key the // hooks use — `useSubscription('app', 'documents.list')`, `useMutation('app', // 'documents.setBody')`. The `package` resolves the sibling api in this // project (scaffold it with `--api=api-collab`). apis: { app: { package: '@{{projectName}}/api' }, }, }