// Content-moderation backend for the {{projectName}} project. // // `moderationPlugin` runs on the rpc interceptors BEFORE the handler: it checks // the named input fields against a provider and, per rule, either BLOCKS the // call (typed `ContentRejected` — the write never commits) or FLAGS it for // review (the write commits, the item lands in the review queue). `keywordProvider` // is a zero-dep deny-list; `aiProvider()` is an optional LLM classifier. // Config-only, zero infra. import { defineEnv, envVar } from '@voltro/env' import { moderationPlugin, keywordProvider } from '@voltro/plugin-moderation' 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: [ moderationPlugin({ provider: keywordProvider(['spam', 'scam', 'phishing', 'malware']), rules: [ // BLOCK: a post whose title/body trips the deny-list is rejected // (ContentRejected) before it's ever written. { match: 'posts.create', fields: ['title', 'body'], action: 'block' }, // FLAG: a comment is still written, but flagged for review. { match: 'comments.create', fields: ['body'], action: 'flag' }, ], }), ], env, }