// Search backend for the {{projectName}} project — full-text search over a // table, kept in sync automatically. // // `searchPlugin` taps the post-commit ChangeEvent stream: every insert/update // to a source table upserts its doc into the index, every delete removes it — // no app code. The synthesized `search.query` rpc returns hits, auto-filtered // to the caller's tenant. `store: 'memory'` keeps this zero-infra for dev. import { defineEnv, envVar } from '@voltro/env' import { searchPlugin } from '@voltro/plugin-search' import { searchBackend, articlesIndex } from './lib/search' 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, plugins: [ // `backend: searchBackend` is the SAME instance lib/search.ts shares with // the boot startup's backfill. Swap it for a vendor engine in lib/search.ts // ({ engine: 'typesense' | 'meilisearch' | 'algolia', url, apiKey }) for // prod — the indexing + query code stays identical. searchPlugin({ backend: searchBackend, indexes: { articles: articlesIndex }, }), ], env, }