// Web app for the {{projectName}} project — SERVER-RENDERED, fed by a sibling api.
//
// The index page is `renderMode: 'ssr'`: its loader runs on the SERVER on
// every request and calls `ctx.query('notes.list', {})` over the api's
// POST /rpc surface, so real rows are baked into the FIRST paint + the
// document
— no client round-trip, crawlable, correct for SEO. The
// component then upgrades the SAME data to live with `useSubscription`.
//
// This pairs with an api that exposes `notes.list` — scaffold one with
// `--api=api-backend`. The `apis.app.package` resolves that sibling api in
// the project; its port is auto-discovered from its own app.config.ts, and
// codegen pulls its typed rpc surface so `query` + `useSubscription` are
// end-to-end typed.
import { defineEnv, envVar } from '@voltro/env'
// Public, build-time env (baked into the bundle; read via `publicEnv`).
// Never a secret here — declare secrets on the api.
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}},
theme: 'system' as const,
env,
// Bilingual by default. The framework auto-wires a cookie-driven
// from these codes and loads the matching
// `src/locales/.ts` catalog — so `` / `useT()` /
// `useLocale()` work app-wide (SSR too) with no manual setup. The
// in the layout writes the `voltro:locale` cookie + reloads.
// Grow the app to more languages by adding a code here + a
// `src/locales/.ts`.
locales: ['en', 'de'] as const,
defaultLocale: 'en' as const,
// The api this frontend consumes. The NAME ('app') is the lookup key the
// loader's `query` + the hooks use: `query('notes.list', {})`,
// `useSubscription('app', 'notes.list')`.
apis: {
app: { package: '@{{projectName}}/api' },
},
}