create-efc-app 0.4.4 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +26 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/scaffold.ts"],"sourcesContent":["import * as p from '@clack/prompts';\nimport pc from 'picocolors';\nimport { spawn } from 'node:child_process';\nimport { scaffold, type ScaffoldOptions, type AdminFeatures, type UserFeatures, NO_ADMIN_FEATURES, NO_USER_FEATURES } from './scaffold.js';\n\nfunction cancel(msg = 'Cancelled'): never {\n p.cancel(msg);\n process.exit(0);\n}\n\nasync function main(): Promise<void> {\n console.log();\n p.intro(pc.bgCyan(pc.black(' create-efc-app ')));\n\n const projectName = await p.text({\n message: 'Project name:',\n placeholder: 'my-api',\n defaultValue: 'my-api',\n validate: (v) => (!v.trim() ? 'Project name is required' : undefined),\n });\n if (p.isCancel(projectName)) cancel();\n\n const language = await p.select({\n message: 'Language:',\n options: [\n { value: 'typescript', label: 'TypeScript', hint: 'recommended' },\n { value: 'javascript', label: 'JavaScript' },\n ],\n });\n if (p.isCancel(language)) cancel();\n\n const database = await p.select({\n message: 'Database:',\n options: [\n { value: 'mongodb', label: 'MongoDB', hint: 'Mongoose' },\n { value: 'postgresql', label: 'PostgreSQL', hint: 'Drizzle ORM' },\n ],\n });\n if (p.isCancel(database)) cancel();\n\n const authStrategy = await p.select({\n message: 'Authentication strategy:',\n options: [\n { value: 'http-only', label: 'http-only', hint: 'secure cookie — recommended for SSR' },\n { value: 'localStorage', label: 'localStorage', hint: 'bearer token — for SPAs' },\n ],\n });\n if (p.isCancel(authStrategy)) cancel();\n\n const features = await p.multiselect({\n message: 'Features: (space to toggle, enter to confirm)',\n options: [\n { value: 'cluster', label: 'Multi-core clustering', hint: 'Node cluster module' },\n { value: 'tasks', label: 'Background tasks', hint: 'BullMQ / pg-boss' },\n { value: 'routeDocs', label: 'API route documentation', hint: 'meta exports + dashboard' },\n { value: 'userPortal', label: 'User portal', hint: 'auth, profile, billing routes' },\n { value: 'adminPortal',label: 'Admin portal', hint: 'dashboard, user mgmt, analytics' },\n { value: 'rbac', label: 'Role-based access control', hint: \"requireAuth('role') middleware\" },\n { value: 'mailer', label: 'Mailer', hint: 'nodemailer + SMTP' },\n ],\n initialValues: ['cluster', 'tasks', 'routeDocs', 'userPortal', 'adminPortal', 'rbac'],\n required: false,\n });\n if (p.isCancel(features)) cancel();\n\n const selected = new Set(features as string[]);\n\n let userFeatures: UserFeatures = NO_USER_FEATURES;\n if (selected.has('userPortal')) {\n const chosen = await p.multiselect({\n message: 'User portal features: (space to toggle, enter to confirm)',\n options: [\n { value: 'profileViewing', label: 'Profile viewing & editing', hint: 'GET/PUT /user/profile' },\n { value: 'forgotPassword', label: 'Forgot / reset password', hint: 'forgot-password, reset-password' },\n { value: 'accountSecurity', label: 'Change password, 2FA & sessions', hint: 'change-password, 2fa/*, sessions/*, token refresh' },\n { value: 'emailVerification',label: 'Email verification', hint: 'verify-email route + registration flow' },\n { value: 'accountSettings', label: 'Account settings', hint: 'avatar, settings, account, dashboard, activity' },\n { value: 'notifications', label: 'Notifications', hint: 'user/notifications' },\n { value: 'filesAndMedia', label: 'Files, favorites & bookmarks', hint: 'files, favorites, bookmarks, search' },\n { value: 'apiAndBilling', label: 'API keys & billing', hint: 'api-keys, plans, subscription, invoices' },\n { value: 'support', label: 'Support tickets', hint: 'create & view own tickets' },\n ],\n initialValues: ['profileViewing', 'forgotPassword', 'accountSecurity', 'emailVerification', 'accountSettings', 'notifications', 'filesAndMedia', 'apiAndBilling', 'support'],\n required: false,\n });\n if (p.isCancel(chosen)) cancel();\n const uSet = new Set(chosen as string[]);\n userFeatures = {\n profileViewing: uSet.has('profileViewing'),\n forgotPassword: uSet.has('forgotPassword'),\n accountSecurity: uSet.has('accountSecurity'),\n emailVerification: uSet.has('emailVerification'),\n accountSettings: uSet.has('accountSettings'),\n notifications: uSet.has('notifications'),\n filesAndMedia: uSet.has('filesAndMedia'),\n apiAndBilling: uSet.has('apiAndBilling'),\n support: uSet.has('support'),\n };\n }\n\n let adminFeatures: AdminFeatures = NO_ADMIN_FEATURES;\n if (selected.has('adminPortal')) {\n const chosen = await p.multiselect({\n message: 'Admin panel features: (space to toggle, enter to confirm)',\n options: [\n { value: 'userManagement', label: 'User management', hint: 'list/create/suspend/verify/export users + dashboard stats' },\n { value: 'adminManagement', label: 'Admin & role management', hint: 'manage other admins' + (selected.has('rbac') ? ' + roles' : '') },\n { value: 'analytics', label: 'Analytics', hint: 'users, revenue, traffic dashboards' },\n { value: 'contentManagement', label: 'Content management', hint: 'FAQs, blog posts, categories' },\n { value: 'billingManagement', label: 'Billing management', hint: 'plans, coupons, subscriptions' },\n { value: 'supportManagement', label: 'Support tickets', hint: 'view & respond to tickets' },\n { value: 'notificationsAndLogs', label: 'Notifications & audit logs', hint: 'broadcast + audit/activity/security logs' },\n { value: 'systemSettings', label: 'System settings & health', hint: 'app settings, health check, cache' },\n ],\n initialValues: ['userManagement', 'adminManagement', 'analytics', 'contentManagement', 'billingManagement', 'supportManagement', 'notificationsAndLogs', 'systemSettings'],\n required: false,\n });\n if (p.isCancel(chosen)) cancel();\n const aSet = new Set(chosen as string[]);\n adminFeatures = {\n userManagement: aSet.has('userManagement'),\n adminManagement: aSet.has('adminManagement'),\n analytics: aSet.has('analytics'),\n contentManagement: aSet.has('contentManagement'),\n billingManagement: aSet.has('billingManagement'),\n supportManagement: aSet.has('supportManagement'),\n notificationsAndLogs: aSet.has('notificationsAndLogs'),\n systemSettings: aSet.has('systemSettings'),\n };\n }\n\n let taskBackend: ScaffoldOptions['taskBackend'];\n if (selected.has('tasks')) {\n const backend = await p.select({\n message: 'Task queue backend:',\n options: [\n { value: 'bullmq', label: 'BullMQ', hint: 'Redis' },\n { value: 'pg-boss', label: 'pg-boss', hint: 'PostgreSQL' },\n ],\n });\n if (p.isCancel(backend)) cancel();\n taskBackend = backend as ScaffoldOptions['taskBackend'];\n }\n\n let smtpProvider: ScaffoldOptions['smtpProvider'];\n let smtpHost: string | undefined;\n let smtpPort: string | undefined;\n let smtpUser: string | undefined;\n let smtpPass: string | undefined;\n if (selected.has('mailer')) {\n const provider = await p.select({\n message: 'Email provider:',\n options: [\n { value: 'gmail', label: 'Gmail', hint: 'smtp.gmail.com, preconfigured' },\n { value: 'custom', label: 'Other (custom SMTP)', hint: \"you'll provide host + port\" },\n ],\n });\n if (p.isCancel(provider)) cancel();\n smtpProvider = provider as ScaffoldOptions['smtpProvider'];\n\n if (smtpProvider === 'custom') {\n const host = await p.text({\n message: 'SMTP host:',\n placeholder: 'smtp.mailtrap.io',\n validate: (v) => (!v.trim() ? 'SMTP host is required' : undefined),\n });\n if (p.isCancel(host)) cancel();\n smtpHost = host as string;\n\n const port = await p.text({\n message: 'SMTP port:',\n placeholder: '587',\n defaultValue: '587',\n });\n if (p.isCancel(port)) cancel();\n smtpPort = port as string;\n }\n\n const user = await p.text({\n message: smtpProvider === 'gmail' ? 'Gmail address:' : 'SMTP username / email:',\n placeholder: 'you@example.com',\n validate: (v) => (!v.trim() ? 'Email is required' : undefined),\n });\n if (p.isCancel(user)) cancel();\n smtpUser = user as string;\n\n if (smtpProvider === 'gmail') {\n p.note(\n 'Google no longer accepts your regular account password for SMTP.\\n' +\n \"Generate a 16-character App Password: Google Account -> Security -> 2-Step Verification -> App passwords.\\n\" +\n \"Enter it below without spaces (not your Gmail login password).\",\n 'Gmail app password required',\n );\n }\n\n const pass = await p.password({\n message: smtpProvider === 'gmail' ? 'Gmail app password (16 characters):' : 'SMTP password:',\n validate: (v) => {\n if (!v.trim()) return 'Password is required';\n if (smtpProvider === 'gmail' && v.replace(/\\s/g, '').length !== 16) {\n return 'Gmail app passwords are 16 characters — this looks like a regular password, not an app password';\n }\n return undefined;\n },\n });\n if (p.isCancel(pass)) cancel();\n smtpPass = (pass as string).replace(/\\s/g, '');\n }\n\n const opts: ScaffoldOptions = {\n projectName: projectName as string,\n language: language as ScaffoldOptions['language'],\n database: database as ScaffoldOptions['database'],\n authStrategy: authStrategy as ScaffoldOptions['authStrategy'],\n cluster: selected.has('cluster'),\n tasks: selected.has('tasks'),\n routeDocs: selected.has('routeDocs'),\n userPortal: selected.has('userPortal'),\n adminPortal: selected.has('adminPortal'),\n userFeatures,\n adminFeatures,\n rbac: selected.has('rbac'),\n mailer: selected.has('mailer'),\n ...(taskBackend !== undefined && { taskBackend }),\n ...(smtpProvider !== undefined && { smtpProvider }),\n ...(smtpHost !== undefined && { smtpHost }),\n ...(smtpPort !== undefined && { smtpPort }),\n ...(smtpUser !== undefined && { smtpUser }),\n ...(smtpPass !== undefined && { smtpPass }),\n };\n\n const spinner = p.spinner();\n spinner.start('Scaffolding project…');\n\n try {\n await scaffold(opts);\n spinner.stop('Project created');\n } catch (err) {\n spinner.stop('Failed to scaffold project');\n console.error(err);\n process.exit(1);\n }\n\n spinner.start('Installing dependencies…');\n await npmInstall(projectName as string);\n spinner.stop('Dependencies installed');\n\n spinner.start('Installing efc CLI globally…');\n await npmInstallGlobal().catch(() => { /* non-fatal */ });\n spinner.stop('efc CLI ready');\n\n if (opts.mailer) {\n p.note(\n `SMTP_USER and SMTP_PASS were written to ${projectName as string}/.env — that file is gitignored, never commit it.\\n` +\n (opts.smtpProvider === 'gmail'\n ? 'If this Gmail app password ever leaks, revoke it and generate a new one.'\n : 'Rotate SMTP_PASS immediately if it is ever exposed.'),\n 'Mailer credentials',\n );\n }\n\n p.outro(\n pc.green(`\\nYour project is ready!\\n\\n`) +\n pc.dim(` cd ${projectName as string}\\n`) +\n pc.dim(` efc start dev\\n`) +\n pc.dim(`\\n (or: npm run dev)\\n`),\n );\n}\n\nfunction npmInstall(projectDir: string): Promise<void> {\n return new Promise((resolve, reject) => {\n const child = spawn('npm', ['install'], { cwd: projectDir, stdio: 'ignore' });\n child.on('exit', (code) => (code === 0 ? resolve() : reject(new Error('npm install failed'))));\n });\n}\n\nfunction npmInstallGlobal(): Promise<void> {\n return new Promise((resolve, reject) => {\n const child = spawn('npm', ['install', '-g', 'express-file-cluster'], { stdio: 'ignore' });\n child.on('exit', (code) => (code === 0 ? resolve() : reject(new Error('global install failed'))));\n });\n}\n\nmain().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n","import fs from 'fs-extra';\nimport path from 'node:path';\nimport crypto from 'node:crypto';\n\nexport interface AdminFeatures {\n userManagement: boolean;\n adminManagement: boolean;\n analytics: boolean;\n contentManagement: boolean;\n billingManagement: boolean;\n supportManagement: boolean;\n notificationsAndLogs: boolean;\n systemSettings: boolean;\n}\n\nexport interface UserFeatures {\n profileViewing: boolean;\n forgotPassword: boolean;\n accountSecurity: boolean;\n emailVerification: boolean;\n accountSettings: boolean;\n notifications: boolean;\n filesAndMedia: boolean;\n apiAndBilling: boolean;\n support: boolean;\n}\n\nexport const NO_ADMIN_FEATURES: AdminFeatures = {\n userManagement: false,\n adminManagement: false,\n analytics: false,\n contentManagement: false,\n billingManagement: false,\n supportManagement: false,\n notificationsAndLogs: false,\n systemSettings: false,\n};\n\nexport const NO_USER_FEATURES: UserFeatures = {\n profileViewing: false,\n forgotPassword: false,\n accountSecurity: false,\n emailVerification: false,\n accountSettings: false,\n notifications: false,\n filesAndMedia: false,\n apiAndBilling: false,\n support: false,\n};\n\nexport interface ScaffoldOptions {\n projectName: string;\n language: 'typescript' | 'javascript';\n database: 'mongodb' | 'postgresql';\n authStrategy: 'http-only' | 'localStorage';\n cluster: boolean;\n tasks: boolean;\n taskBackend?: 'bullmq' | 'pg-boss';\n routeDocs: boolean;\n userPortal: boolean;\n adminPortal: boolean;\n adminFeatures: AdminFeatures;\n userFeatures: UserFeatures;\n rbac: boolean;\n mailer: boolean;\n smtpProvider?: 'gmail' | 'custom';\n smtpHost?: string;\n smtpPort?: string;\n smtpUser?: string;\n smtpPass?: string;\n}\n\nexport async function scaffold(opts: ScaffoldOptions): Promise<void> {\n const dest = path.resolve(process.cwd(), opts.projectName);\n await fs.ensureDir(dest);\n\n const uf = opts.userFeatures;\n const af = opts.adminFeatures;\n // Admin \"user management\" operates on the User collection even when there's\n // no separate self-service user portal, so the model must exist for it too.\n const needsUserModel = opts.userPortal || (opts.adminPortal && af.userManagement);\n\n await writePackageJson(dest, opts);\n await writeTsConfig(dest, opts);\n await writeEfcConfig(dest, opts);\n await writeEntryPoint(dest, opts);\n await writeGitignore(dest);\n await writeEnvFiles(dest, opts);\n await writeExampleRoute(dest, opts);\n if (needsUserModel) await writeUserModel(dest, opts);\n if (opts.adminPortal) await writeAdminModel(dest, opts);\n await writeAuthRoutes(dest, opts);\n if (opts.adminPortal) await writeAdminRoutes(dest, opts);\n if (opts.userPortal && uf.profileViewing) await writeUserRoutes(dest, opts);\n if (opts.tasks) await writeExampleTask(dest, opts);\n // Extended models — only generated when a feature that uses them is selected\n if (opts.userPortal && uf.accountSecurity) await writeSessionModel(dest, opts);\n if ((opts.userPortal && uf.notifications) || (opts.adminPortal && af.notificationsAndLogs))\n await writeNotificationModel(dest, opts);\n if (opts.userPortal && uf.filesAndMedia) await writeFileModel(dest, opts);\n if ((opts.userPortal && uf.support) || (opts.adminPortal && af.supportManagement))\n await writeSupportTicketModel(dest, opts);\n if (opts.adminPortal && af.notificationsAndLogs) await writeAuditLogModel(dest, opts);\n if (opts.userPortal && uf.apiAndBilling) await writeSubscriptionModel(dest, opts);\n if (opts.adminPortal && af.billingManagement) await writePlanModel(dest, opts);\n if (opts.userPortal && uf.apiAndBilling) await writeInvoiceModel(dest, opts);\n if (opts.userPortal && uf.apiAndBilling) await writeApiKeyModel(dest, opts);\n if (opts.rbac && opts.adminPortal && af.adminManagement) await writeRoleModel(dest, opts);\n if (opts.adminPortal && af.contentManagement) await writeFAQModel(dest, opts);\n if (opts.adminPortal && af.contentManagement) await writeBlogModel(dest, opts);\n if (opts.adminPortal && af.contentManagement) await writeCategoryModel(dest, opts);\n if (opts.adminPortal && af.billingManagement) await writeCouponModel(dest, opts);\n // Extended routes — gated by the same per-feature flags as their models\n if (opts.userPortal) await writeAuthExtendedRoutes(dest, opts);\n if (opts.userPortal) await writeUserExtendedRoutes(dest, opts);\n if (opts.userPortal && uf.apiAndBilling) await writeUserBillingRoutes(dest, opts);\n if (opts.userPortal && uf.support) await writeSupportRoutes(dest, opts);\n if (opts.adminPortal) await writeAdminExtendedRoutes(dest, opts);\n}\n\nasync function writePackageJson(dest: string, opts: ScaffoldOptions): Promise<void> {\n const deps: Record<string, string> = {\n 'express-file-cluster': '^0.3.0',\n };\n if (opts.database === 'mongodb') deps['mongoose'] = '^8.0.0';\n if (opts.database === 'postgresql') {\n deps['pg'] = '^8.0.0';\n deps['drizzle-orm'] = '^0.33.0';\n }\n if (opts.tasks && opts.taskBackend === 'bullmq') deps['bullmq'] = '^5.0.0';\n if (opts.tasks && opts.taskBackend === 'pg-boss') deps['pg-boss'] = '^10.0.0';\n if (opts.mailer) deps['nodemailer'] = '^6.9.0';\n if (opts.database === 'mongodb') deps['bcrypt'] = '^5.1.0';\n\n const devDeps: Record<string, string> = {\n vitest: '^4.1.9',\n };\n if (opts.language === 'typescript') {\n devDeps['typescript'] = '^5.5.0';\n devDeps['@types/node'] = '^22.0.0';\n devDeps['@types/express'] = '^4.17.21';\n devDeps['tsup'] = '^8.2.0';\n devDeps['tsx'] = '^4.0.0';\n if (opts.mailer) devDeps['@types/nodemailer'] = '^6.4.0';\n if (opts.database === 'mongodb') devDeps['@types/bcrypt'] = '^5.0.0';\n }\n\n const pkg = {\n name: opts.projectName,\n version: '0.1.0',\n type: 'module',\n scripts: {\n dev: 'efc start dev',\n build: 'efc build prod',\n start: 'efc start prod',\n test: 'efc run tests',\n },\n dependencies: deps,\n devDependencies: devDeps,\n };\n\n await fs.writeJson(path.join(dest, 'package.json'), pkg, { spaces: 2 });\n}\n\nasync function writeTsConfig(dest: string, opts: ScaffoldOptions): Promise<void> {\n if (opts.language !== 'typescript') return;\n const config = {\n compilerOptions: {\n target: 'ES2022',\n module: 'NodeNext',\n moduleResolution: 'NodeNext',\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n outDir: './dist',\n rootDir: './src',\n },\n include: ['src/**/*'],\n exclude: ['node_modules', 'dist'],\n };\n await fs.writeJson(path.join(dest, 'tsconfig.json'), config, { spaces: 2 });\n}\n\nasync function writeEfcConfig(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const tasks = opts.tasks\n ? `{ backend: '${opts.taskBackend ?? 'bullmq'}', concurrency: 5 }`\n : 'false';\n\n const content = `import type { EFCConfig } from 'express-file-cluster';\n\n// Structural config only — runtime values (PORT, DATABASE_URL, JWT_SECRET, etc.) are read from .env\nconst config: EFCConfig = {\n authStrategy: '${opts.authStrategy}',\n tasks: ${tasks},\n globalMiddlewares: [],\n};\n\nexport default config;\n`;\n await fs.outputFile(path.join(dest, `efc.config.${ext}`), content);\n}\n\nasync function writeEntryPoint(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const taskLine = opts.tasks ? ` tasks: { backend: '${opts.taskBackend ?? 'bullmq'}' },\\n` : '';\n const content = `import { ignite, gracefulShutdown } from 'express-file-cluster';\n\n// PORT, DATABASE_URL, JWT_SECRET, CORS_ORIGINS are read from .env automatically\nignite({\n cluster: ${opts.cluster},\n${taskLine}}).then(gracefulShutdown).catch(console.error);\n`;\n await fs.outputFile(path.join(dest, 'src', `index.${ext}`), content);\n}\n\nasync function writeGitignore(dest: string): Promise<void> {\n await fs.outputFile(\n path.join(dest, '.gitignore'),\n 'node_modules/\\ndist/\\n.env\\n.env.local\\n*.log\\n',\n );\n}\n\nasync function writeEnvFiles(dest: string, opts: ScaffoldOptions): Promise<void> {\n const secret = crypto.randomBytes(64).toString('hex');\n const projectName = path.basename(dest);\n const dbUrl =\n opts.database === 'mongodb'\n ? `mongodb://localhost:27017/${projectName}`\n : `postgresql://localhost:5432/${projectName}`;\n const dbExampleUrl =\n opts.database === 'mongodb'\n ? `mongodb://localhost:27017/${projectName}`\n : `postgresql://user:password@localhost:5432/${projectName}`;\n\n const isGmail = opts.mailer && opts.smtpProvider !== 'custom';\n const resolvedHost = isGmail ? 'smtp.gmail.com' : (opts.smtpHost ?? 'smtp.gmail.com');\n const resolvedPort = isGmail ? '465' : (opts.smtpPort ?? '587');\n const passComment = isGmail\n ? ' # Gmail App Password (16 chars) — NOT your regular Gmail password. Generate at: Google Account > Security > 2-Step Verification > App passwords'\n : '';\n\n const smtpVars = opts.mailer\n ? `\\nAPP_URL=http://localhost:3000\\nSMTP_HOST=${resolvedHost}\\nSMTP_PORT=${resolvedPort}\\nSMTP_USER=${opts.smtpUser ?? ''}\\nSMTP_PASS=${opts.smtpPass ?? ''}${passComment}\\nSMTP_FROM=${opts.smtpUser ?? 'noreply@example.com'}\\n`\n : '';\n const smtpExample = opts.mailer\n ? `\\nAPP_URL=http://localhost:3000\\nSMTP_HOST=${resolvedHost}\\nSMTP_PORT=${resolvedPort}\\nSMTP_USER=your@email.com\\nSMTP_PASS=${isGmail ? 'your_16_char_app_password' : 'your_smtp_password'}${passComment}\\nSMTP_FROM=noreply@yourapp.com\\n`\n : '';\n const dotenv = `PORT=3000\\nNODE_ENV=development\\nDATABASE_URL=${dbUrl}\\nJWT_SECRET=${secret}\\nREDIS_URL=redis://localhost:6379\\nCORS_ORIGINS=http://localhost:3000${smtpVars}`;\n const example = `PORT=3000\\nNODE_ENV=development\\nDATABASE_URL=${dbExampleUrl}\\nJWT_SECRET=<generate with: openssl rand -hex 64>\\nREDIS_URL=redis://localhost:6379\\nCORS_ORIGINS=http://localhost:3000,https://yourapp.com${smtpExample}`;\n await fs.outputFile(path.join(dest, '.env'), dotenv);\n await fs.outputFile(path.join(dest, '.env.example'), example);\n}\n\nasync function writeExampleRoute(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const metaTs = opts.routeDocs\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n GET: {\\n description: 'Health check — returns server status and current timestamp.',\\n response: { status: 200, body: { status: 'OK', timestamp: '2024-01-01T00:00:00.000Z' } },\\n },\\n};\\n\\n`\n : '';\n const metaJs = opts.routeDocs\n ? `export const meta = {\\n GET: {\\n description: 'Health check — returns server status and current timestamp.',\\n response: { status: 200, body: { status: 'OK', timestamp: '2024-01-01T00:00:00.000Z' } },\\n },\\n};\\n\\n`\n : '';\n const content =\n opts.language === 'typescript'\n ? `import type { Request, Response } from 'express';\\n${metaTs}export const GET = async (_req: Request, res: Response) => {\\n res.json({ status: 'OK', timestamp: new Date().toISOString() });\\n};\\n`\n : `${metaJs}export const GET = async (_req, res) => {\\n res.json({ status: 'OK', timestamp: new Date().toISOString() });\\n};\\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', `health.${ext}`), content);\n}\n\nasync function writeExampleTask(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n\n const tsMailer = `import { defineTask } from 'express-file-cluster/tasks';\nimport nodemailer from 'nodemailer';\n\ninterface SendEmailPayload {\n to: string;\n subject: string;\n body: string;\n}\n\nconst transporter = nodemailer.createTransport({\n host: process.env.SMTP_HOST,\n port: Number(process.env.SMTP_PORT ?? 587),\n secure: Number(process.env.SMTP_PORT) === 465,\n auth: {\n user: process.env.SMTP_USER,\n pass: process.env.SMTP_PASS,\n },\n});\n\nexport default defineTask<SendEmailPayload>(async (payload) => {\n await transporter.sendMail({\n from: process.env.SMTP_FROM ?? process.env.SMTP_USER,\n to: payload.to,\n subject: payload.subject,\n html: payload.body,\n });\n});\n`;\n\n const jsMailer = `import { defineTask } from 'express-file-cluster/tasks';\nimport nodemailer from 'nodemailer';\n\nconst transporter = nodemailer.createTransport({\n host: process.env.SMTP_HOST,\n port: Number(process.env.SMTP_PORT ?? 587),\n secure: Number(process.env.SMTP_PORT) === 465,\n auth: {\n user: process.env.SMTP_USER,\n pass: process.env.SMTP_PASS,\n },\n});\n\nexport default defineTask(async (payload) => {\n await transporter.sendMail({\n from: process.env.SMTP_FROM ?? process.env.SMTP_USER,\n to: payload.to,\n subject: payload.subject,\n html: payload.body,\n });\n});\n`;\n\n const tsStub = `import { defineTask } from 'express-file-cluster/tasks';\n\ninterface SendEmailPayload {\n to: string;\n subject: string;\n body: string;\n}\n\nexport default defineTask<SendEmailPayload>(async (payload) => {\n // TODO: wire up your mailer\n console.log('[SendEmail] Sending to', payload.to);\n});\n`;\n\n const jsStub = `import { defineTask } from 'express-file-cluster/tasks';\n\nexport default defineTask(async (payload) => {\n // TODO: wire up your mailer\n console.log('[SendEmail] Sending to', payload.to);\n});\n`;\n\n const content = opts.mailer\n ? opts.language === 'typescript'\n ? tsMailer\n : jsMailer\n : opts.language === 'typescript'\n ? tsStub\n : jsStub;\n\n await fs.outputFile(path.join(dest, 'src', 'tasks', `SendEmail.${ext}`), content);\n}\n\nasync function writeUserModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface UserDocument {\n name: string;\n email: string;\n password: string;\n role: string;\n avatar?: string;\n isVerified: boolean;\n isActive: boolean;\n verifyToken?: string;\n resetToken?: string;\n resetTokenExpiry?: Date;\n refreshToken?: string;\n refreshTokenExpiry?: Date;\n}\n\nexport const User = defineModel<UserDocument>('User', {\n name: { type: 'string', required: true },\n email: { type: 'string', required: true, unique: true },\n password: { type: 'string', required: true },\n role: { type: 'string', required: true, default: 'user' },\n avatar: { type: 'string' },\n isVerified: { type: 'boolean', default: false },\n isActive: { type: 'boolean', default: true },\n verifyToken: { type: 'string' },\n resetToken: { type: 'string' },\n resetTokenExpiry: { type: 'date' },\n refreshToken: { type: 'string' },\n refreshTokenExpiry: { type: 'date' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const User = defineModel('User', {\n name: { type: 'string', required: true },\n email: { type: 'string', required: true, unique: true },\n password: { type: 'string', required: true },\n role: { type: 'string', required: true, default: 'user' },\n avatar: { type: 'string' },\n isVerified: { type: 'boolean', default: false },\n isActive: { type: 'boolean', default: true },\n verifyToken: { type: 'string' },\n resetToken: { type: 'string' },\n resetTokenExpiry: { type: 'date' },\n refreshToken: { type: 'string' },\n refreshTokenExpiry: { type: 'date' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for User\n// import { pgTable, serial, text, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const users = pgTable('users', {\n// id: serial('id').primaryKey(),\n// name: text('name').notNull(),\n// email: text('email').notNull().unique(),\n// password: text('password').notNull(),\n// role: text('role').notNull().default('user'),\n// avatar: text('avatar'),\n// isVerified: boolean('is_verified').notNull().default(false),\n// isActive: boolean('is_active').notNull().default(true),\n// createdAt: timestamp('created_at').defaultNow(),\n// updatedAt: timestamp('updated_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for User\nexport {};\n`;\n\n await fs.outputFile(path.join(dest, 'src', 'model', `User.${ext}`), content);\n}\n\nasync function writeAdminModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface AdminDocument {\n name: string;\n email: string;\n password: string;\n role: string;\n permissions: string[];\n isActive: boolean;\n resetToken?: string;\n resetTokenExpiry?: Date;\n refreshToken?: string;\n refreshTokenExpiry?: Date;\n}\n\nexport const Admin = defineModel<AdminDocument>('Admin', {\n name: { type: 'string', required: true },\n email: { type: 'string', required: true, unique: true },\n password: { type: 'string', required: true },\n role: { type: 'string', required: true, default: 'admin' },\n permissions: { type: 'array', default: [] },\n isActive: { type: 'boolean', default: true },\n resetToken: { type: 'string' },\n resetTokenExpiry: { type: 'date' },\n refreshToken: { type: 'string' },\n refreshTokenExpiry: { type: 'date' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Admin = defineModel('Admin', {\n name: { type: 'string', required: true },\n email: { type: 'string', required: true, unique: true },\n password: { type: 'string', required: true },\n role: { type: 'string', required: true, default: 'admin' },\n permissions: { type: 'array', default: [] },\n isActive: { type: 'boolean', default: true },\n resetToken: { type: 'string' },\n resetTokenExpiry: { type: 'date' },\n refreshToken: { type: 'string' },\n refreshTokenExpiry: { type: 'date' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Admin\n// import { pgTable, serial, text, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const admins = pgTable('admins', {\n// id: serial('id').primaryKey(),\n// name: text('name').notNull(),\n// email: text('email').notNull().unique(),\n// password: text('password').notNull(),\n// role: text('role').notNull().default('admin'),\n// permissions: text('permissions').array().notNull().default([]),\n// isActive: boolean('is_active').notNull().default(true),\n// createdAt: timestamp('created_at').defaultNow(),\n// updatedAt: timestamp('updated_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Admin\nexport {};\n`;\n\n await fs.outputFile(path.join(dest, 'src', 'model', `Admin.${ext}`), content);\n}\n\nasync function writeAuthRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n\n const loginMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n POST: {\\n description: 'Authenticate a user or admin and issue a JWT.',\\n request: { body: { email: 'user@example.com', password: 'user' } },\\n response: { status: 200, body: { message: 'Logged in as user' } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n POST: {\\n description: 'Authenticate a user or admin and issue a JWT.',\\n request: { body: { email: 'user@example.com', password: 'user' } },\\n response: { status: 200, body: { message: 'Logged in as user' } },\\n },\\n};\\n\\n`\n : '';\n\n // Only reference the models for the portals actually being generated —\n // referencing both unconditionally broke builds when only one portal was selected.\n const hasUser = opts.userPortal;\n const hasAdmin = opts.adminPortal;\n const mongo = opts.database === 'mongodb' && (hasUser || hasAdmin);\n\n const loginDbImports = mongo\n ? `import bcrypt from 'bcrypt';\\nimport crypto from 'node:crypto';\\n${hasUser ? `import { User } from '../../model/User.js';\\n` : ''}${hasAdmin ? `import { Admin } from '../../model/Admin.js';\\n` : ''}`\n : '';\n\n const loginBody =\n hasAdmin && hasUser\n ? ` const admin = await Admin.findOne({ email });\n if (admin) {\n const match = await bcrypt.compare(password, admin.password);\n if (!match) return res.status(401).json({ error: 'Invalid credentials' });\n if (!admin.isActive) return res.status(403).json({ error: 'Account suspended' });\n await issueToken(res, { id: admin.id, role: admin.role, email: admin.email });\n await issueRefreshToken(res, Admin, admin.id);\n return res.json({ message: 'Logged in as admin' });\n }\n\n const user = await User.findOne({ email });\n if (!user) return res.status(401).json({ error: 'Invalid credentials' });\n const match = await bcrypt.compare(password, user.password);\n if (!match) return res.status(401).json({ error: 'Invalid credentials' });\n if (!user.isActive) return res.status(403).json({ error: 'Account suspended' });\n await issueToken(res, { id: user.id, role: user.role, email: user.email });\n await issueRefreshToken(res, User, user.id);\n res.json({ message: 'Logged in' });`\n : hasAdmin\n ? ` const admin = await Admin.findOne({ email });\n if (!admin) return res.status(401).json({ error: 'Invalid credentials' });\n const match = await bcrypt.compare(password, admin.password);\n if (!match) return res.status(401).json({ error: 'Invalid credentials' });\n if (!admin.isActive) return res.status(403).json({ error: 'Account suspended' });\n await issueToken(res, { id: admin.id, role: admin.role, email: admin.email });\n await issueRefreshToken(res, Admin, admin.id);\n res.json({ message: 'Logged in as admin' });`\n : ` const user = await User.findOne({ email });\n if (!user) return res.status(401).json({ error: 'Invalid credentials' });\n const match = await bcrypt.compare(password, user.password);\n if (!match) return res.status(401).json({ error: 'Invalid credentials' });\n if (!user.isActive) return res.status(403).json({ error: 'Account suspended' });\n await issueToken(res, { id: user.id, role: user.role, email: user.email });\n await issueRefreshToken(res, User, user.id);\n res.json({ message: 'Logged in' });`;\n\n const loginContent = mongo\n ? ts\n ? `import { issueToken } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${loginDbImports}${loginMeta}const REFRESH_TOKEN_TTL_MS = 1000 * 60 * 60 * 24 * 30; // 30 days\n\nasync function issueRefreshToken(\n res: Response,\n model: { update: (id: string, data: Record<string, unknown>) => Promise<unknown> },\n id: string,\n): Promise<void> {\n const refreshToken = crypto.randomBytes(40).toString('hex');\n await model.update(id, { refreshToken, refreshTokenExpiry: new Date(Date.now() + REFRESH_TOKEN_TTL_MS) });\n res.cookie('efc_refresh_token', refreshToken, {\n httpOnly: true,\n secure: process.env.NODE_ENV === 'production',\n sameSite: 'strict',\n maxAge: REFRESH_TOKEN_TTL_MS,\n });\n}\n\nexport const POST = async (req: Request, res: Response) => {\n const { email, password } = req.body;\n if (!email || !password) return res.status(400).json({ error: 'email and password are required' });\n\n${loginBody}\n};\n`\n : `import { issueToken } from 'express-file-cluster/auth';\n${loginDbImports}${loginMeta}const REFRESH_TOKEN_TTL_MS = 1000 * 60 * 60 * 24 * 30; // 30 days\n\nasync function issueRefreshToken(res, model, id) {\n const refreshToken = crypto.randomBytes(40).toString('hex');\n await model.update(id, { refreshToken, refreshTokenExpiry: new Date(Date.now() + REFRESH_TOKEN_TTL_MS) });\n res.cookie('efc_refresh_token', refreshToken, {\n httpOnly: true,\n secure: process.env.NODE_ENV === 'production',\n sameSite: 'strict',\n maxAge: REFRESH_TOKEN_TTL_MS,\n });\n}\n\nexport const POST = async (req, res) => {\n const { email, password } = req.body;\n if (!email || !password) return res.status(400).json({ error: 'email and password are required' });\n\n${loginBody}\n};\n`\n : ts\n ? `import { issueToken } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${loginMeta}export const POST = async (req: Request, res: Response) => {\n const { email, password } = req.body;\n // TODO: look up user in DB and compare password\n res.status(401).json({ error: 'Invalid credentials' });\n};\n`\n : `import { issueToken } from 'express-file-cluster/auth';\n${loginMeta}export const POST = async (req, res) => {\n const { email, password } = req.body;\n // TODO: look up user in DB and compare password\n res.status(401).json({ error: 'Invalid credentials' });\n};\n`;\n\n const logoutMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n POST: {\\n description: 'Clear the auth cookie and log the user out.',\\n response: { status: 200, body: { message: 'Logged out successfully' } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n POST: {\\n description: 'Clear the auth cookie and log the user out.',\\n response: { status: 200, body: { message: 'Logged out successfully' } },\\n },\\n};\\n\\n`\n : '';\n\n const logoutContent = ts\n ? `import { revokeToken } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${logoutMeta}export const POST = async (_req: Request, res: Response) => {\n revokeToken(res);\n res.clearCookie('efc_refresh_token');\n res.json({ message: 'Logged out successfully' });\n};\n`\n : `import { revokeToken } from 'express-file-cluster/auth';\n${logoutMeta}export const POST = async (_req, res) => {\n revokeToken(res);\n res.clearCookie('efc_refresh_token');\n res.json({ message: 'Logged out successfully' });\n};\n`;\n\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `login.${ext}`), loginContent);\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `logout.${ext}`), logoutContent);\n\n if (!opts.userPortal) return;\n\n const registerMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n POST: {\\n description: 'Register a new user account.',\\n request: { body: { name: 'Jane Doe', email: 'jane@example.com', password: 'secret' } },\\n response: { status: 201, body: { message: 'Account created successfully' } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n POST: {\\n description: 'Register a new user account.',\\n request: { body: { name: 'Jane Doe', email: 'jane@example.com', password: 'secret' } },\\n response: { status: 201, body: { message: 'Account created successfully' } },\\n },\\n};\\n\\n`\n : '';\n\n const registerDbImports =\n opts.database === 'mongodb'\n ? `import bcrypt from 'bcrypt';\\nimport crypto from 'node:crypto';\\n${opts.mailer ? \"import { enqueue } from 'express-file-cluster/tasks';\\n\" : ''}import { User } from '../../model/User.js';\\n`\n : '';\n\n const sendVerifyEmail = opts.mailer\n ? `\n var appUrl = process.env.APP_URL || 'http://localhost:3000';\n await enqueue('SendEmail', {\n to: email,\n subject: 'Verify your email address',\n body: 'Welcome, ' + name + '! Verify your email: ' + appUrl + '/auth/verify-email?token=' + verifyToken,\n });\n`\n : `\n // TODO: email this token to the user — enable the Mailer feature to auto-wire SendEmail\n`;\n\n const registerContent =\n opts.database === 'mongodb'\n ? ts\n ? `import type { Request, Response } from 'express';\n${registerDbImports}${registerMeta}export const POST = async (req: Request, res: Response) => {\n const { name, email, password } = req.body;\n if (!name || !email || !password) {\n return res.status(400).json({ error: 'name, email and password are required' });\n }\n const existing = await User.findOne({ email });\n if (existing) return res.status(409).json({ error: 'Email already in use' });\n const hashed = await bcrypt.hash(password, 10);\n const verifyToken = crypto.randomBytes(32).toString('hex');\n const user = await User.create({ name, email, password: hashed, verifyToken });\n${sendVerifyEmail}\n const { password: _, verifyToken: __, ...safe } = user;\n res.status(201).json({ message: 'Account created successfully', user: safe });\n};\n`\n : `${registerDbImports}${registerMeta}export const POST = async (req, res) => {\n const { name, email, password } = req.body;\n if (!name || !email || !password) {\n return res.status(400).json({ error: 'name, email and password are required' });\n }\n const existing = await User.findOne({ email });\n if (existing) return res.status(409).json({ error: 'Email already in use' });\n const hashed = await bcrypt.hash(password, 10);\n const verifyToken = crypto.randomBytes(32).toString('hex');\n const user = await User.create({ name, email, password: hashed, verifyToken });\n${sendVerifyEmail}\n const { password: _, verifyToken: __, ...safe } = user;\n res.status(201).json({ message: 'Account created successfully', user: safe });\n};\n`\n : ts\n ? `import type { Request, Response } from 'express';\n${registerMeta}export const POST = async (req: Request, res: Response) => {\n const { name, email, password } = req.body;\n if (!name || !email || !password) {\n return res.status(400).json({ error: 'name, email and password are required' });\n }\n // TODO: hash password and persist to DB\n res.status(201).json({ message: 'Account created successfully' });\n};\n`\n : `${registerMeta}export const POST = async (req, res) => {\n const { name, email, password } = req.body;\n if (!name || !email || !password) {\n return res.status(400).json({ error: 'name, email and password are required' });\n }\n // TODO: hash password and persist to DB\n res.status(201).json({ message: 'Account created successfully' });\n};\n`;\n\n const meMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n GET: {\\n description: 'Return the currently authenticated user.',\\n response: { status: 200, body: { user: { id: '1', role: 'user', email: 'user@example.com' } } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n GET: {\\n description: 'Return the currently authenticated user.',\\n response: { status: 200, body: { user: { id: '1', role: 'user', email: 'user@example.com' } } },\\n },\\n};\\n\\n`\n : '';\n const meMiddlewares = opts.rbac\n ? `export const middlewares = [requireAuth('user', 'admin')];\\n\\n`\n : `export const middlewares = [requireAuth];\\n\\n`;\n\n const meContent = ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${meMeta}${meMiddlewares}export const GET = async (req: Request, res: Response) => {\n res.json({ user: (req as any).user });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${meMeta}${meMiddlewares}export const GET = async (req, res) => {\n res.json({ user: req.user });\n};\n`;\n\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `register.${ext}`), registerContent);\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `me.${ext}`), meContent);\n}\n\nasync function writeAdminRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const middlewares = opts.rbac\n ? `export const middlewares = [requireAuth('admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n const roleGuard = opts.rbac\n ? ''\n : ts\n ? ` const user = (req as any).user;\\n if (user?.role !== 'admin') {\\n return res.status(403).json({ error: 'Forbidden: Admin access required' });\\n }\\n\\n`\n : ` const user = req.user;\\n if (user?.role !== 'admin') {\\n return res.status(403).json({ error: 'Forbidden: Admin access required' });\\n }\\n\\n`;\n\n const dashboardMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n GET: {\\n description: 'Admin dashboard stats. Requires admin role.',\\n response: { status: 200, body: { stats: { totalUsers: 120, activeUsers: 98, verifiedUsers: 84 } } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n GET: {\\n description: 'Admin dashboard stats. Requires admin role.',\\n response: { status: 200, body: { stats: { totalUsers: 120, activeUsers: 98, verifiedUsers: 84 } } },\\n },\\n};\\n\\n`\n : '';\n\n // Real stats need the User model, which only exists when userManagement is on.\n const dashboardHasUserModel = opts.database === 'mongodb' && opts.adminFeatures.userManagement;\n\n const dashboardDbImport = dashboardHasUserModel\n ? `import { User } from '../../model/User.js';\\n`\n : '';\n\n const dashboardContent = dashboardHasUserModel\n ? ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${dashboardDbImport}${dashboardMeta}${middlewares}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} const [totalUsers, activeUsers, verifiedUsers] = await Promise.all([\n User.count({}),\n User.count({ isActive: true }),\n User.count({ isVerified: true }),\n ]);\n res.json({ stats: { totalUsers, activeUsers, verifiedUsers } });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${dashboardDbImport}${dashboardMeta}${middlewares}\nexport const GET = async (_req, res) => {\n${roleGuard} const [totalUsers, activeUsers, verifiedUsers] = await Promise.all([\n User.count({}),\n User.count({ isActive: true }),\n User.count({ isVerified: true }),\n ]);\n res.json({ stats: { totalUsers, activeUsers, verifiedUsers } });\n};\n`\n : ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${dashboardMeta}${middlewares}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: aggregate stats from DB\n res.json({ stats: { users: 0 } });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${dashboardMeta}${middlewares}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: aggregate stats from DB\n res.json({ stats: { users: 0 } });\n};\n`;\n\n await fs.outputFile(path.join(dest, 'src', 'api', 'admin', `dashboard.${ext}`), dashboardContent);\n\n if (!opts.adminFeatures.userManagement) return;\n\n // Admin user management routes\n const usersListMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n GET: {\\n description: 'List all users, paginated (admin only).',\\n request: { query: { page: '1', limit: '20' } },\\n response: { status: 200, body: { users: [], total: 0, page: 1, limit: 20 } },\\n },\\n POST: {\\n description: 'Create a new user account (admin only).',\\n request: { body: { name: 'Jane Doe', email: 'jane@example.com', password: 'secret', role: 'user' } },\\n response: { status: 201, body: { message: 'User created', user: { id: 'new-id', name: 'Jane Doe', email: 'jane@example.com', role: 'user' } } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n GET: {\\n description: 'List all users, paginated (admin only).',\\n request: { query: { page: '1', limit: '20' } },\\n response: { status: 200, body: { users: [], total: 0, page: 1, limit: 20 } },\\n },\\n POST: {\\n description: 'Create a new user account (admin only).',\\n request: { body: { name: 'Jane Doe', email: 'jane@example.com', password: 'secret', role: 'user' } },\\n response: { status: 201, body: { message: 'User created', user: { id: 'new-id', name: 'Jane Doe', email: 'jane@example.com', role: 'user' } } },\\n },\\n};\\n\\n`\n : '';\n\n const adminUsersDbImport =\n opts.database === 'mongodb'\n ? ts\n ? `import bcrypt from 'bcrypt';\\nimport { User } from '../../../model/User.js';\\n`\n : `import bcrypt from 'bcrypt';\\nimport { User } from '../../../model/User.js';\\n`\n : '';\n\n const usersListContent =\n opts.database === 'mongodb'\n ? ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${adminUsersDbImport}${usersListMeta}${middlewares}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const page = Math.max(1, Number(req.query.page) || 1);\n const limit = Math.min(100, Number(req.query.limit) || 20);\n const [all, total] = await Promise.all([User.find({}), User.count({})]);\n const users = all.slice((page - 1) * limit, page * limit).map(({ password: _, ...u }) => u);\n res.json({ users, total, page, limit });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { name, email, password, role } = req.body;\n if (!name || !email || !password) return res.status(400).json({ error: 'name, email and password are required' });\n const existing = await User.findOne({ email });\n if (existing) return res.status(409).json({ error: 'Email already in use' });\n const hashed = await bcrypt.hash(password, 10);\n const user = await User.create({ name, email, password: hashed, role: role ?? 'user' });\n const { password: _, ...safe } = user;\n res.status(201).json({ message: 'User created', user: safe });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${adminUsersDbImport}${usersListMeta}${middlewares}\nexport const GET = async (req, res) => {\n${roleGuard} const page = Math.max(1, Number(req.query.page) || 1);\n const limit = Math.min(100, Number(req.query.limit) || 20);\n const [all, total] = await Promise.all([User.find({}), User.count({})]);\n const users = all.slice((page - 1) * limit, page * limit).map(({ password: _, ...u }) => u);\n res.json({ users, total, page, limit });\n};\n\nexport const POST = async (req, res) => {\n${roleGuard} const { name, email, password, role } = req.body;\n if (!name || !email || !password) return res.status(400).json({ error: 'name, email and password are required' });\n const existing = await User.findOne({ email });\n if (existing) return res.status(409).json({ error: 'Email already in use' });\n const hashed = await bcrypt.hash(password, 10);\n const user = await User.create({ name, email, password: hashed, role: role ?? 'user' });\n const { password: _, ...safe } = user;\n res.status(201).json({ message: 'User created', user: safe });\n};\n`\n : ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${usersListMeta}${middlewares}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: fetch users from DB with pagination\n res.json({ users: [], total: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { name, email, role } = req.body;\n if (!name || !email) return res.status(400).json({ error: 'name and email are required' });\n // TODO: create user in DB\n res.status(201).json({ message: 'User created', user: { id: 'new-id', name, email, role: role ?? 'user' } });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${usersListMeta}${middlewares}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: fetch users from DB with pagination\n res.json({ users: [], total: 0 });\n};\n\nexport const POST = async (req, res) => {\n${roleGuard} const { name, email, role } = req.body;\n if (!name || !email) return res.status(400).json({ error: 'name and email are required' });\n // TODO: create user in DB\n res.status(201).json({ message: 'User created', user: { id: 'new-id', name, email, role: role ?? 'user' } });\n};\n`;\n\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'users', `index.${ext}`),\n usersListContent,\n );\n\n const userByIdMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n GET: {\\n description: 'Fetch a single user by ID (admin only).',\\n request: { params: { id: 'usr_01HXZ' } },\\n response: { status: 200, body: { user: { id: 'usr_01HXZ', name: 'Jane Doe', email: 'jane@example.com', role: 'user' } } },\\n },\\n PUT: {\\n description: 'Update a user by ID (admin only).',\\n request: { params: { id: 'usr_01HXZ' }, body: { name: 'Jane Doe', email: 'jane@example.com', role: 'user', isActive: true } },\\n response: { status: 200, body: { message: 'User updated', user: { id: 'usr_01HXZ', name: 'Jane Doe', email: 'jane@example.com', role: 'user' } } },\\n },\\n DELETE: {\\n description: 'Delete a user by ID (admin only).',\\n request: { params: { id: 'usr_01HXZ' } },\\n response: { status: 200, body: { message: 'User usr_01HXZ deleted' } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n GET: {\\n description: 'Fetch a single user by ID (admin only).',\\n request: { params: { id: 'usr_01HXZ' } },\\n response: { status: 200, body: { user: { id: 'usr_01HXZ', name: 'Jane Doe', email: 'jane@example.com', role: 'user' } } },\\n },\\n PUT: {\\n description: 'Update a user by ID (admin only).',\\n request: { params: { id: 'usr_01HXZ' }, body: { name: 'Jane Doe', email: 'jane@example.com', role: 'user', isActive: true } },\\n response: { status: 200, body: { message: 'User updated', user: { id: 'usr_01HXZ', name: 'Jane Doe', email: 'jane@example.com', role: 'user' } } },\\n },\\n DELETE: {\\n description: 'Delete a user by ID (admin only).',\\n request: { params: { id: 'usr_01HXZ' } },\\n response: { status: 200, body: { message: 'User usr_01HXZ deleted' } },\\n },\\n};\\n\\n`\n : '';\n\n const adminUserByIdDbImport =\n opts.database === 'mongodb' ? `import { User } from '../../../model/User.js';\\n` : '';\n\n const userByIdContent =\n opts.database === 'mongodb'\n ? ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${adminUserByIdDbImport}${userByIdMeta}${middlewares}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n const user = await User.findById(id);\n if (!user) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = user;\n res.json({ user: safe });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n const { name, email, role, isActive } = req.body;\n const updated = await User.update(id, { name, email, role, isActive });\n if (!updated) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = updated;\n res.json({ message: 'User updated', user: safe });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n const user = await User.findById(id);\n if (!user) return res.status(404).json({ error: 'User not found' });\n await User.delete(id);\n res.json({ message: \\`User \\${id} deleted\\` });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${adminUserByIdDbImport}${userByIdMeta}${middlewares}\nexport const GET = async (req, res) => {\n${roleGuard} const { id } = req.params;\n const user = await User.findById(id);\n if (!user) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = user;\n res.json({ user: safe });\n};\n\nexport const PUT = async (req, res) => {\n${roleGuard} const { id } = req.params;\n const { name, email, role, isActive } = req.body;\n const updated = await User.update(id, { name, email, role, isActive });\n if (!updated) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = updated;\n res.json({ message: 'User updated', user: safe });\n};\n\nexport const DELETE = async (req, res) => {\n${roleGuard} const { id } = req.params;\n const user = await User.findById(id);\n if (!user) return res.status(404).json({ error: 'User not found' });\n await User.delete(id);\n res.json({ message: \\`User \\${id} deleted\\` });\n};\n`\n : ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${userByIdMeta}${middlewares}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch user from DB\n res.json({ user: { id } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: update user in DB\n res.json({ message: 'User updated', user: { id, ...req.body } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: delete user from DB\n res.json({ message: \\`User \\${id} deleted\\` });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${userByIdMeta}${middlewares}\nexport const GET = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch user from DB\n res.json({ user: { id } });\n};\n\nexport const PUT = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: update user in DB\n res.json({ message: 'User updated', user: { id, ...req.body } });\n};\n\nexport const DELETE = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: delete user from DB\n res.json({ message: \\`User \\${id} deleted\\` });\n};\n`;\n\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'users', `[id].${ext}`),\n userByIdContent,\n );\n}\n\nasync function writeUserRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const middlewares = opts.rbac\n ? `export const middlewares = [requireAuth('user', 'admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n\n const profileMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n GET: {\\n description: \"Fetch the authenticated user's profile.\",\\n response: { status: 200, body: { user: { id: '1', role: 'user', email: 'user@example.com' } } },\\n },\\n PUT: {\\n description: \"Update the authenticated user's profile.\",\\n request: { body: { name: 'Jane Doe', email: 'jane@example.com' } },\\n response: { status: 200, body: { message: 'Profile updated', user: { id: '1', role: 'user', email: 'jane@example.com' } } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n GET: {\\n description: \"Fetch the authenticated user's profile.\",\\n response: { status: 200, body: { user: { id: '1', role: 'user', email: 'user@example.com' } } },\\n },\\n PUT: {\\n description: \"Update the authenticated user's profile.\",\\n request: { body: { name: 'Jane Doe', email: 'jane@example.com' } },\\n response: { status: 200, body: { message: 'Profile updated', user: { id: '1', role: 'user', email: 'jane@example.com' } } },\\n },\\n};\\n\\n`\n : '';\n\n const profileDbImport =\n opts.database === 'mongodb' ? `import { User } from '../../model/User.js';\\n` : '';\n\n const profileContent =\n opts.database === 'mongodb'\n ? ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${profileDbImport}${profileMeta}${middlewares}\nexport const GET = async (req: Request, res: Response) => {\n const { id } = (req as any).user;\n const user = await User.findById(id);\n if (!user) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = user;\n res.json({ user: safe });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n const { id } = (req as any).user;\n const { name, email } = req.body;\n const updated = await User.update(id, { name, email });\n if (!updated) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = updated;\n res.json({ message: 'Profile updated', user: safe });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${profileDbImport}${profileMeta}${middlewares}\nexport const GET = async (req, res) => {\n const { id } = req.user;\n const user = await User.findById(id);\n if (!user) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = user;\n res.json({ user: safe });\n};\n\nexport const PUT = async (req, res) => {\n const { id } = req.user;\n const { name, email } = req.body;\n const updated = await User.update(id, { name, email });\n if (!updated) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = updated;\n res.json({ message: 'Profile updated', user: safe });\n};\n`\n : ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${profileMeta}${middlewares}\nexport const GET = async (req: Request, res: Response) => {\n res.json({ user: (req as any).user });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n const { name, email } = req.body;\n // TODO: update user in DB\n res.json({ message: 'Profile updated', user: { ...(req as any).user, name, email } });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${profileMeta}${middlewares}\nexport const GET = async (req, res) => {\n res.json({ user: req.user });\n};\n\nexport const PUT = async (req, res) => {\n const { name, email } = req.body;\n // TODO: update user in DB\n res.json({ message: 'Profile updated', user: { ...req.user, name, email } });\n};\n`;\n\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `profile.${ext}`), profileContent);\n}\n\n// ─── META HELPER ─────────────────────────────────────────────────────────\n\ninterface MethodMetaSpec {\n description: string;\n params?: string;\n query?: string;\n request?: string;\n response?: string;\n status?: number;\n}\n\nfunction mkMeta(opts: ScaffoldOptions, methods: Record<string, MethodMetaSpec>): string {\n if (!opts.routeDocs) return '';\n const blocks = Object.entries(methods)\n .map(([method, m]) => {\n const reqParts: string[] = [];\n if (m.params) reqParts.push(`params: ${m.params}`);\n if (m.query) reqParts.push(`query: ${m.query}`);\n if (m.request) reqParts.push(`body: ${m.request}`);\n const reqLine = reqParts.length ? ` request: { ${reqParts.join(', ')} },\\n` : '';\n const status = m.status ?? 200;\n const respLine =\n m.response !== undefined\n ? ` response: { status: ${status}, body: ${m.response} },\\n`\n : ` response: { status: ${status} },\\n`;\n const description = m.description.replace(/'/g, \"\\\\'\");\n return ` ${method}: {\\n description: '${description}',\\n${reqLine}${respLine} },`;\n })\n .join('\\n');\n return opts.language === 'typescript'\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n${blocks}\\n};\\n\\n`\n : `export const meta = {\\n${blocks}\\n};\\n\\n`;\n}\n\n// ─── EXTENDED MODEL WRITERS ───────────────────────────────────────────────\n\nasync function writeSessionModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface SessionDocument {\n userId: string;\n token: string;\n ip: string;\n userAgent: string;\n expiresAt: Date;\n isActive: boolean;\n}\n\nexport const Session = defineModel<SessionDocument>('Session', {\n userId: { type: 'string', required: true },\n token: { type: 'string', required: true, unique: true },\n ip: { type: 'string', required: true },\n userAgent: { type: 'string', required: true },\n expiresAt: { type: 'date', required: true },\n isActive: { type: 'boolean', default: true },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Session = defineModel('Session', {\n userId: { type: 'string', required: true },\n token: { type: 'string', required: true, unique: true },\n ip: { type: 'string', required: true },\n userAgent: { type: 'string', required: true },\n expiresAt: { type: 'date', required: true },\n isActive: { type: 'boolean', default: true },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Session\n// import { pgTable, serial, text, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const sessions = pgTable('sessions', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// token: text('token').notNull().unique(),\n// ip: text('ip').notNull(),\n// userAgent: text('user_agent').notNull(),\n// expiresAt: timestamp('expires_at').notNull(),\n// isActive: boolean('is_active').notNull().default(true),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Session\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Session.${ext}`), content);\n}\n\nasync function writeNotificationModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface NotificationDocument {\n userId: string;\n title: string;\n message: string;\n type: string;\n isRead: boolean;\n link?: string;\n}\n\nexport const Notification = defineModel<NotificationDocument>('Notification', {\n userId: { type: 'string', required: true },\n title: { type: 'string', required: true },\n message: { type: 'string', required: true },\n type: { type: 'string', required: true, default: 'info' },\n isRead: { type: 'boolean', default: false },\n link: { type: 'string' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Notification = defineModel('Notification', {\n userId: { type: 'string', required: true },\n title: { type: 'string', required: true },\n message: { type: 'string', required: true },\n type: { type: 'string', required: true, default: 'info' },\n isRead: { type: 'boolean', default: false },\n link: { type: 'string' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Notification\n// import { pgTable, serial, text, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const notifications = pgTable('notifications', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// title: text('title').notNull(),\n// message: text('message').notNull(),\n// type: text('type').notNull().default('info'),\n// isRead: boolean('is_read').notNull().default(false),\n// link: text('link'),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Notification\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Notification.${ext}`), content);\n}\n\nasync function writeFileModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface FileDocument {\n userId: string;\n filename: string;\n originalName: string;\n mimeType: string;\n size: number;\n url: string;\n isPublic: boolean;\n}\n\nexport const File = defineModel<FileDocument>('File', {\n userId: { type: 'string', required: true },\n filename: { type: 'string', required: true },\n originalName: { type: 'string', required: true },\n mimeType: { type: 'string', required: true },\n size: { type: 'number', required: true },\n url: { type: 'string', required: true },\n isPublic: { type: 'boolean', default: false },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const File = defineModel('File', {\n userId: { type: 'string', required: true },\n filename: { type: 'string', required: true },\n originalName: { type: 'string', required: true },\n mimeType: { type: 'string', required: true },\n size: { type: 'number', required: true },\n url: { type: 'string', required: true },\n isPublic: { type: 'boolean', default: false },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for File\n// import { pgTable, serial, text, boolean, integer, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const files = pgTable('files', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// filename: text('filename').notNull(),\n// originalName: text('original_name').notNull(),\n// mimeType: text('mime_type').notNull(),\n// size: integer('size').notNull(),\n// url: text('url').notNull(),\n// isPublic: boolean('is_public').notNull().default(false),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for File\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `File.${ext}`), content);\n}\n\nasync function writeSupportTicketModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface SupportTicketDocument {\n userId: string;\n subject: string;\n message: string;\n status: string;\n priority: string;\n assignedTo?: string;\n}\n\nexport const SupportTicket = defineModel<SupportTicketDocument>('SupportTicket', {\n userId: { type: 'string', required: true },\n subject: { type: 'string', required: true },\n message: { type: 'string', required: true },\n status: { type: 'string', required: true, default: 'open' },\n priority: { type: 'string', required: true, default: 'normal' },\n assignedTo: { type: 'string' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const SupportTicket = defineModel('SupportTicket', {\n userId: { type: 'string', required: true },\n subject: { type: 'string', required: true },\n message: { type: 'string', required: true },\n status: { type: 'string', required: true, default: 'open' },\n priority: { type: 'string', required: true, default: 'normal' },\n assignedTo: { type: 'string' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for SupportTicket\n// import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const supportTickets = pgTable('support_tickets', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// subject: text('subject').notNull(),\n// message: text('message').notNull(),\n// status: text('status').notNull().default('open'),\n// priority: text('priority').notNull().default('normal'),\n// assignedTo: text('assigned_to'),\n// createdAt: timestamp('created_at').defaultNow(),\n// updatedAt: timestamp('updated_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for SupportTicket\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `SupportTicket.${ext}`), content);\n}\n\nasync function writeAuditLogModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface AuditLogDocument {\n adminId: string;\n action: string;\n entity: string;\n entityId: string;\n metadata?: Record<string, unknown>;\n ip: string;\n}\n\nexport const AuditLog = defineModel<AuditLogDocument>('AuditLog', {\n adminId: { type: 'string', required: true },\n action: { type: 'string', required: true },\n entity: { type: 'string', required: true },\n entityId: { type: 'string', required: true },\n metadata: { type: 'object' },\n ip: { type: 'string', required: true },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const AuditLog = defineModel('AuditLog', {\n adminId: { type: 'string', required: true },\n action: { type: 'string', required: true },\n entity: { type: 'string', required: true },\n entityId: { type: 'string', required: true },\n metadata: { type: 'object' },\n ip: { type: 'string', required: true },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for AuditLog\n// import { pgTable, serial, text, jsonb, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const auditLogs = pgTable('audit_logs', {\n// id: serial('id').primaryKey(),\n// adminId: text('admin_id').notNull(),\n// action: text('action').notNull(),\n// entity: text('entity').notNull(),\n// entityId: text('entity_id').notNull(),\n// metadata: jsonb('metadata'),\n// ip: text('ip').notNull(),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for AuditLog\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `AuditLog.${ext}`), content);\n}\n\nasync function writeSubscriptionModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface SubscriptionDocument {\n userId: string;\n planId: string;\n status: string;\n startDate: Date;\n endDate: Date;\n cancelledAt?: Date;\n}\n\nexport const Subscription = defineModel<SubscriptionDocument>('Subscription', {\n userId: { type: 'string', required: true },\n planId: { type: 'string', required: true },\n status: { type: 'string', required: true, default: 'active' },\n startDate: { type: 'date', required: true },\n endDate: { type: 'date', required: true },\n cancelledAt: { type: 'date' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Subscription = defineModel('Subscription', {\n userId: { type: 'string', required: true },\n planId: { type: 'string', required: true },\n status: { type: 'string', required: true, default: 'active' },\n startDate: { type: 'date', required: true },\n endDate: { type: 'date', required: true },\n cancelledAt: { type: 'date' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Subscription\n// import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const subscriptions = pgTable('subscriptions', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// planId: text('plan_id').notNull(),\n// status: text('status').notNull().default('active'),\n// startDate: timestamp('start_date').notNull(),\n// endDate: timestamp('end_date').notNull(),\n// cancelledAt: timestamp('cancelled_at'),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Subscription\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Subscription.${ext}`), content);\n}\n\nasync function writePlanModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface PlanDocument {\n name: string;\n description: string;\n price: number;\n interval: string;\n features: string[];\n isActive: boolean;\n}\n\nexport const Plan = defineModel<PlanDocument>('Plan', {\n name: { type: 'string', required: true },\n description: { type: 'string', required: true },\n price: { type: 'number', required: true },\n interval: { type: 'string', required: true, default: 'monthly' },\n features: { type: 'array', default: [] },\n isActive: { type: 'boolean', default: true },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Plan = defineModel('Plan', {\n name: { type: 'string', required: true },\n description: { type: 'string', required: true },\n price: { type: 'number', required: true },\n interval: { type: 'string', required: true, default: 'monthly' },\n features: { type: 'array', default: [] },\n isActive: { type: 'boolean', default: true },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Plan\n// import { pgTable, serial, text, numeric, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const plans = pgTable('plans', {\n// id: serial('id').primaryKey(),\n// name: text('name').notNull(),\n// description: text('description').notNull(),\n// price: numeric('price').notNull(),\n// interval: text('interval').notNull().default('monthly'),\n// features: text('features').array().notNull().default([]),\n// isActive: boolean('is_active').notNull().default(true),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Plan\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Plan.${ext}`), content);\n}\n\nasync function writeInvoiceModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface InvoiceDocument {\n userId: string;\n subscriptionId: string;\n amount: number;\n currency: string;\n status: string;\n paidAt?: Date;\n}\n\nexport const Invoice = defineModel<InvoiceDocument>('Invoice', {\n userId: { type: 'string', required: true },\n subscriptionId: { type: 'string', required: true },\n amount: { type: 'number', required: true },\n currency: { type: 'string', required: true, default: 'USD' },\n status: { type: 'string', required: true, default: 'pending' },\n paidAt: { type: 'date' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Invoice = defineModel('Invoice', {\n userId: { type: 'string', required: true },\n subscriptionId: { type: 'string', required: true },\n amount: { type: 'number', required: true },\n currency: { type: 'string', required: true, default: 'USD' },\n status: { type: 'string', required: true, default: 'pending' },\n paidAt: { type: 'date' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Invoice\n// import { pgTable, serial, text, numeric, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const invoices = pgTable('invoices', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// subscriptionId: text('subscription_id').notNull(),\n// amount: numeric('amount').notNull(),\n// currency: text('currency').notNull().default('USD'),\n// status: text('status').notNull().default('pending'),\n// paidAt: timestamp('paid_at'),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Invoice\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Invoice.${ext}`), content);\n}\n\nasync function writeApiKeyModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface ApiKeyDocument {\n userId: string;\n name: string;\n key: string;\n lastUsed?: Date;\n expiresAt?: Date;\n isActive: boolean;\n}\n\nexport const ApiKey = defineModel<ApiKeyDocument>('ApiKey', {\n userId: { type: 'string', required: true },\n name: { type: 'string', required: true },\n key: { type: 'string', required: true, unique: true },\n lastUsed: { type: 'date' },\n expiresAt:{ type: 'date' },\n isActive: { type: 'boolean', default: true },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const ApiKey = defineModel('ApiKey', {\n userId: { type: 'string', required: true },\n name: { type: 'string', required: true },\n key: { type: 'string', required: true, unique: true },\n lastUsed: { type: 'date' },\n expiresAt: { type: 'date' },\n isActive: { type: 'boolean', default: true },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for ApiKey\n// import { pgTable, serial, text, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const apiKeys = pgTable('api_keys', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// name: text('name').notNull(),\n// key: text('key').notNull().unique(),\n// lastUsed: timestamp('last_used'),\n// expiresAt: timestamp('expires_at'),\n// isActive: boolean('is_active').notNull().default(true),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for ApiKey\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `ApiKey.${ext}`), content);\n}\n\nasync function writeRoleModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface RoleDocument {\n name: string;\n description: string;\n permissions: string[];\n}\n\nexport const Role = defineModel<RoleDocument>('Role', {\n name: { type: 'string', required: true, unique: true },\n description: { type: 'string', required: true },\n permissions: { type: 'array', default: [] },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Role = defineModel('Role', {\n name: { type: 'string', required: true, unique: true },\n description: { type: 'string', required: true },\n permissions: { type: 'array', default: [] },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Role\n// import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const roles = pgTable('roles', {\n// id: serial('id').primaryKey(),\n// name: text('name').notNull().unique(),\n// description: text('description').notNull(),\n// permissions: text('permissions').array().notNull().default([]),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Role\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Role.${ext}`), content);\n}\n\nasync function writeFAQModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface FAQDocument {\n question: string;\n answer: string;\n category: string;\n order: number;\n isPublished: boolean;\n}\n\nexport const FAQ = defineModel<FAQDocument>('FAQ', {\n question: { type: 'string', required: true },\n answer: { type: 'string', required: true },\n category: { type: 'string', required: true, default: 'general' },\n order: { type: 'number', default: 0 },\n isPublished: { type: 'boolean', default: false },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const FAQ = defineModel('FAQ', {\n question: { type: 'string', required: true },\n answer: { type: 'string', required: true },\n category: { type: 'string', required: true, default: 'general' },\n order: { type: 'number', default: 0 },\n isPublished: { type: 'boolean', default: false },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for FAQ\n// import { pgTable, serial, text, boolean, integer, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const faqs = pgTable('faqs', {\n// id: serial('id').primaryKey(),\n// question: text('question').notNull(),\n// answer: text('answer').notNull(),\n// category: text('category').notNull().default('general'),\n// order: integer('order').notNull().default(0),\n// isPublished: boolean('is_published').notNull().default(false),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for FAQ\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `FAQ.${ext}`), content);\n}\n\nasync function writeBlogModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface BlogDocument {\n title: string;\n slug: string;\n content: string;\n authorId: string;\n category: string;\n tags: string[];\n status: string;\n publishedAt?: Date;\n}\n\nexport const Blog = defineModel<BlogDocument>('Blog', {\n title: { type: 'string', required: true },\n slug: { type: 'string', required: true, unique: true },\n content: { type: 'string', required: true },\n authorId: { type: 'string', required: true },\n category: { type: 'string', required: true, default: 'general' },\n tags: { type: 'array', default: [] },\n status: { type: 'string', required: true, default: 'draft' },\n publishedAt: { type: 'date' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Blog = defineModel('Blog', {\n title: { type: 'string', required: true },\n slug: { type: 'string', required: true, unique: true },\n content: { type: 'string', required: true },\n authorId: { type: 'string', required: true },\n category: { type: 'string', required: true, default: 'general' },\n tags: { type: 'array', default: [] },\n status: { type: 'string', required: true, default: 'draft' },\n publishedAt: { type: 'date' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Blog\n// import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const blogs = pgTable('blogs', {\n// id: serial('id').primaryKey(),\n// title: text('title').notNull(),\n// slug: text('slug').notNull().unique(),\n// content: text('content').notNull(),\n// authorId: text('author_id').notNull(),\n// category: text('category').notNull().default('general'),\n// tags: text('tags').array().notNull().default([]),\n// status: text('status').notNull().default('draft'),\n// publishedAt: timestamp('published_at'),\n// createdAt: timestamp('created_at').defaultNow(),\n// updatedAt: timestamp('updated_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Blog\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Blog.${ext}`), content);\n}\n\nasync function writeCategoryModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface CategoryDocument {\n name: string;\n slug: string;\n description?: string;\n parentId?: string;\n}\n\nexport const Category = defineModel<CategoryDocument>('Category', {\n name: { type: 'string', required: true },\n slug: { type: 'string', required: true, unique: true },\n description: { type: 'string' },\n parentId: { type: 'string' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Category = defineModel('Category', {\n name: { type: 'string', required: true },\n slug: { type: 'string', required: true, unique: true },\n description: { type: 'string' },\n parentId: { type: 'string' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Category\n// import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const categories = pgTable('categories', {\n// id: serial('id').primaryKey(),\n// name: text('name').notNull(),\n// slug: text('slug').notNull().unique(),\n// description: text('description'),\n// parentId: text('parent_id'),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Category\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Category.${ext}`), content);\n}\n\nasync function writeCouponModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface CouponDocument {\n code: string;\n type: string;\n value: number;\n maxUses: number;\n usedCount: number;\n expiresAt?: Date;\n isActive: boolean;\n}\n\nexport const Coupon = defineModel<CouponDocument>('Coupon', {\n code: { type: 'string', required: true, unique: true },\n type: { type: 'string', required: true, default: 'percent' },\n value: { type: 'number', required: true },\n maxUses: { type: 'number', default: 0 },\n usedCount: { type: 'number', default: 0 },\n expiresAt: { type: 'date' },\n isActive: { type: 'boolean', default: true },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Coupon = defineModel('Coupon', {\n code: { type: 'string', required: true, unique: true },\n type: { type: 'string', required: true, default: 'percent' },\n value: { type: 'number', required: true },\n maxUses: { type: 'number', default: 0 },\n usedCount: { type: 'number', default: 0 },\n expiresAt: { type: 'date' },\n isActive: { type: 'boolean', default: true },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Coupon\n// import { pgTable, serial, text, numeric, integer, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const coupons = pgTable('coupons', {\n// id: serial('id').primaryKey(),\n// code: text('code').notNull().unique(),\n// type: text('type').notNull().default('percent'),\n// value: numeric('value').notNull(),\n// maxUses: integer('max_uses').notNull().default(0),\n// usedCount: integer('used_count').notNull().default(0),\n// expiresAt: timestamp('expires_at'),\n// isActive: boolean('is_active').notNull().default(true),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Coupon\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Coupon.${ext}`), content);\n}\n\n// ─── EXTENDED ROUTE WRITERS ───────────────────────────────────────────────\n\nasync function writeAuthExtendedRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const mwUser2 = opts.rbac\n ? `export const middlewares = [requireAuth('user', 'admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n const mwUser3 = mwUser2;\n const reqT = ts ? `import type { Request, Response } from 'express';\\n` : '';\n const RA = `import { requireAuth } from 'express-file-cluster/auth';\\n`;\n\n const mongo = opts.database === 'mongodb';\n const hasAdmin = opts.adminPortal;\n const uf = opts.userFeatures;\n const sendResetEmail = opts.mailer\n ? ` var appUrl = process.env.APP_URL || 'http://localhost:3000';\n await enqueue('SendEmail', {\n to: email,\n subject: 'Reset your password',\n body: 'Reset your password: ' + appUrl + '/auth/reset-password?token=' + resetToken,\n });\n`\n : ` // TODO: email this token to the user — enable the Mailer feature to auto-wire SendEmail\n`;\n const sendVerifyEmailResend = opts.mailer\n ? ` var appUrl = process.env.APP_URL || 'http://localhost:3000';\n await enqueue('SendEmail', {\n to: email,\n subject: 'Verify your email address',\n body: 'Verify your email: ' + appUrl + '/auth/verify-email?token=' + verifyToken,\n });\n`\n : ` // TODO: email this token to the user — enable the Mailer feature to auto-wire SendEmail\n`;\n const mailerTaskImport = opts.mailer\n ? `import { enqueue } from 'express-file-cluster/tasks';\\n`\n : '';\n\n // refresh.ts\n if (uf.accountSecurity) {\n const refreshMeta = mkMeta(opts, {\n POST: {\n description: 'Refresh the JWT using the refresh-token cookie and issue a new access token.',\n response: `{ message: 'Token refreshed' }`,\n },\n });\n const refreshModelImports = `import { User } from '../../model/User.js';\\n${hasAdmin ? `import { Admin } from '../../model/Admin.js';\\n` : ''}`;\n const refreshLookup = hasAdmin\n ? ` const user = await User.findOne({ refreshToken: token });\n const admin = user ? null : await Admin.findOne({ refreshToken: token });\n const account = user || admin;`\n : ` const user = await User.findOne({ refreshToken: token });\n const account = user;`;\n const refreshPersist = hasAdmin\n ? ` if (user) await User.update(user.id, { refreshToken: newRefreshToken, refreshTokenExpiry });\n else if (admin) await Admin.update(admin.id, { refreshToken: newRefreshToken, refreshTokenExpiry });`\n : ` await User.update(user.id, { refreshToken: newRefreshToken, refreshTokenExpiry });`;\n const refreshContent = mongo\n ? ts\n ? `import { issueToken } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\nimport crypto from 'node:crypto';\n${refreshModelImports}${refreshMeta}const REFRESH_TOKEN_TTL_MS = 1000 * 60 * 60 * 24 * 30; // 30 days\n\nexport const POST = async (req: Request, res: Response) => {\n const token = req.cookies?.['efc_refresh_token'] || req.body?.refreshToken;\n if (!token) return res.status(401).json({ error: 'Refresh token required' });\n\n${refreshLookup}\n\n if (!account || !account.refreshTokenExpiry || new Date(account.refreshTokenExpiry) < new Date()) {\n return res.status(401).json({ error: 'Invalid or expired refresh token' });\n }\n\n const newRefreshToken = crypto.randomBytes(40).toString('hex');\n const refreshTokenExpiry = new Date(Date.now() + REFRESH_TOKEN_TTL_MS);\n${refreshPersist}\n\n res.cookie('efc_refresh_token', newRefreshToken, {\n httpOnly: true,\n secure: process.env.NODE_ENV === 'production',\n sameSite: 'strict',\n maxAge: REFRESH_TOKEN_TTL_MS,\n });\n\n await issueToken(res, { id: account.id, role: account.role, email: account.email });\n res.json({ message: 'Token refreshed' });\n};\n`\n : `import { issueToken } from 'express-file-cluster/auth';\nimport crypto from 'node:crypto';\n${refreshModelImports}${refreshMeta}const REFRESH_TOKEN_TTL_MS = 1000 * 60 * 60 * 24 * 30; // 30 days\n\nexport const POST = async (req, res) => {\n const token = req.cookies?.efc_refresh_token || req.body?.refreshToken;\n if (!token) return res.status(401).json({ error: 'Refresh token required' });\n\n${refreshLookup}\n\n if (!account || !account.refreshTokenExpiry || new Date(account.refreshTokenExpiry) < new Date()) {\n return res.status(401).json({ error: 'Invalid or expired refresh token' });\n }\n\n const newRefreshToken = crypto.randomBytes(40).toString('hex');\n const refreshTokenExpiry = new Date(Date.now() + REFRESH_TOKEN_TTL_MS);\n${refreshPersist}\n\n res.cookie('efc_refresh_token', newRefreshToken, {\n httpOnly: true,\n secure: process.env.NODE_ENV === 'production',\n sameSite: 'strict',\n maxAge: REFRESH_TOKEN_TTL_MS,\n });\n\n await issueToken(res, { id: account.id, role: account.role, email: account.email });\n res.json({ message: 'Token refreshed' });\n};\n`\n : ts\n ? `${RA}import type { Request, Response } from 'express';\n${refreshMeta}export const POST = async (_req: Request, res: Response) => {\n // TODO: validate refresh token, issue new JWT\n res.json({ message: 'Token refreshed' });\n};\n`\n : `${RA}${refreshMeta}export const POST = async (_req, res) => {\n // TODO: validate refresh token, issue new JWT\n res.json({ message: 'Token refreshed' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `refresh.${ext}`), refreshContent);\n }\n\n // verify-email.ts\n if (uf.emailVerification) {\n const veMeta = mkMeta(opts, {\n GET: {\n description: 'Verify an email address using the token from the verification link.',\n query: `{ token: 'a1b2c3d4' }`,\n response: `{ message: 'Email verified' }`,\n },\n POST: {\n description: 'Resend the verification email to a given address.',\n request: `{ email: 'user@example.com' }`,\n response: `{ message: 'Verification email sent' }`,\n },\n });\n const veContent = mongo\n ? ts\n ? `import type { Request, Response } from 'express';\nimport crypto from 'node:crypto';\n${mailerTaskImport}import { User } from '../../model/User.js';\n${veMeta}export const GET = async (req: Request, res: Response) => {\n const { token } = req.query;\n if (!token || typeof token !== 'string') return res.status(400).json({ error: 'token is required' });\n\n const user = await User.findOne({ verifyToken: token });\n if (!user) return res.status(400).json({ error: 'Invalid or expired verification token' });\n\n await User.update(user.id, { isVerified: true, verifyToken: '' });\n res.json({ message: 'Email verified' });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { email } = req.body;\n if (!email) return res.status(400).json({ error: 'email is required' });\n\n const user = await User.findOne({ email });\n if (user && !user.isVerified) {\n const verifyToken = crypto.randomBytes(32).toString('hex');\n await User.update(user.id, { verifyToken });\n${sendVerifyEmailResend} }\n\n res.json({ message: 'Verification email sent' });\n};\n`\n : `import crypto from 'node:crypto';\n${mailerTaskImport}import { User } from '../../model/User.js';\n${veMeta}export const GET = async (req, res) => {\n const { token } = req.query;\n if (!token || typeof token !== 'string') return res.status(400).json({ error: 'token is required' });\n\n const user = await User.findOne({ verifyToken: token });\n if (!user) return res.status(400).json({ error: 'Invalid or expired verification token' });\n\n await User.update(user.id, { isVerified: true, verifyToken: '' });\n res.json({ message: 'Email verified' });\n};\n\nexport const POST = async (req, res) => {\n const { email } = req.body;\n if (!email) return res.status(400).json({ error: 'email is required' });\n\n const user = await User.findOne({ email });\n if (user && !user.isVerified) {\n const verifyToken = crypto.randomBytes(32).toString('hex');\n await User.update(user.id, { verifyToken });\n${sendVerifyEmailResend} }\n\n res.json({ message: 'Verification email sent' });\n};\n`\n : ts\n ? `${RA}import type { Request, Response } from 'express';\n${veMeta}export const GET = async (req: Request, res: Response) => {\n const { token } = req.query;\n // TODO: verify token and mark user as verified\n res.json({ message: 'Email verified' });\n};\n\nexport const POST = async (_req: Request, res: Response) => {\n // TODO: resend verification email\n res.json({ message: 'Verification email sent' });\n};\n`\n : `${RA}${veMeta}export const GET = async (req, res) => {\n const { token } = req.query;\n // TODO: verify token and mark user as verified\n res.json({ message: 'Email verified' });\n};\n\nexport const POST = async (_req, res) => {\n // TODO: resend verification email\n res.json({ message: 'Verification email sent' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `verify-email.${ext}`), veContent);\n }\n\n // forgot-password.ts / reset-password.ts\n if (uf.forgotPassword) {\n const fpMeta = mkMeta(opts, {\n POST: {\n description: 'Send a password reset email to the given address.',\n request: `{ email: 'user@example.com' }`,\n response: `{ message: 'Reset email sent' }`,\n },\n });\n const fpModelImports = `import { User } from '../../model/User.js';\\n${hasAdmin ? `import { Admin } from '../../model/Admin.js';\\n` : ''}`;\n const fpLookup = hasAdmin\n ? ` const user = await User.findOne({ email });\n const admin = user ? null : await Admin.findOne({ email });`\n : ` const user = await User.findOne({ email });`;\n const fpGuard = hasAdmin ? 'user || admin' : 'user';\n const fpPersist = hasAdmin\n ? ` if (user) await User.update(user.id, { resetToken, resetTokenExpiry });\n else if (admin) await Admin.update(admin.id, { resetToken, resetTokenExpiry });`\n : ` await User.update(user.id, { resetToken, resetTokenExpiry });`;\n const fpContent = mongo\n ? ts\n ? `import type { Request, Response } from 'express';\nimport crypto from 'node:crypto';\n${mailerTaskImport}${fpModelImports}${fpMeta}const RESET_TOKEN_TTL_MS = 1000 * 60 * 60; // 1 hour\n\nexport const POST = async (req: Request, res: Response) => {\n const { email } = req.body;\n if (!email) return res.status(400).json({ error: 'email is required' });\n\n${fpLookup}\n\n // Always respond the same way whether or not the account exists, so this\n // endpoint can't be used to enumerate registered emails.\n if (${fpGuard}) {\n const resetToken = crypto.randomBytes(32).toString('hex');\n const resetTokenExpiry = new Date(Date.now() + RESET_TOKEN_TTL_MS);\n${fpPersist}\n${sendResetEmail} }\n\n res.json({ message: 'Reset email sent' });\n};\n`\n : `import crypto from 'node:crypto';\n${mailerTaskImport}${fpModelImports}${fpMeta}const RESET_TOKEN_TTL_MS = 1000 * 60 * 60; // 1 hour\n\nexport const POST = async (req, res) => {\n const { email } = req.body;\n if (!email) return res.status(400).json({ error: 'email is required' });\n\n${fpLookup}\n\n // Always respond the same way whether or not the account exists, so this\n // endpoint can't be used to enumerate registered emails.\n if (${fpGuard}) {\n const resetToken = crypto.randomBytes(32).toString('hex');\n const resetTokenExpiry = new Date(Date.now() + RESET_TOKEN_TTL_MS);\n${fpPersist}\n${sendResetEmail} }\n\n res.json({ message: 'Reset email sent' });\n};\n`\n : ts\n ? `${RA}import type { Request, Response } from 'express';\n${fpMeta}export const POST = async (req: Request, res: Response) => {\n const { email } = req.body;\n if (!email) return res.status(400).json({ error: 'email is required' });\n // TODO: generate reset token and send email\n res.json({ message: 'Reset email sent' });\n};\n`\n : `${RA}${fpMeta}export const POST = async (req, res) => {\n const { email } = req.body;\n if (!email) return res.status(400).json({ error: 'email is required' });\n // TODO: generate reset token and send email\n res.json({ message: 'Reset email sent' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `forgot-password.${ext}`), fpContent);\n\n // reset-password.ts\n const rpMeta = mkMeta(opts, {\n POST: {\n description: 'Reset password using a valid reset token.',\n request: `{ token: 'reset-token', password: 'newpassword' }`,\n response: `{ message: 'Password reset successfully' }`,\n },\n });\n const rpModelImports = `import { User } from '../../model/User.js';\\n${hasAdmin ? `import { Admin } from '../../model/Admin.js';\\n` : ''}`;\n const rpLookup = hasAdmin\n ? ` const user = await User.findOne({ resetToken: token });\n const admin = user ? null : await Admin.findOne({ resetToken: token });\n const account = user || admin;`\n : ` const user = await User.findOne({ resetToken: token });\n const account = user;`;\n const rpPersist = hasAdmin\n ? ` if (user) await User.update(user.id, { password: hashed, resetToken: '' });\n else if (admin) await Admin.update(admin.id, { password: hashed, resetToken: '' });`\n : ` await User.update(user.id, { password: hashed, resetToken: '' });`;\n const rpContent = mongo\n ? ts\n ? `import type { Request, Response } from 'express';\nimport bcrypt from 'bcrypt';\n${rpModelImports}${rpMeta}export const POST = async (req: Request, res: Response) => {\n const { token, password } = req.body;\n if (!token || !password) return res.status(400).json({ error: 'token and password are required' });\n\n${rpLookup}\n\n if (!account || !account.resetTokenExpiry || new Date(account.resetTokenExpiry) < new Date()) {\n return res.status(400).json({ error: 'Invalid or expired reset token' });\n }\n\n const hashed = await bcrypt.hash(password, 10);\n${rpPersist}\n\n res.json({ message: 'Password reset successfully' });\n};\n`\n : `import bcrypt from 'bcrypt';\n${rpModelImports}${rpMeta}export const POST = async (req, res) => {\n const { token, password } = req.body;\n if (!token || !password) return res.status(400).json({ error: 'token and password are required' });\n\n${rpLookup}\n\n if (!account || !account.resetTokenExpiry || new Date(account.resetTokenExpiry) < new Date()) {\n return res.status(400).json({ error: 'Invalid or expired reset token' });\n }\n\n const hashed = await bcrypt.hash(password, 10);\n${rpPersist}\n\n res.json({ message: 'Password reset successfully' });\n};\n`\n : ts\n ? `${RA}import type { Request, Response } from 'express';\n${rpMeta}export const POST = async (req: Request, res: Response) => {\n const { token, password } = req.body;\n if (!token || !password) return res.status(400).json({ error: 'token and password are required' });\n // TODO: validate token, hash and update password\n res.json({ message: 'Password reset successfully' });\n};\n`\n : `${RA}${rpMeta}export const POST = async (req, res) => {\n const { token, password } = req.body;\n if (!token || !password) return res.status(400).json({ error: 'token and password are required' });\n // TODO: validate token, hash and update password\n res.json({ message: 'Password reset successfully' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `reset-password.${ext}`), rpContent);\n }\n\n // change-password.ts (protected)\n if (uf.accountSecurity) {\n const cpMeta = mkMeta(opts, {\n POST: {\n description: 'Change password for the authenticated user.',\n request: `{ oldPassword: 'current', newPassword: 'newpassword' }`,\n response: `{ message: 'Password changed successfully' }`,\n },\n });\n const cpContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${cpMeta}${mwUser2}\nexport const POST = async (req: Request, res: Response) => {\n const { oldPassword, newPassword } = req.body;\n if (!oldPassword || !newPassword) return res.status(400).json({ error: 'oldPassword and newPassword are required' });\n // TODO: verify old password, hash and update new password\n res.json({ message: 'Password changed successfully' });\n};\n`\n : `${RA}${cpMeta}${mwUser2}\nexport const POST = async (req, res) => {\n const { oldPassword, newPassword } = req.body;\n if (!oldPassword || !newPassword) return res.status(400).json({ error: 'oldPassword and newPassword are required' });\n // TODO: verify old password, hash and update new password\n res.json({ message: 'Password changed successfully' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `change-password.${ext}`), cpContent);\n\n // 2fa/setup.ts\n const tfaSetupMeta = mkMeta(opts, {\n GET: {\n description: 'Generate a TOTP secret and QR code to set up 2FA.',\n response: `{ qrCode: 'otpauth://totp/...', secret: 'BASE32SECRET' }`,\n },\n POST: {\n description: 'Confirm a TOTP code to enable 2FA for the authenticated user.',\n request: `{ code: '123456' }`,\n response: `{ message: '2FA enabled' }`,\n },\n });\n const tfaSetupContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${tfaSetupMeta}${mwUser3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: generate TOTP secret and return QR code URL\n res.json({ qrCode: 'otpauth://totp/...', secret: 'BASE32SECRET' });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { code } = req.body;\n if (!code) return res.status(400).json({ error: 'code is required' });\n // TODO: verify TOTP code and enable 2FA\n res.json({ message: '2FA enabled' });\n};\n`\n : `${RA}${tfaSetupMeta}${mwUser3}\nexport const GET = async (req, res) => {\n // TODO: generate TOTP secret and return QR code URL\n res.json({ qrCode: 'otpauth://totp/...', secret: 'BASE32SECRET' });\n};\n\nexport const POST = async (req, res) => {\n const { code } = req.body;\n if (!code) return res.status(400).json({ error: 'code is required' });\n // TODO: verify TOTP code and enable 2FA\n res.json({ message: '2FA enabled' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'auth', '2fa', `setup.${ext}`),\n tfaSetupContent,\n );\n\n // 2fa/verify.ts\n const tfaVerifyMeta = mkMeta(opts, {\n POST: {\n description: 'Verify a TOTP code during login.',\n request: `{ code: '123456' }`,\n response: `{ message: '2FA verified' }`,\n },\n });\n const tfaVerifyContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${tfaVerifyMeta}export const POST = async (req: Request, res: Response) => {\n const { code } = req.body;\n if (!code) return res.status(400).json({ error: 'code is required' });\n // TODO: verify TOTP code\n res.json({ message: '2FA verified' });\n};\n`\n : `${RA}${tfaVerifyMeta}export const POST = async (req, res) => {\n const { code } = req.body;\n if (!code) return res.status(400).json({ error: 'code is required' });\n // TODO: verify TOTP code\n res.json({ message: '2FA verified' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'auth', '2fa', `verify.${ext}`),\n tfaVerifyContent,\n );\n\n // 2fa/disable.ts\n const tfaDisableMeta = mkMeta(opts, {\n POST: {\n description: 'Disable 2FA for the authenticated user.',\n request: `{ code: '123456' }`,\n response: `{ message: '2FA disabled' }`,\n },\n });\n const tfaDisableContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${tfaDisableMeta}${mwUser3}\nexport const POST = async (req: Request, res: Response) => {\n const { code } = req.body;\n if (!code) return res.status(400).json({ error: 'code is required' });\n // TODO: verify code and disable 2FA\n res.json({ message: '2FA disabled' });\n};\n`\n : `${RA}${tfaDisableMeta}${mwUser3}\nexport const POST = async (req, res) => {\n const { code } = req.body;\n if (!code) return res.status(400).json({ error: 'code is required' });\n // TODO: verify code and disable 2FA\n res.json({ message: '2FA disabled' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'auth', '2fa', `disable.${ext}`),\n tfaDisableContent,\n );\n\n // sessions/index.ts\n const sessListMeta = mkMeta(opts, {\n GET: {\n description: 'List all active sessions for the authenticated user.',\n response: `{ sessions: [] }`,\n },\n });\n const sessListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${sessListMeta}${mwUser3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch sessions for req.user.id\n res.json({ sessions: [] });\n};\n`\n : `${RA}${sessListMeta}${mwUser3}\nexport const GET = async (req, res) => {\n // TODO: fetch sessions for req.user.id\n res.json({ sessions: [] });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'auth', 'sessions', `index.${ext}`),\n sessListContent,\n );\n\n // sessions/[id].ts\n const sessRevokeMeta = mkMeta(opts, {\n DELETE: {\n description: 'Revoke a single active session by ID.',\n params: `{ id: 'sess_01HXZ' }`,\n response: `{ message: 'Session sess_01HXZ revoked' }`,\n },\n });\n const sessRevokeContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${sessRevokeMeta}${mwUser3}\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: revoke session by id\n res.json({ message: \\`Session \\${id} revoked\\` });\n};\n`\n : `${RA}${sessRevokeMeta}${mwUser3}\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: revoke session by id\n res.json({ message: \\`Session \\${id} revoked\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'auth', 'sessions', `[id].${ext}`),\n sessRevokeContent,\n );\n }\n}\n\nasync function writeUserExtendedRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n // user/* = 2 levels up to src/, user/subdir/* = 3 levels\n const mw2 = opts.rbac\n ? `export const middlewares = [requireAuth('user', 'admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n const mw3 = mw2;\n const RA = `import { requireAuth } from 'express-file-cluster/auth';\\n`;\n const user = ts ? `(req as any).user` : `req.user`;\n const uf = opts.userFeatures;\n\n // avatar.ts\n if (uf.accountSettings) {\n const avatarMeta = mkMeta(opts, {\n POST: {\n description: 'Upload a new avatar image for the authenticated user.',\n response: `{ message: 'Avatar updated', url: 'https://example.com/avatar.jpg' }`,\n },\n DELETE: {\n description: \"Remove the authenticated user's avatar.\",\n response: `{ message: 'Avatar removed' }`,\n },\n });\n const avatarContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${avatarMeta}${mw2}\nexport const POST = async (req: Request, res: Response) => {\n // TODO: handle multipart upload, store file, update user.avatar\n res.json({ message: 'Avatar updated', url: 'https://example.com/avatar.jpg' });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n // TODO: remove avatar and clear user.avatar\n res.json({ message: 'Avatar removed' });\n};\n`\n : `${RA}${avatarMeta}${mw2}\nexport const POST = async (req, res) => {\n // TODO: handle multipart upload, store file, update user.avatar\n res.json({ message: 'Avatar updated', url: 'https://example.com/avatar.jpg' });\n};\n\nexport const DELETE = async (req, res) => {\n // TODO: remove avatar and clear user.avatar\n res.json({ message: 'Avatar removed' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `avatar.${ext}`), avatarContent);\n\n // settings.ts\n const settingsMeta = mkMeta(opts, {\n GET: {\n description:\n 'Get account settings (notifications, language, theme, privacy) for the authenticated user.',\n response: `{ settings: { notifications: true, language: 'en', theme: 'system', privacy: 'public' } }`,\n },\n PUT: {\n description: 'Update account settings for the authenticated user.',\n request: `{ notifications: true, language: 'en', theme: 'system', privacy: 'public' }`,\n response: `{ message: 'Settings updated', settings: { notifications: true, language: 'en', theme: 'system', privacy: 'public' } }`,\n },\n });\n const settingsContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${settingsMeta}${mw2}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch user settings from DB\n res.json({ settings: { notifications: true, language: 'en', theme: 'system', privacy: 'public' } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n const { notifications, language, theme, privacy } = req.body;\n // TODO: update user settings in DB\n res.json({ message: 'Settings updated', settings: { notifications, language, theme, privacy } });\n};\n`\n : `${RA}${settingsMeta}${mw2}\nexport const GET = async (req, res) => {\n // TODO: fetch user settings from DB\n res.json({ settings: { notifications: true, language: 'en', theme: 'system', privacy: 'public' } });\n};\n\nexport const PUT = async (req, res) => {\n const { notifications, language, theme, privacy } = req.body;\n // TODO: update user settings in DB\n res.json({ message: 'Settings updated', settings: { notifications, language, theme, privacy } });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `settings.${ext}`), settingsContent);\n\n // account.ts\n const accountMeta = mkMeta(opts, {\n GET: {\n description: 'Download a personal data export for the authenticated user.',\n response: `{ data: { user: { id: '1', role: 'user', email: 'user@example.com' }, exportedAt: '2026-01-01T00:00:00.000Z' } }`,\n },\n DELETE: {\n description:\n 'Schedule the authenticated account for deletion (requires password confirmation).',\n request: `{ password: 'current' }`,\n response: `{ message: 'Account scheduled for deletion' }`,\n },\n });\n const accountContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${accountMeta}${mw2}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: compile and return personal data export\n res.json({ data: { user: ${user}, exportedAt: new Date().toISOString() } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n const { password } = req.body;\n if (!password) return res.status(400).json({ error: 'password confirmation required' });\n // TODO: verify password, schedule account deletion\n res.json({ message: 'Account scheduled for deletion' });\n};\n`\n : `${RA}${accountMeta}${mw2}\nexport const GET = async (req, res) => {\n // TODO: compile and return personal data export\n res.json({ data: { user: ${user}, exportedAt: new Date().toISOString() } });\n};\n\nexport const DELETE = async (req, res) => {\n const { password } = req.body;\n if (!password) return res.status(400).json({ error: 'password confirmation required' });\n // TODO: verify password, schedule account deletion\n res.json({ message: 'Account scheduled for deletion' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `account.${ext}`), accountContent);\n\n // dashboard.ts\n const dashMeta = mkMeta(opts, {\n GET: {\n description: 'Personal dashboard: stats, recent activity, and quick actions.',\n response: `{ stats: {}, recentActivity: [], quickActions: [] }`,\n },\n });\n const dashContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${dashMeta}${mw2}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: aggregate personal stats and activity\n res.json({ stats: {}, recentActivity: [], quickActions: [] });\n};\n`\n : `${RA}${dashMeta}${mw2}\nexport const GET = async (req, res) => {\n // TODO: aggregate personal stats and activity\n res.json({ stats: {}, recentActivity: [], quickActions: [] });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `dashboard.${ext}`), dashContent);\n\n // activity.ts\n const actMeta = mkMeta(opts, {\n GET: {\n description: 'Paginated activity history for the authenticated user.',\n query: `{ page: '1', limit: '20' }`,\n response: `{ activities: [], total: 0, page: 1, limit: 20 }`,\n },\n });\n const actContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${actMeta}${mw2}\nexport const GET = async (req: Request, res: Response) => {\n const { page = 1, limit = 20 } = req.query;\n // TODO: fetch paginated activity log\n res.json({ activities: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`\n : `${RA}${actMeta}${mw2}\nexport const GET = async (req, res) => {\n const { page = 1, limit = 20 } = req.query;\n // TODO: fetch paginated activity log\n res.json({ activities: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `activity.${ext}`), actContent);\n }\n\n // notifications/index.ts\n if (uf.notifications) {\n const notifListMeta = mkMeta(opts, {\n GET: {\n description: 'List notifications for the authenticated user.',\n response: `{ notifications: [], total: 0, unread: 0 }`,\n },\n POST: {\n description: 'Mark all notifications as read for the authenticated user.',\n response: `{ message: 'All notifications marked as read' }`,\n },\n });\n const notifListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${notifListMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch notifications for user\n res.json({ notifications: [], total: 0, unread: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n // TODO: mark all notifications as read\n res.json({ message: 'All notifications marked as read' });\n};\n`\n : `${RA}${notifListMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch notifications for user\n res.json({ notifications: [], total: 0, unread: 0 });\n};\n\nexport const POST = async (req, res) => {\n // TODO: mark all notifications as read\n res.json({ message: 'All notifications marked as read' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'notifications', `index.${ext}`),\n notifListContent,\n );\n\n // notifications/[id].ts\n const notifByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Fetch a single notification by ID.',\n params: `{ id: 'notif_01HXZ' }`,\n response: `{ notification: { id: 'notif_01HXZ' } }`,\n },\n PATCH: {\n description: 'Mark a single notification as read.',\n params: `{ id: 'notif_01HXZ' }`,\n response: `{ message: 'Notification marked as read', id: 'notif_01HXZ' }`,\n },\n DELETE: {\n description: 'Delete a single notification.',\n params: `{ id: 'notif_01HXZ' }`,\n response: `{ message: 'Notification notif_01HXZ deleted' }`,\n },\n });\n const notifByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${notifByIdMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: fetch notification by id\n res.json({ notification: { id } });\n};\n\nexport const PATCH = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: mark notification as read\n res.json({ message: 'Notification marked as read', id });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: delete notification\n res.json({ message: \\`Notification \\${id} deleted\\` });\n};\n`\n : `${RA}${notifByIdMeta}${mw3}\nexport const GET = async (req, res) => {\n const { id } = req.params;\n // TODO: fetch notification by id\n res.json({ notification: { id } });\n};\n\nexport const PATCH = async (req, res) => {\n const { id } = req.params;\n // TODO: mark notification as read\n res.json({ message: 'Notification marked as read', id });\n};\n\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: delete notification\n res.json({ message: \\`Notification \\${id} deleted\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'notifications', `[id].${ext}`),\n notifByIdContent,\n );\n }\n\n // files/index.ts (files, favorites, bookmarks & search share the filesAndMedia toggle)\n if (uf.filesAndMedia) {\n const filesListMeta = mkMeta(opts, {\n GET: {\n description: 'List uploaded files with storage usage for the authenticated user.',\n response: `{ files: [], total: 0, storageUsed: 0 }`,\n },\n POST: {\n description: 'Upload a new file for the authenticated user.',\n response: `{ message: 'File uploaded', file: { id: 'new-id' } }`,\n status: 201,\n },\n });\n const filesListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${filesListMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch user files and compute storage usage\n res.json({ files: [], total: 0, storageUsed: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n // TODO: handle multipart upload, persist file record\n res.status(201).json({ message: 'File uploaded', file: { id: 'new-id' } });\n};\n`\n : `${RA}${filesListMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch user files and compute storage usage\n res.json({ files: [], total: 0, storageUsed: 0 });\n};\n\nexport const POST = async (req, res) => {\n // TODO: handle multipart upload, persist file record\n res.status(201).json({ message: 'File uploaded', file: { id: 'new-id' } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'files', `index.${ext}`),\n filesListContent,\n );\n\n // files/[id].ts\n const fileByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Get a download/preview URL for a single file by ID.',\n params: `{ id: 'file_01HXZ' }`,\n response: `{ file: { id: 'file_01HXZ', url: 'https://example.com/files/file_01HXZ' } }`,\n },\n DELETE: {\n description: 'Delete a file from storage.',\n params: `{ id: 'file_01HXZ' }`,\n response: `{ message: 'File file_01HXZ deleted' }`,\n },\n });\n const fileByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${fileByIdMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: stream or redirect to file download/preview URL\n res.json({ file: { id, url: 'https://...' } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: delete file from storage and DB\n res.json({ message: \\`File \\${id} deleted\\` });\n};\n`\n : `${RA}${fileByIdMeta}${mw3}\nexport const GET = async (req, res) => {\n const { id } = req.params;\n // TODO: stream or redirect to file download/preview URL\n res.json({ file: { id, url: 'https://...' } });\n};\n\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: delete file from storage and DB\n res.json({ message: \\`File \\${id} deleted\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'files', `[id].${ext}`),\n fileByIdContent,\n );\n\n // favorites/index.ts\n const favListMeta = mkMeta(opts, {\n GET: {\n description: 'List favorites for the authenticated user.',\n response: `{ favorites: [] }`,\n },\n POST: {\n description: \"Add an entity to the authenticated user's favorites.\",\n request: `{ entityId: 'post_01HXZ', entityType: 'post' }`,\n response: `{ message: 'Added to favorites' }`,\n status: 201,\n },\n });\n const favListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${favListMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch user favorites\n res.json({ favorites: [] });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { entityId, entityType } = req.body;\n if (!entityId || !entityType) return res.status(400).json({ error: 'entityId and entityType are required' });\n // TODO: add to favorites\n res.status(201).json({ message: 'Added to favorites' });\n};\n`\n : `${RA}${favListMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch user favorites\n res.json({ favorites: [] });\n};\n\nexport const POST = async (req, res) => {\n const { entityId, entityType } = req.body;\n if (!entityId || !entityType) return res.status(400).json({ error: 'entityId and entityType are required' });\n // TODO: add to favorites\n res.status(201).json({ message: 'Added to favorites' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'favorites', `index.${ext}`),\n favListContent,\n );\n\n // favorites/[id].ts\n const favByIdMeta = mkMeta(opts, {\n DELETE: {\n description: 'Remove an entity from the authenticated user favorites.',\n params: `{ id: 'fav_01HXZ' }`,\n response: `{ message: 'Removed favorite fav_01HXZ' }`,\n },\n });\n const favByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${favByIdMeta}${mw3}\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: remove from favorites\n res.json({ message: \\`Removed favorite \\${id}\\` });\n};\n`\n : `${RA}${favByIdMeta}${mw3}\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: remove from favorites\n res.json({ message: \\`Removed favorite \\${id}\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'favorites', `[id].${ext}`),\n favByIdContent,\n );\n\n // bookmarks/index.ts\n const bkListMeta = mkMeta(opts, {\n GET: {\n description: 'List bookmarks for the authenticated user.',\n response: `{ bookmarks: [] }`,\n },\n POST: {\n description: 'Save a new bookmark for the authenticated user.',\n request: `{ url: 'https://example.com', title: 'Example' }`,\n response: `{ message: 'Bookmark saved' }`,\n status: 201,\n },\n });\n const bkListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${bkListMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch user bookmarks\n res.json({ bookmarks: [] });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { url, title } = req.body;\n if (!url) return res.status(400).json({ error: 'url is required' });\n // TODO: save bookmark\n res.status(201).json({ message: 'Bookmark saved' });\n};\n`\n : `${RA}${bkListMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch user bookmarks\n res.json({ bookmarks: [] });\n};\n\nexport const POST = async (req, res) => {\n const { url, title } = req.body;\n if (!url) return res.status(400).json({ error: 'url is required' });\n // TODO: save bookmark\n res.status(201).json({ message: 'Bookmark saved' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'bookmarks', `index.${ext}`),\n bkListContent,\n );\n\n // bookmarks/[id].ts\n const bkByIdMeta = mkMeta(opts, {\n DELETE: {\n description: 'Delete a bookmark by ID.',\n params: `{ id: 'bm_01HXZ' }`,\n response: `{ message: 'Bookmark bm_01HXZ removed' }`,\n },\n });\n const bkByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${bkByIdMeta}${mw3}\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: delete bookmark\n res.json({ message: \\`Bookmark \\${id} removed\\` });\n};\n`\n : `${RA}${bkByIdMeta}${mw3}\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: delete bookmark\n res.json({ message: \\`Bookmark \\${id} removed\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'bookmarks', `[id].${ext}`),\n bkByIdContent,\n );\n\n // search.ts\n const searchMeta = mkMeta(opts, {\n GET: {\n description: 'Search with filters, sort, and pagination.',\n query: `{ q: 'query', filter: 'active', sort: 'newest', page: '1', limit: '20' }`,\n response: `{ results: [], total: 0, page: 1, limit: 20 }`,\n },\n });\n const searchContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${searchMeta}${mw2}\nexport const GET = async (req: Request, res: Response) => {\n const { q, filter, sort, page = 1, limit = 20 } = req.query;\n // TODO: implement search\n res.json({ results: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`\n : `${RA}${searchMeta}${mw2}\nexport const GET = async (req, res) => {\n const { q, filter, sort, page = 1, limit = 20 } = req.query;\n // TODO: implement search\n res.json({ results: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `search.${ext}`), searchContent);\n }\n\n // api-keys/index.ts\n if (uf.apiAndBilling) {\n const akListMeta = mkMeta(opts, {\n GET: { description: 'List API keys for the authenticated user.', response: `{ apiKeys: [] }` },\n POST: {\n description: 'Generate a new API key for the authenticated user.',\n request: `{ name: 'CI key' }`,\n response: `{ message: 'API key created', key: 'efc_...' }`,\n status: 201,\n },\n });\n const akListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${akListMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch api keys for user\n res.json({ apiKeys: [] });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { name } = req.body;\n if (!name) return res.status(400).json({ error: 'name is required' });\n // TODO: generate and store API key\n res.status(201).json({ message: 'API key created', key: 'efc_...' });\n};\n`\n : `${RA}${akListMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch api keys for user\n res.json({ apiKeys: [] });\n};\n\nexport const POST = async (req, res) => {\n const { name } = req.body;\n if (!name) return res.status(400).json({ error: 'name is required' });\n // TODO: generate and store API key\n res.status(201).json({ message: 'API key created', key: 'efc_...' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'api-keys', `index.${ext}`),\n akListContent,\n );\n\n // api-keys/[id].ts\n const akByIdMeta = mkMeta(opts, {\n DELETE: {\n description: 'Revoke and delete an API key by ID.',\n params: `{ id: 'key_01HXZ' }`,\n response: `{ message: 'API key key_01HXZ revoked' }`,\n },\n });\n const akByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${akByIdMeta}${mw3}\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: revoke and delete API key\n res.json({ message: \\`API key \\${id} revoked\\` });\n};\n`\n : `${RA}${akByIdMeta}${mw3}\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: revoke and delete API key\n res.json({ message: \\`API key \\${id} revoked\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'api-keys', `[id].${ext}`),\n akByIdContent,\n );\n }\n}\n\nasync function writeUserBillingRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n // user/billing/* = 3 levels, user/billing/subdir/* = 4 levels\n const mw3 = opts.rbac\n ? `export const middlewares = [requireAuth('user', 'admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n const mw4 = mw3;\n const RA = `import { requireAuth } from 'express-file-cluster/auth';\\n`;\n\n // billing/plans.ts\n const plansMeta = mkMeta(opts, {\n GET: { description: 'List all available subscription plans.', response: `{ plans: [] }` },\n });\n const plansContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${plansMeta}${mw3}\nexport const GET = async (_req: Request, res: Response) => {\n // TODO: fetch active plans from DB\n res.json({ plans: [] });\n};\n`\n : `${RA}${plansMeta}${mw3}\nexport const GET = async (_req, res) => {\n // TODO: fetch active plans from DB\n res.json({ plans: [] });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'billing', `plans.${ext}`),\n plansContent,\n );\n\n // billing/subscription.ts\n const subMeta = mkMeta(opts, {\n GET: {\n description: 'Get the current subscription for the authenticated user.',\n response: `{ subscription: null }`,\n },\n POST: {\n description: 'Subscribe the authenticated user to a plan.',\n request: `{ planId: 'plan_01HXZ' }`,\n response: `{ message: 'Subscribed', subscription: { planId: 'plan_01HXZ' } }`,\n status: 201,\n },\n DELETE: {\n description: 'Cancel the current subscription at period end.',\n response: `{ message: 'Subscription cancelled' }`,\n },\n });\n const subContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${subMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch current subscription for user\n res.json({ subscription: null });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { planId } = req.body;\n if (!planId) return res.status(400).json({ error: 'planId is required' });\n // TODO: create subscription via payment gateway\n res.status(201).json({ message: 'Subscribed', subscription: { planId } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n // TODO: cancel subscription at period end\n res.json({ message: 'Subscription cancelled' });\n};\n`\n : `${RA}${subMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch current subscription for user\n res.json({ subscription: null });\n};\n\nexport const POST = async (req, res) => {\n const { planId } = req.body;\n if (!planId) return res.status(400).json({ error: 'planId is required' });\n // TODO: create subscription via payment gateway\n res.status(201).json({ message: 'Subscribed', subscription: { planId } });\n};\n\nexport const DELETE = async (req, res) => {\n // TODO: cancel subscription at period end\n res.json({ message: 'Subscription cancelled' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'billing', `subscription.${ext}`),\n subContent,\n );\n\n // billing/payment-methods/index.ts\n const pmListMeta = mkMeta(opts, {\n GET: {\n description: 'List payment methods for the authenticated user.',\n response: `{ paymentMethods: [] }`,\n },\n POST: {\n description: 'Attach a new payment method via the payment gateway.',\n request: `{ token: 'tok_...' }`,\n response: `{ message: 'Payment method added' }`,\n status: 201,\n },\n });\n const pmListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${pmListMeta}${mw4}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch payment methods for user\n res.json({ paymentMethods: [] });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { token } = req.body;\n if (!token) return res.status(400).json({ error: 'payment token is required' });\n // TODO: attach payment method via payment gateway\n res.status(201).json({ message: 'Payment method added' });\n};\n`\n : `${RA}${pmListMeta}${mw4}\nexport const GET = async (req, res) => {\n // TODO: fetch payment methods for user\n res.json({ paymentMethods: [] });\n};\n\nexport const POST = async (req, res) => {\n const { token } = req.body;\n if (!token) return res.status(400).json({ error: 'payment token is required' });\n // TODO: attach payment method via payment gateway\n res.status(201).json({ message: 'Payment method added' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'billing', 'payment-methods', `index.${ext}`),\n pmListContent,\n );\n\n // billing/payment-methods/[id].ts\n const pmByIdMeta = mkMeta(opts, {\n DELETE: {\n description: 'Detach a payment method from the payment gateway.',\n params: `{ id: 'pm_01HXZ' }`,\n response: `{ message: 'Payment method pm_01HXZ removed' }`,\n },\n });\n const pmByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${pmByIdMeta}${mw4}\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: detach payment method from payment gateway\n res.json({ message: \\`Payment method \\${id} removed\\` });\n};\n`\n : `${RA}${pmByIdMeta}${mw4}\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: detach payment method from payment gateway\n res.json({ message: \\`Payment method \\${id} removed\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'billing', 'payment-methods', `[id].${ext}`),\n pmByIdContent,\n );\n\n // billing/invoices/index.ts\n const invListMeta = mkMeta(opts, {\n GET: {\n description: 'List all invoices for the authenticated user.',\n response: `{ invoices: [], total: 0 }`,\n },\n });\n const invListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${invListMeta}${mw4}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch invoices for user\n res.json({ invoices: [], total: 0 });\n};\n`\n : `${RA}${invListMeta}${mw4}\nexport const GET = async (req, res) => {\n // TODO: fetch invoices for user\n res.json({ invoices: [], total: 0 });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'billing', 'invoices', `index.${ext}`),\n invListContent,\n );\n\n // billing/invoices/[id].ts\n const invByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Get the download URL for a single invoice by ID.',\n params: `{ id: 'inv_01HXZ' }`,\n response: `{ invoice: { id: 'inv_01HXZ', downloadUrl: 'https://example.com/invoices/inv_01HXZ.pdf' } }`,\n },\n });\n const invByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${invByIdMeta}${mw4}\nexport const GET = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: return invoice PDF URL or inline data\n res.json({ invoice: { id, downloadUrl: 'https://...' } });\n};\n`\n : `${RA}${invByIdMeta}${mw4}\nexport const GET = async (req, res) => {\n const { id } = req.params;\n // TODO: return invoice PDF URL or inline data\n res.json({ invoice: { id, downloadUrl: 'https://...' } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'billing', 'invoices', `[id].${ext}`),\n invByIdContent,\n );\n}\n\nasync function writeSupportRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n // support/tickets/* = 3 levels\n const mw3 = opts.rbac\n ? `export const middlewares = [requireAuth('user', 'admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n const RA = `import { requireAuth } from 'express-file-cluster/auth';\\n`;\n\n // support/tickets/index.ts\n const ticketListMeta = mkMeta(opts, {\n GET: {\n description: \"List the authenticated user's own support tickets.\",\n response: `{ tickets: [], total: 0 }`,\n },\n POST: {\n description: 'Create a new support ticket.',\n request: `{ subject: 'Issue with login', message: 'I cannot log in', priority: 'normal' }`,\n response: `{ message: 'Ticket created', ticket: { id: 'new-id', subject: 'Issue with login', status: 'open' } }`,\n status: 201,\n },\n });\n const ticketListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${ticketListMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch tickets for current user\n res.json({ tickets: [], total: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { subject, message, priority } = req.body;\n if (!subject || !message) return res.status(400).json({ error: 'subject and message are required' });\n // TODO: create support ticket in DB\n res.status(201).json({ message: 'Ticket created', ticket: { id: 'new-id', subject, status: 'open' } });\n};\n`\n : `${RA}${ticketListMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch tickets for current user\n res.json({ tickets: [], total: 0 });\n};\n\nexport const POST = async (req, res) => {\n const { subject, message, priority } = req.body;\n if (!subject || !message) return res.status(400).json({ error: 'subject and message are required' });\n // TODO: create support ticket in DB\n res.status(201).json({ message: 'Ticket created', ticket: { id: 'new-id', subject, status: 'open' } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'support', 'tickets', `index.${ext}`),\n ticketListContent,\n );\n\n // support/tickets/[id].ts\n const ticketByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Fetch a single support ticket by ID.',\n params: `{ id: 'tk_01HXZ' }`,\n response: `{ ticket: { id: 'tk_01HXZ', subject: 'Issue', status: 'open', replies: [] } }`,\n },\n PUT: {\n description: 'Add a reply to a support ticket or update its status.',\n params: `{ id: 'tk_01HXZ' }`,\n request: `{ reply: 'Thanks, resolved.', status: 'closed' }`,\n response: `{ message: 'Ticket updated', ticket: { id: 'tk_01HXZ', status: 'closed' } }`,\n },\n });\n const ticketByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${ticketByIdMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: fetch ticket by id, verify ownership\n res.json({ ticket: { id, subject: '', status: 'open', replies: [] } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n const { id } = req.params;\n const { reply, status } = req.body;\n // TODO: add reply or update status\n res.json({ message: 'Ticket updated', ticket: { id, status: status ?? 'open' } });\n};\n`\n : `${RA}${ticketByIdMeta}${mw3}\nexport const GET = async (req, res) => {\n const { id } = req.params;\n // TODO: fetch ticket by id, verify ownership\n res.json({ ticket: { id, subject: '', status: 'open', replies: [] } });\n};\n\nexport const PUT = async (req, res) => {\n const { id } = req.params;\n const { reply, status } = req.body;\n // TODO: add reply or update status\n res.json({ message: 'Ticket updated', ticket: { id, status: status ?? 'open' } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'support', 'tickets', `[id].${ext}`),\n ticketByIdContent,\n );\n}\n\nasync function writeAdminExtendedRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n // depth: admin/subdir/* = 3, admin/subdir/subdir/* = 4, admin/users/[id]/* = 4\n const mwAdmin3 = opts.rbac\n ? `export const middlewares = [requireAuth('admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n const mwAdmin4 = mwAdmin3;\n const roleGuard = opts.rbac\n ? ''\n : ts\n ? ` const user = (req as any).user;\\n if (user?.role !== 'admin') return res.status(403).json({ error: 'Forbidden' });\\n`\n : ` const user = req.user;\\n if (user?.role !== 'admin') return res.status(403).json({ error: 'Forbidden' });\\n`;\n const RA = `import { requireAuth } from 'express-file-cluster/auth';\\n`;\n const af = opts.adminFeatures;\n\n // ── Analytics ──────────────────────────────────────────────────────────\n if (af.analytics) {\n // admin/analytics/index.ts\n const analyticsOverviewMeta = mkMeta(opts, {\n GET: {\n description: 'Analytics overview: users, revenue, traffic (admin only).',\n response: `{ users: {}, revenue: {}, traffic: {} }`,\n },\n });\n const analyticsOverviewContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${analyticsOverviewMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} // TODO: aggregate analytics overview\n res.json({ users: {}, revenue: {}, traffic: {} });\n};\n`\n : `${RA}${analyticsOverviewMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} // TODO: aggregate analytics overview\n res.json({ users: {}, revenue: {}, traffic: {} });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'analytics', `index.${ext}`),\n analyticsOverviewContent,\n );\n\n const analyticsUsersMeta = mkMeta(opts, {\n GET: {\n description: 'User analytics: registrations, active users, churn (admin only).',\n query: `{ period: '30d' }`,\n response: `{ registrations: [], activeUsers: 0, churn: 0, period: '30d' }`,\n },\n });\n const analyticsUsersContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${analyticsUsersMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { period = '30d' } = req.query;\n // TODO: fetch user analytics for period\n res.json({ registrations: [], activeUsers: 0, churn: 0, period });\n};\n`\n : `${RA}${analyticsUsersMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { period = '30d' } = req.query;\n // TODO: fetch user analytics for period\n res.json({ registrations: [], activeUsers: 0, churn: 0, period });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'analytics', `users.${ext}`),\n analyticsUsersContent,\n );\n\n const analyticsRevenueMeta = mkMeta(opts, {\n GET: {\n description: 'Revenue analytics: MRR, ARR, payment history (admin only).',\n query: `{ period: '30d' }`,\n response: `{ mrr: 0, arr: 0, history: [], period: '30d' }`,\n },\n });\n const analyticsRevenueContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${analyticsRevenueMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { period = '30d' } = req.query;\n // TODO: fetch revenue analytics for period\n res.json({ mrr: 0, arr: 0, history: [], period });\n};\n`\n : `${RA}${analyticsRevenueMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { period = '30d' } = req.query;\n // TODO: fetch revenue analytics for period\n res.json({ mrr: 0, arr: 0, history: [], period });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'analytics', `revenue.${ext}`),\n analyticsRevenueContent,\n );\n\n const analyticsTrafficMeta = mkMeta(opts, {\n GET: {\n description: 'Traffic analytics: page views, devices, countries (admin only).',\n query: `{ period: '30d' }`,\n response: `{ pageViews: 0, devices: {}, countries: {}, period: '30d' }`,\n },\n });\n const analyticsTrafficContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${analyticsTrafficMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { period = '30d' } = req.query;\n // TODO: fetch traffic analytics for period\n res.json({ pageViews: 0, devices: {}, countries: {}, period });\n};\n`\n : `${RA}${analyticsTrafficMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { period = '30d' } = req.query;\n // TODO: fetch traffic analytics for period\n res.json({ pageViews: 0, devices: {}, countries: {}, period });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'analytics', `traffic.${ext}`),\n analyticsTrafficContent,\n );\n }\n\n // ── User Actions ──────────────────────────────────────────────────────\n if (af.userManagement) {\n // admin/users/[id]/suspend.ts\n const suspendMeta = mkMeta(opts, {\n POST: {\n description: 'Suspend a user account (admin only).',\n params: `{ id: 'usr_01HXZ' }`,\n request: `{ reason: 'Terms of service violation' }`,\n response: `{ message: 'User usr_01HXZ suspended', reason: 'Terms of service violation' }`,\n },\n });\n const suspendContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${suspendMeta}${mwAdmin4}\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n const { reason } = req.body;\n // TODO: set user.isActive = false, log audit event\n res.json({ message: \\`User \\${id} suspended\\`, reason });\n};\n`\n : `${RA}${suspendMeta}${mwAdmin4}\nexport const POST = async (req, res) => {\n${roleGuard} const { id } = req.params;\n const { reason } = req.body;\n // TODO: set user.isActive = false, log audit event\n res.json({ message: \\`User \\${id} suspended\\`, reason });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'users', '[id]', `suspend.${ext}`),\n suspendContent,\n );\n\n // admin/users/[id]/activate.ts\n const activateMeta = mkMeta(opts, {\n POST: {\n description: 'Reactivate a suspended user account (admin only).',\n params: `{ id: 'usr_01HXZ' }`,\n response: `{ message: 'User usr_01HXZ activated' }`,\n },\n });\n const activateContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${activateMeta}${mwAdmin4}\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: set user.isActive = true, log audit event\n res.json({ message: \\`User \\${id} activated\\` });\n};\n`\n : `${RA}${activateMeta}${mwAdmin4}\nexport const POST = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: set user.isActive = true, log audit event\n res.json({ message: \\`User \\${id} activated\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'users', '[id]', `activate.${ext}`),\n activateContent,\n );\n\n // admin/users/[id]/verify.ts\n const verifyUserMeta = mkMeta(opts, {\n POST: {\n description: \"Mark a user's email as verified (admin only).\",\n params: `{ id: 'usr_01HXZ' }`,\n response: `{ message: 'User usr_01HXZ verified' }`,\n },\n });\n const verifyUserContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${verifyUserMeta}${mwAdmin4}\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: set user.isVerified = true\n res.json({ message: \\`User \\${id} verified\\` });\n};\n`\n : `${RA}${verifyUserMeta}${mwAdmin4}\nexport const POST = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: set user.isVerified = true\n res.json({ message: \\`User \\${id} verified\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'users', '[id]', `verify.${ext}`),\n verifyUserContent,\n );\n\n // admin/users/export.ts\n const exportMeta = mkMeta(opts, {\n GET: {\n description: 'Export all users as a CSV download (admin only).',\n response: `'id,name,email,role,createdAt\\\\n'`,\n },\n });\n const exportContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${exportMeta}${mwAdmin3}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: generate CSV of all users and stream response\n res.setHeader('Content-Type', 'text/csv');\n res.setHeader('Content-Disposition', 'attachment; filename=\"users.csv\"');\n res.send('id,name,email,role,createdAt\\\\n');\n};\n`\n : `${RA}${exportMeta}${mwAdmin3}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: generate CSV of all users and stream response\n res.setHeader('Content-Type', 'text/csv');\n res.setHeader('Content-Disposition', 'attachment; filename=\"users.csv\"');\n res.send('id,name,email,role,createdAt\\\\n');\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'users', `export.${ext}`),\n exportContent,\n );\n }\n\n // ── Admins ────────────────────────────────────────────────────────────\n if (af.adminManagement) {\n // admin/admins/index.ts\n const adminsListMeta = mkMeta(opts, {\n GET: {\n description: 'List all admin accounts (admin only).',\n response: `{ admins: [], total: 0 }`,\n },\n POST: {\n description: 'Create a new admin account (admin only).',\n request: `{ name: 'Jane Doe', email: 'jane@example.com', role: 'admin' }`,\n response: `{ message: 'Admin created', admin: { id: 'new-id', name: 'Jane Doe', email: 'jane@example.com', role: 'admin' } }`,\n status: 201,\n },\n });\n const adminsListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${adminsListMeta}${mwAdmin3}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: fetch admins from DB\n res.json({ admins: [], total: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { name, email, role } = req.body;\n if (!name || !email) return res.status(400).json({ error: 'name and email are required' });\n // TODO: create admin account\n res.status(201).json({ message: 'Admin created', admin: { id: 'new-id', name, email, role: role ?? 'admin' } });\n};\n`\n : `${RA}${adminsListMeta}${mwAdmin3}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: fetch admins from DB\n res.json({ admins: [], total: 0 });\n};\n\nexport const POST = async (req, res) => {\n${roleGuard} const { name, email, role } = req.body;\n if (!name || !email) return res.status(400).json({ error: 'name and email are required' });\n // TODO: create admin account\n res.status(201).json({ message: 'Admin created', admin: { id: 'new-id', name, email, role: role ?? 'admin' } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'admins', `index.${ext}`),\n adminsListContent,\n );\n\n // admin/admins/[id].ts\n const adminByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Fetch a single admin account by ID (admin only).',\n params: `{ id: 'adm_01HXZ' }`,\n response: `{ admin: { id: 'adm_01HXZ' } }`,\n },\n PUT: {\n description: 'Update an admin account by ID (admin only).',\n params: `{ id: 'adm_01HXZ' }`,\n request: `{ name: 'Jane Doe', role: 'admin' }`,\n response: `{ message: 'Admin updated', admin: { id: 'adm_01HXZ', name: 'Jane Doe', role: 'admin' } }`,\n },\n DELETE: {\n description: 'Delete an admin account by ID (admin only).',\n params: `{ id: 'adm_01HXZ' }`,\n response: `{ message: 'Admin adm_01HXZ deleted' }`,\n },\n });\n const adminByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${adminByIdMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch admin by id\n res.json({ admin: { id } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: update admin record\n res.json({ message: 'Admin updated', admin: { id, ...req.body } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: delete admin\n res.json({ message: \\`Admin \\${id} deleted\\` });\n};\n`\n : `${RA}${adminByIdMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch admin by id\n res.json({ admin: { id } });\n};\n\nexport const PUT = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: update admin record\n res.json({ message: 'Admin updated', admin: { id, ...req.body } });\n};\n\nexport const DELETE = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: delete admin\n res.json({ message: \\`Admin \\${id} deleted\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'admins', `[id].${ext}`),\n adminByIdContent,\n );\n\n // ── Roles (rbac only) ─────────────────────────────────────────────────\n\n if (opts.rbac) {\n const rolesListMeta = mkMeta(opts, {\n GET: { description: 'List all roles (admin only).', response: `{ roles: [] }` },\n POST: {\n description: 'Create a new role (admin only).',\n request: `{ name: 'editor', description: 'Can edit content', permissions: ['content:write'] }`,\n response: `{ message: 'Role created', role: { id: 'new-id', name: 'editor', permissions: ['content:write'] } }`,\n status: 201,\n },\n });\n const rolesListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${rolesListMeta}${mwAdmin3}\nexport const GET = async (_req: Request, res: Response) => {\n // TODO: fetch all roles\n res.json({ roles: [] });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { name, description, permissions } = req.body;\n if (!name) return res.status(400).json({ error: 'name is required' });\n // TODO: create role\n res.status(201).json({ message: 'Role created', role: { id: 'new-id', name, permissions: permissions ?? [] } });\n};\n`\n : `${RA}${rolesListMeta}${mwAdmin3}\nexport const GET = async (_req, res) => {\n // TODO: fetch all roles\n res.json({ roles: [] });\n};\n\nexport const POST = async (req, res) => {\n const { name, description, permissions } = req.body;\n if (!name) return res.status(400).json({ error: 'name is required' });\n // TODO: create role\n res.status(201).json({ message: 'Role created', role: { id: 'new-id', name, permissions: permissions ?? [] } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'roles', `index.${ext}`),\n rolesListContent,\n );\n\n const roleByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Fetch a single role by ID (admin only).',\n params: `{ id: 'role_01HXZ' }`,\n response: `{ role: { id: 'role_01HXZ', name: 'editor', permissions: ['content:write'] } }`,\n },\n PUT: {\n description: 'Update a role by ID (admin only).',\n params: `{ id: 'role_01HXZ' }`,\n request: `{ name: 'editor', permissions: ['content:write'] }`,\n response: `{ message: 'Role updated', role: { id: 'role_01HXZ', name: 'editor', permissions: ['content:write'] } }`,\n },\n DELETE: {\n description: 'Delete a role by ID (admin only).',\n params: `{ id: 'role_01HXZ' }`,\n response: `{ message: 'Role role_01HXZ deleted' }`,\n },\n });\n const roleByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${roleByIdMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: fetch role by id\n res.json({ role: { id } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: update role\n res.json({ message: 'Role updated', role: { id, ...req.body } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: delete role\n res.json({ message: \\`Role \\${id} deleted\\` });\n};\n`\n : `${RA}${roleByIdMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n const { id } = req.params;\n // TODO: fetch role by id\n res.json({ role: { id } });\n};\n\nexport const PUT = async (req, res) => {\n const { id } = req.params;\n // TODO: update role\n res.json({ message: 'Role updated', role: { id, ...req.body } });\n};\n\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: delete role\n res.json({ message: \\`Role \\${id} deleted\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'roles', `[id].${ext}`),\n roleByIdContent,\n );\n }\n }\n\n // ── Notifications ─────────────────────────────────────────────────────\n if (af.notificationsAndLogs) {\n // admin/notifications/index.ts\n const adminNotifMeta = mkMeta(opts, {\n GET: {\n description: 'List all sent notifications (admin only).',\n response: `{ notifications: [], total: 0 }`,\n },\n POST: {\n description: 'Send a notification to a specific user (admin only).',\n request: `{ userId: 'usr_01HXZ', title: 'Welcome', message: 'Thanks for joining!', type: 'info' }`,\n response: `{ message: 'Notification sent' }`,\n status: 201,\n },\n });\n const adminNotifContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${adminNotifMeta}${mwAdmin3}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: fetch sent notifications\n res.json({ notifications: [], total: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { userId, title, message, type } = req.body;\n if (!userId || !title || !message) return res.status(400).json({ error: 'userId, title and message are required' });\n // TODO: create and send notification to user\n res.status(201).json({ message: 'Notification sent' });\n};\n`\n : `${RA}${adminNotifMeta}${mwAdmin3}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: fetch sent notifications\n res.json({ notifications: [], total: 0 });\n};\n\nexport const POST = async (req, res) => {\n${roleGuard} const { userId, title, message, type } = req.body;\n if (!userId || !title || !message) return res.status(400).json({ error: 'userId, title and message are required' });\n // TODO: create and send notification to user\n res.status(201).json({ message: 'Notification sent' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'notifications', `index.${ext}`),\n adminNotifContent,\n );\n\n // admin/notifications/broadcast.ts\n const broadcastMeta = mkMeta(opts, {\n POST: {\n description: 'Broadcast a notification to all users (admin only).',\n request: `{ title: 'Announcement', message: 'Hello everyone!', type: 'info' }`,\n response: `{ message: 'Broadcast sent', count: 0 }`,\n },\n });\n const broadcastContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${broadcastMeta}${mwAdmin3}\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { title, message, type } = req.body;\n if (!title || !message) return res.status(400).json({ error: 'title and message are required' });\n // TODO: send notification to all users\n res.json({ message: 'Broadcast sent', count: 0 });\n};\n`\n : `${RA}${broadcastMeta}${mwAdmin3}\nexport const POST = async (req, res) => {\n${roleGuard} const { title, message, type } = req.body;\n if (!title || !message) return res.status(400).json({ error: 'title and message are required' });\n // TODO: send notification to all users\n res.json({ message: 'Broadcast sent', count: 0 });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'notifications', `broadcast.${ext}`),\n broadcastContent,\n );\n\n // ── Logs ──────────────────────────────────────────────────────────────\n\n const mkLogContent = (label: string) => {\n const meta = mkMeta(opts, {\n GET: {\n description: `Paginated ${label} log entries (admin only).`,\n query: `{ page: '1', limit: '50' }`,\n response: `{ logs: [], total: 0, page: 1, limit: 50 }`,\n },\n });\n return ts\n ? `${RA}import type { Request, Response } from 'express';\n${meta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { page = 1, limit = 50 } = req.query;\n // TODO: fetch ${label} logs with pagination\n res.json({ logs: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`\n : `${RA}${meta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { page = 1, limit = 50 } = req.query;\n // TODO: fetch ${label} logs with pagination\n res.json({ logs: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`;\n };\n\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'logs', `audit.${ext}`),\n mkLogContent('audit'),\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'logs', `activity.${ext}`),\n mkLogContent('activity'),\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'logs', `security.${ext}`),\n mkLogContent('security'),\n );\n }\n\n // ── Settings & System ─────────────────────────────────────────────────\n if (af.systemSettings) {\n // admin/settings/index.ts\n const settingsMeta = mkMeta(opts, {\n GET: { description: 'Get system-wide settings (admin only).', response: `{ settings: {} }` },\n PUT: {\n description: 'Update system-wide settings (admin only).',\n request: `{ maintenanceMode: false }`,\n response: `{ message: 'Settings updated', settings: { maintenanceMode: false } }`,\n },\n });\n const settingsContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${settingsMeta}${mwAdmin3}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: fetch system settings from DB\n res.json({ settings: {} });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n${roleGuard} // TODO: update system settings\n res.json({ message: 'Settings updated', settings: req.body });\n};\n`\n : `${RA}${settingsMeta}${mwAdmin3}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: fetch system settings from DB\n res.json({ settings: {} });\n};\n\nexport const PUT = async (req, res) => {\n${roleGuard} // TODO: update system settings\n res.json({ message: 'Settings updated', settings: req.body });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'settings', `index.${ext}`),\n settingsContent,\n );\n\n // admin/system/health.ts\n const healthMeta = mkMeta(opts, {\n GET: {\n description: 'System health check: DB, queue, cache status (admin only).',\n response: `{ status: 'ok', db: 'ok', queue: 'ok', uptime: 12345 }`,\n },\n });\n const healthContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${healthMeta}${mwAdmin3}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: check DB connection, queue, cache health\n res.json({ status: 'ok', db: 'ok', queue: 'ok', uptime: process.uptime() });\n};\n`\n : `${RA}${healthMeta}${mwAdmin3}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: check DB connection, queue, cache health\n res.json({ status: 'ok', db: 'ok', queue: 'ok', uptime: process.uptime() });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'system', `health.${ext}`),\n healthContent,\n );\n\n // admin/system/cache.ts\n const cacheMeta = mkMeta(opts, {\n DELETE: {\n description: 'Flush the application cache (admin only).',\n response: `{ message: 'Cache cleared' }`,\n },\n });\n const cacheContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${cacheMeta}${mwAdmin3}\nexport const DELETE = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: flush Redis or in-memory cache\n res.json({ message: 'Cache cleared' });\n};\n`\n : `${RA}${cacheMeta}${mwAdmin3}\nexport const DELETE = async (_req, res) => {\n${roleGuard} // TODO: flush Redis or in-memory cache\n res.json({ message: 'Cache cleared' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'system', `cache.${ext}`),\n cacheContent,\n );\n }\n\n // ── Support Tickets (admin view) ──────────────────────────────────────\n if (af.supportManagement) {\n // admin/tickets/index.ts\n const adminTicketsListMeta = mkMeta(opts, {\n GET: {\n description: 'List all support tickets with filters (admin only).',\n query: `{ status: 'open', priority: 'normal', page: '1', limit: '20' }`,\n response: `{ tickets: [], total: 0, page: 1, limit: 20 }`,\n },\n });\n const adminTicketsListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${adminTicketsListMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { status, priority, page = 1, limit = 20 } = req.query;\n // TODO: fetch all tickets with filters\n res.json({ tickets: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`\n : `${RA}${adminTicketsListMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { status, priority, page = 1, limit = 20 } = req.query;\n // TODO: fetch all tickets with filters\n res.json({ tickets: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'tickets', `index.${ext}`),\n adminTicketsListContent,\n );\n\n // admin/tickets/[id].ts\n const adminTicketByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Fetch a single support ticket by ID (admin only).',\n params: `{ id: 'tk_01HXZ' }`,\n response: `{ ticket: { id: 'tk_01HXZ' } }`,\n },\n PUT: {\n description: 'Assign, reply to, or change the status of a support ticket (admin only).',\n params: `{ id: 'tk_01HXZ' }`,\n request: `{ reply: 'Looking into it.', status: 'in_progress', assignedTo: 'adm_01HXZ' }`,\n response: `{ message: 'Ticket updated', ticket: { id: 'tk_01HXZ', status: 'in_progress', assignedTo: 'adm_01HXZ' } }`,\n },\n });\n const adminTicketByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${adminTicketByIdMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch ticket by id\n res.json({ ticket: { id } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n const { reply, status, assignedTo } = req.body;\n // TODO: update ticket (assign, change status, add reply)\n res.json({ message: 'Ticket updated', ticket: { id, status, assignedTo } });\n};\n`\n : `${RA}${adminTicketByIdMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch ticket by id\n res.json({ ticket: { id } });\n};\n\nexport const PUT = async (req, res) => {\n${roleGuard} const { id } = req.params;\n const { reply, status, assignedTo } = req.body;\n // TODO: update ticket (assign, change status, add reply)\n res.json({ message: 'Ticket updated', ticket: { id, status, assignedTo } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'tickets', `[id].${ext}`),\n adminTicketByIdContent,\n );\n }\n\n // Shared by Content (FAQs/blogs/categories) and Billing (plans/coupons) below.\n const mkContentCrud = (name: string, namePlural: string, dir: string[], createFields: string) => {\n const lower = name.toLowerCase();\n const firstField = createFields.split(', ')[0];\n const sampleCreateBody = `{ ${createFields\n .split(', ')\n .map((f) => `${f}: 'sample-${f}'`)\n .join(', ')} }`;\n const sampleCreatedRecord = `{ id: 'new-id', ${firstField}: 'sample-${firstField}' }`;\n const sampleFullRecord = `{ id: '${lower}_01HXZ', ${createFields\n .split(', ')\n .map((f) => `${f}: 'sample-${f}'`)\n .join(', ')} }`;\n\n const listMeta = mkMeta(opts, {\n GET: {\n description: `List all ${namePlural} (admin only).`,\n response: `{ ${namePlural}: [], total: 0 }`,\n },\n POST: {\n description: `Create a new ${lower} (admin only).`,\n request: sampleCreateBody,\n response: `{ message: '${name} created', ${lower}: ${sampleCreatedRecord} }`,\n status: 201,\n },\n });\n const listContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${listMeta}${mwAdmin4}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: fetch ${namePlural}\n res.json({ ${namePlural}: [], total: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { ${createFields} } = req.body;\n // TODO: create ${name}\n res.status(201).json({ message: '${name} created', ${lower}: { id: 'new-id', ${firstField} } });\n};\n`\n : `${RA}${listMeta}${mwAdmin4}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: fetch ${namePlural}\n res.json({ ${namePlural}: [], total: 0 });\n};\n\nexport const POST = async (req, res) => {\n${roleGuard} const { ${createFields} } = req.body;\n // TODO: create ${name}\n res.status(201).json({ message: '${name} created', ${lower}: { id: 'new-id' } });\n};\n`;\n const byIdMeta = mkMeta(opts, {\n GET: {\n description: `Fetch a single ${lower} by ID (admin only).`,\n params: `{ id: '${lower}_01HXZ' }`,\n response: `{ ${lower}: ${sampleFullRecord} }`,\n },\n PUT: {\n description: `Update a ${lower} by ID (admin only).`,\n params: `{ id: '${lower}_01HXZ' }`,\n request: sampleCreateBody,\n response: `{ message: '${name} updated', ${lower}: ${sampleFullRecord} }`,\n },\n DELETE: {\n description: `Delete a ${lower} by ID (admin only).`,\n params: `{ id: '${lower}_01HXZ' }`,\n response: `{ message: '${name} ${lower}_01HXZ deleted' }`,\n },\n });\n const byIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${byIdMeta}${mwAdmin4}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch ${name} by id\n res.json({ ${lower}: { id } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: update ${name}\n res.json({ message: '${name} updated', ${lower}: { id, ...req.body } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: delete ${name}\n res.json({ message: \\`${name} \\${id} deleted\\` });\n};\n`\n : `${RA}${byIdMeta}${mwAdmin4}\nexport const GET = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch ${name} by id\n res.json({ ${lower}: { id } });\n};\n\nexport const PUT = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: update ${name}\n res.json({ message: '${name} updated', ${lower}: { id, ...req.body } });\n};\n\nexport const DELETE = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: delete ${name}\n res.json({ message: \\`${name} \\${id} deleted\\` });\n};\n`;\n return { listContent, byIdContent };\n };\n\n // ── Content ───────────────────────────────────────────────────────────\n if (af.contentManagement) {\n const { listContent: faqList, byIdContent: faqById } = mkContentCrud(\n 'FAQ',\n 'faqs',\n [],\n 'question, answer, category',\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'content', 'faqs', `index.${ext}`),\n faqList,\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'content', 'faqs', `[id].${ext}`),\n faqById,\n );\n\n const { listContent: blogList, byIdContent: blogById } = mkContentCrud(\n 'Blog',\n 'blogs',\n [],\n 'title, slug, content',\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'content', 'blogs', `index.${ext}`),\n blogList,\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'content', 'blogs', `[id].${ext}`),\n blogById,\n );\n\n const { listContent: catList, byIdContent: catById } = mkContentCrud(\n 'Category',\n 'categories',\n [],\n 'name, slug',\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'content', 'categories', `index.${ext}`),\n catList,\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'content', 'categories', `[id].${ext}`),\n catById,\n );\n }\n\n // ── Billing (admin) ───────────────────────────────────────────────────\n if (af.billingManagement) {\n const { listContent: planList, byIdContent: planById } = mkContentCrud(\n 'Plan',\n 'plans',\n [],\n 'name, price, interval',\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'billing', 'plans', `index.${ext}`),\n planList,\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'billing', 'plans', `[id].${ext}`),\n planById,\n );\n\n const { listContent: couponList, byIdContent: couponById } = mkContentCrud(\n 'Coupon',\n 'coupons',\n [],\n 'code, type, value',\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'billing', 'coupons', `index.${ext}`),\n couponList,\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'billing', 'coupons', `[id].${ext}`),\n couponById,\n );\n\n // admin/billing/subscriptions/index.ts\n const adminSubsMeta = mkMeta(opts, {\n GET: {\n description: 'List all subscriptions with filters (admin only).',\n query: `{ status: 'active', page: '1', limit: '20' }`,\n response: `{ subscriptions: [], total: 0, page: 1, limit: 20 }`,\n },\n });\n const adminSubsContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${adminSubsMeta}${mwAdmin4}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { status, page = 1, limit = 20 } = req.query;\n // TODO: fetch all subscriptions with filters\n res.json({ subscriptions: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`\n : `${RA}${adminSubsMeta}${mwAdmin4}\nexport const GET = async (req, res) => {\n${roleGuard} const { status, page = 1, limit = 20 } = req.query;\n // TODO: fetch all subscriptions with filters\n res.json({ subscriptions: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'billing', 'subscriptions', `index.${ext}`),\n adminSubsContent,\n );\n }\n}\n"],"mappings":";;;AAAA,YAAY,OAAO;AACnB,OAAO,QAAQ;AACf,SAAS,aAAa;;;ACFtB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,YAAY;AAyBZ,IAAM,oBAAmC;AAAA,EAC9C,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,sBAAsB;AAAA,EACtB,gBAAgB;AAClB;AAEO,IAAM,mBAAiC;AAAA,EAC5C,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EACf,SAAS;AACX;AAwBA,eAAsB,SAAS,MAAsC;AACnE,QAAM,OAAO,KAAK,QAAQ,QAAQ,IAAI,GAAG,KAAK,WAAW;AACzD,QAAM,GAAG,UAAU,IAAI;AAEvB,QAAM,KAAK,KAAK;AAChB,QAAM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iB,EAAE,MAAM,MAAM;AAAA,EAAkB,CAAC;AACxD,EAAAA,SAAQ,KAAK,eAAe;AAE5B,MAAI,KAAK,QAAQ;AACf,IAAE;AAAA,MACA,2CAA2C,WAAqB;AAAA,KAC7D,KAAK,iBAAiB,UACnB,6EACA;AAAA,MACN;AAAA,IACF;AAAA,EACF;AAEA,EAAE;AAAA,IACA,GAAG,MAAM;AAAA;AAAA;AAAA,CAA8B,IACrC,GAAG,IAAI,QAAQ,WAAqB;AAAA,CAAI,IACxC,GAAG,IAAI;AAAA,CAAmB,IAC1B,GAAG,IAAI;AAAA;AAAA,CAAyB;AAAA,EACpC;AACF;AAEA,SAAS,WAAW,YAAmC;AACrD,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,QAAQ,MAAM,OAAO,CAAC,SAAS,GAAG,EAAE,KAAK,YAAY,OAAO,SAAS,CAAC;AAC5E,UAAM,GAAG,QAAQ,CAAC,SAAU,SAAS,IAAI,QAAQ,IAAI,OAAO,IAAI,MAAM,oBAAoB,CAAC,CAAE;AAAA,EAC/F,CAAC;AACH;AAEA,SAAS,mBAAkC;AACzC,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,QAAQ,MAAM,OAAO,CAAC,WAAW,MAAM,sBAAsB,GAAG,EAAE,OAAO,SAAS,CAAC;AACzF,UAAM,GAAG,QAAQ,CAAC,SAAU,SAAS,IAAI,QAAQ,IAAI,OAAO,IAAI,MAAM,uBAAuB,CAAC,CAAE;AAAA,EAClG,CAAC;AACH;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,MAAM,GAAG;AACjB,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["cancel","spinner"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/scaffold.ts"],"sourcesContent":["import * as p from '@clack/prompts';\nimport pc from 'picocolors';\nimport { spawn } from 'node:child_process';\nimport { scaffold, type ScaffoldOptions, type AdminFeatures, type UserFeatures, NO_ADMIN_FEATURES, NO_USER_FEATURES } from './scaffold.js';\n\nfunction cancel(msg = 'Cancelled'): never {\n p.cancel(msg);\n process.exit(0);\n}\n\nasync function main(): Promise<void> {\n console.log();\n p.intro(pc.bgCyan(pc.black(' create-efc-app ')));\n\n const projectName = await p.text({\n message: 'Project name:',\n placeholder: 'my-api',\n defaultValue: 'my-api',\n validate: (v) => (!v.trim() ? 'Project name is required' : undefined),\n });\n if (p.isCancel(projectName)) cancel();\n\n const language = await p.select({\n message: 'Language:',\n options: [\n { value: 'typescript', label: 'TypeScript', hint: 'recommended' },\n { value: 'javascript', label: 'JavaScript' },\n ],\n });\n if (p.isCancel(language)) cancel();\n\n const database = await p.select({\n message: 'Database:',\n options: [\n { value: 'mongodb', label: 'MongoDB', hint: 'Mongoose' },\n { value: 'postgresql', label: 'PostgreSQL', hint: 'Drizzle ORM' },\n ],\n });\n if (p.isCancel(database)) cancel();\n\n const authStrategy = await p.select({\n message: 'Authentication strategy:',\n options: [\n { value: 'http-only', label: 'http-only', hint: 'secure cookie — recommended for SSR' },\n { value: 'localStorage', label: 'localStorage', hint: 'bearer token — for SPAs' },\n ],\n });\n if (p.isCancel(authStrategy)) cancel();\n\n const features = await p.multiselect({\n message: 'Features: (space to toggle, enter to confirm)',\n options: [\n { value: 'cluster', label: 'Multi-core clustering', hint: 'Node cluster module' },\n { value: 'tasks', label: 'Background tasks', hint: 'BullMQ / pg-boss' },\n { value: 'routeDocs', label: 'API route documentation', hint: 'meta exports + dashboard' },\n { value: 'userPortal', label: 'User portal', hint: 'auth, profile, billing routes' },\n { value: 'adminPortal',label: 'Admin portal', hint: 'dashboard, user mgmt, analytics' },\n { value: 'rbac', label: 'Role-based access control', hint: \"requireAuth('role') middleware\" },\n { value: 'mailer', label: 'Mailer', hint: 'nodemailer + SMTP' },\n ],\n initialValues: ['cluster', 'tasks', 'routeDocs', 'userPortal', 'adminPortal', 'rbac'],\n required: false,\n });\n if (p.isCancel(features)) cancel();\n\n const selected = new Set(features as string[]);\n\n let userFeatures: UserFeatures = NO_USER_FEATURES;\n if (selected.has('userPortal')) {\n const chosen = await p.multiselect({\n message: 'User portal features: (space to toggle, enter to confirm)',\n options: [\n { value: 'profileViewing', label: 'Profile viewing & editing', hint: 'GET/PUT /user/profile' },\n { value: 'forgotPassword', label: 'Forgot / reset password', hint: 'forgot-password, reset-password' },\n { value: 'accountSecurity', label: 'Change password, 2FA & sessions', hint: 'change-password, 2fa/*, sessions/*, token refresh' },\n { value: 'emailVerification',label: 'Email verification', hint: 'verify-email route + registration flow' },\n { value: 'accountSettings', label: 'Account settings', hint: 'avatar, settings, account, dashboard, activity' },\n { value: 'notifications', label: 'Notifications', hint: 'user/notifications' },\n { value: 'filesAndMedia', label: 'Files, favorites & bookmarks', hint: 'files, favorites, bookmarks, search' },\n { value: 'apiAndBilling', label: 'API keys & billing', hint: 'api-keys, plans, subscription, invoices' },\n { value: 'support', label: 'Support tickets', hint: 'create & view own tickets' },\n ],\n initialValues: ['profileViewing', 'forgotPassword', 'accountSecurity', 'emailVerification', 'accountSettings', 'notifications', 'filesAndMedia', 'apiAndBilling', 'support'],\n required: false,\n });\n if (p.isCancel(chosen)) cancel();\n const uSet = new Set(chosen as string[]);\n userFeatures = {\n profileViewing: uSet.has('profileViewing'),\n forgotPassword: uSet.has('forgotPassword'),\n accountSecurity: uSet.has('accountSecurity'),\n emailVerification: uSet.has('emailVerification'),\n accountSettings: uSet.has('accountSettings'),\n notifications: uSet.has('notifications'),\n filesAndMedia: uSet.has('filesAndMedia'),\n apiAndBilling: uSet.has('apiAndBilling'),\n support: uSet.has('support'),\n };\n }\n\n let adminFeatures: AdminFeatures = NO_ADMIN_FEATURES;\n if (selected.has('adminPortal')) {\n const chosen = await p.multiselect({\n message: 'Admin panel features: (space to toggle, enter to confirm)',\n options: [\n { value: 'userManagement', label: 'User management', hint: 'list/create/suspend/verify/export users + dashboard stats' },\n { value: 'adminManagement', label: 'Admin & role management', hint: 'manage other admins' + (selected.has('rbac') ? ' + roles' : '') },\n { value: 'analytics', label: 'Analytics', hint: 'users, revenue, traffic dashboards' },\n { value: 'contentManagement', label: 'Content management', hint: 'FAQs, blog posts, categories' },\n { value: 'billingManagement', label: 'Billing management', hint: 'plans, coupons, subscriptions' },\n { value: 'supportManagement', label: 'Support tickets', hint: 'view & respond to tickets' },\n { value: 'notificationsAndLogs', label: 'Notifications & audit logs', hint: 'broadcast + audit/activity/security logs' },\n { value: 'systemSettings', label: 'System settings & health', hint: 'app settings, health check, cache' },\n ],\n initialValues: ['userManagement', 'adminManagement', 'analytics', 'contentManagement', 'billingManagement', 'supportManagement', 'notificationsAndLogs', 'systemSettings'],\n required: false,\n });\n if (p.isCancel(chosen)) cancel();\n const aSet = new Set(chosen as string[]);\n adminFeatures = {\n userManagement: aSet.has('userManagement'),\n adminManagement: aSet.has('adminManagement'),\n analytics: aSet.has('analytics'),\n contentManagement: aSet.has('contentManagement'),\n billingManagement: aSet.has('billingManagement'),\n supportManagement: aSet.has('supportManagement'),\n notificationsAndLogs: aSet.has('notificationsAndLogs'),\n systemSettings: aSet.has('systemSettings'),\n };\n }\n\n let taskBackend: ScaffoldOptions['taskBackend'];\n if (selected.has('tasks')) {\n const backend = await p.select({\n message: 'Task queue backend:',\n options: [\n { value: 'bullmq', label: 'BullMQ', hint: 'Redis' },\n { value: 'pg-boss', label: 'pg-boss', hint: 'PostgreSQL' },\n ],\n });\n if (p.isCancel(backend)) cancel();\n taskBackend = backend as ScaffoldOptions['taskBackend'];\n }\n\n let smtpProvider: ScaffoldOptions['smtpProvider'];\n let smtpHost: string | undefined;\n let smtpPort: string | undefined;\n let smtpUser: string | undefined;\n let smtpPass: string | undefined;\n if (selected.has('mailer')) {\n const provider = await p.select({\n message: 'Email provider:',\n options: [\n { value: 'gmail', label: 'Gmail', hint: 'smtp.gmail.com, preconfigured' },\n { value: 'custom', label: 'Other (custom SMTP)', hint: \"you'll provide host + port\" },\n ],\n });\n if (p.isCancel(provider)) cancel();\n smtpProvider = provider as ScaffoldOptions['smtpProvider'];\n\n if (smtpProvider === 'custom') {\n const host = await p.text({\n message: 'SMTP host:',\n placeholder: 'smtp.mailtrap.io',\n validate: (v) => (!v.trim() ? 'SMTP host is required' : undefined),\n });\n if (p.isCancel(host)) cancel();\n smtpHost = host as string;\n\n const port = await p.text({\n message: 'SMTP port:',\n placeholder: '587',\n defaultValue: '587',\n });\n if (p.isCancel(port)) cancel();\n smtpPort = port as string;\n }\n\n const user = await p.text({\n message: smtpProvider === 'gmail' ? 'Gmail address:' : 'SMTP username / email:',\n placeholder: 'you@example.com',\n validate: (v) => (!v.trim() ? 'Email is required' : undefined),\n });\n if (p.isCancel(user)) cancel();\n smtpUser = user as string;\n\n if (smtpProvider === 'gmail') {\n p.note(\n 'Google no longer accepts your regular account password for SMTP.\\n' +\n \"Generate a 16-character App Password: Google Account -> Security -> 2-Step Verification -> App passwords.\\n\" +\n \"Enter it below without spaces (not your Gmail login password).\",\n 'Gmail app password required',\n );\n }\n\n const pass = await p.password({\n message: smtpProvider === 'gmail' ? 'Gmail app password (16 characters):' : 'SMTP password:',\n validate: (v) => {\n if (!v.trim()) return 'Password is required';\n if (smtpProvider === 'gmail' && v.replace(/\\s/g, '').length !== 16) {\n return 'Gmail app passwords are 16 characters — this looks like a regular password, not an app password';\n }\n return undefined;\n },\n });\n if (p.isCancel(pass)) cancel();\n smtpPass = (pass as string).replace(/\\s/g, '');\n }\n\n const opts: ScaffoldOptions = {\n projectName: projectName as string,\n language: language as ScaffoldOptions['language'],\n database: database as ScaffoldOptions['database'],\n authStrategy: authStrategy as ScaffoldOptions['authStrategy'],\n cluster: selected.has('cluster'),\n tasks: selected.has('tasks'),\n routeDocs: selected.has('routeDocs'),\n userPortal: selected.has('userPortal'),\n adminPortal: selected.has('adminPortal'),\n userFeatures,\n adminFeatures,\n rbac: selected.has('rbac'),\n mailer: selected.has('mailer'),\n ...(taskBackend !== undefined && { taskBackend }),\n ...(smtpProvider !== undefined && { smtpProvider }),\n ...(smtpHost !== undefined && { smtpHost }),\n ...(smtpPort !== undefined && { smtpPort }),\n ...(smtpUser !== undefined && { smtpUser }),\n ...(smtpPass !== undefined && { smtpPass }),\n };\n\n const spinner = p.spinner();\n spinner.start('Scaffolding project…');\n\n try {\n await scaffold(opts);\n spinner.stop('Project created');\n } catch (err) {\n spinner.stop('Failed to scaffold project');\n console.error(err);\n process.exit(1);\n }\n\n spinner.start('Installing dependencies…');\n await npmInstall(projectName as string);\n spinner.stop('Dependencies installed');\n\n spinner.start('Installing efc CLI globally…');\n await npmInstallGlobal().catch(() => { /* non-fatal */ });\n spinner.stop('efc CLI ready');\n\n if (opts.mailer) {\n p.note(\n `SMTP_USER and SMTP_PASS were written to ${projectName as string}/.env — that file is gitignored, never commit it.\\n` +\n (opts.smtpProvider === 'gmail'\n ? 'If this Gmail app password ever leaks, revoke it and generate a new one.'\n : 'Rotate SMTP_PASS immediately if it is ever exposed.'),\n 'Mailer credentials',\n );\n }\n\n p.outro(\n pc.green(`\\nYour project is ready!\\n\\n`) +\n pc.dim(` cd ${projectName as string}\\n`) +\n pc.dim(` efc start dev\\n`) +\n pc.dim(`\\n (or: npm run dev)\\n`),\n );\n}\n\nfunction npmInstall(projectDir: string): Promise<void> {\n return new Promise((resolve, reject) => {\n const child = spawn('npm', ['install'], { cwd: projectDir, stdio: 'ignore' });\n child.on('exit', (code) => (code === 0 ? resolve() : reject(new Error('npm install failed'))));\n });\n}\n\nfunction npmInstallGlobal(): Promise<void> {\n return new Promise((resolve, reject) => {\n const child = spawn('npm', ['install', '-g', 'express-file-cluster'], { stdio: 'ignore' });\n child.on('exit', (code) => (code === 0 ? resolve() : reject(new Error('global install failed'))));\n });\n}\n\nmain().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n","import fs from 'fs-extra';\nimport path from 'node:path';\nimport crypto from 'node:crypto';\n\nexport interface AdminFeatures {\n userManagement: boolean;\n adminManagement: boolean;\n analytics: boolean;\n contentManagement: boolean;\n billingManagement: boolean;\n supportManagement: boolean;\n notificationsAndLogs: boolean;\n systemSettings: boolean;\n}\n\nexport interface UserFeatures {\n profileViewing: boolean;\n forgotPassword: boolean;\n accountSecurity: boolean;\n emailVerification: boolean;\n accountSettings: boolean;\n notifications: boolean;\n filesAndMedia: boolean;\n apiAndBilling: boolean;\n support: boolean;\n}\n\nexport const NO_ADMIN_FEATURES: AdminFeatures = {\n userManagement: false,\n adminManagement: false,\n analytics: false,\n contentManagement: false,\n billingManagement: false,\n supportManagement: false,\n notificationsAndLogs: false,\n systemSettings: false,\n};\n\nexport const NO_USER_FEATURES: UserFeatures = {\n profileViewing: false,\n forgotPassword: false,\n accountSecurity: false,\n emailVerification: false,\n accountSettings: false,\n notifications: false,\n filesAndMedia: false,\n apiAndBilling: false,\n support: false,\n};\n\nexport interface ScaffoldOptions {\n projectName: string;\n language: 'typescript' | 'javascript';\n database: 'mongodb' | 'postgresql';\n authStrategy: 'http-only' | 'localStorage';\n cluster: boolean;\n tasks: boolean;\n taskBackend?: 'bullmq' | 'pg-boss';\n routeDocs: boolean;\n userPortal: boolean;\n adminPortal: boolean;\n adminFeatures: AdminFeatures;\n userFeatures: UserFeatures;\n rbac: boolean;\n mailer: boolean;\n smtpProvider?: 'gmail' | 'custom';\n smtpHost?: string;\n smtpPort?: string;\n smtpUser?: string;\n smtpPass?: string;\n}\n\nexport async function scaffold(opts: ScaffoldOptions): Promise<void> {\n const dest = path.resolve(process.cwd(), opts.projectName);\n await fs.ensureDir(dest);\n\n const uf = opts.userFeatures;\n const af = opts.adminFeatures;\n // Admin \"user management\" operates on the User collection even when there's\n // no separate self-service user portal, so the model must exist for it too.\n const needsUserModel = opts.userPortal || (opts.adminPortal && af.userManagement);\n\n await writePackageJson(dest, opts);\n await writeTsConfig(dest, opts);\n await writeEfcConfig(dest, opts);\n await writeEntryPoint(dest, opts);\n await writeGitignore(dest);\n await writeEnvFiles(dest, opts);\n await writeExampleRoute(dest, opts);\n if (needsUserModel) await writeUserModel(dest, opts);\n if (opts.adminPortal) await writeAdminModel(dest, opts);\n await writeAuthRoutes(dest, opts);\n if (opts.adminPortal) await writeAdminRoutes(dest, opts);\n if (opts.userPortal && uf.profileViewing) await writeUserRoutes(dest, opts);\n if (opts.tasks) await writeExampleTask(dest, opts);\n // Extended models — only generated when a feature that uses them is selected\n if (opts.userPortal && uf.accountSecurity) await writeSessionModel(dest, opts);\n if ((opts.userPortal && uf.notifications) || (opts.adminPortal && af.notificationsAndLogs))\n await writeNotificationModel(dest, opts);\n if (opts.userPortal && uf.filesAndMedia) await writeFileModel(dest, opts);\n if ((opts.userPortal && uf.support) || (opts.adminPortal && af.supportManagement))\n await writeSupportTicketModel(dest, opts);\n if (opts.adminPortal && af.notificationsAndLogs) await writeAuditLogModel(dest, opts);\n if (opts.userPortal && uf.apiAndBilling) await writeSubscriptionModel(dest, opts);\n if (opts.adminPortal && af.billingManagement) await writePlanModel(dest, opts);\n if (opts.userPortal && uf.apiAndBilling) await writeInvoiceModel(dest, opts);\n if (opts.userPortal && uf.apiAndBilling) await writeApiKeyModel(dest, opts);\n if (opts.rbac && opts.adminPortal && af.adminManagement) await writeRoleModel(dest, opts);\n if (opts.adminPortal && af.contentManagement) await writeFAQModel(dest, opts);\n if (opts.adminPortal && af.contentManagement) await writeBlogModel(dest, opts);\n if (opts.adminPortal && af.contentManagement) await writeCategoryModel(dest, opts);\n if (opts.adminPortal && af.billingManagement) await writeCouponModel(dest, opts);\n // Extended routes — gated by the same per-feature flags as their models\n if (opts.userPortal) await writeAuthExtendedRoutes(dest, opts);\n if (opts.userPortal) await writeUserExtendedRoutes(dest, opts);\n if (opts.userPortal && uf.apiAndBilling) await writeUserBillingRoutes(dest, opts);\n if (opts.userPortal && uf.support) await writeSupportRoutes(dest, opts);\n if (opts.adminPortal) await writeAdminExtendedRoutes(dest, opts);\n}\n\nasync function writePackageJson(dest: string, opts: ScaffoldOptions): Promise<void> {\n const deps: Record<string, string> = {\n 'express-file-cluster': '^0.3.0',\n };\n if (opts.database === 'mongodb') deps['mongoose'] = '^8.0.0';\n if (opts.database === 'postgresql') {\n deps['pg'] = '^8.0.0';\n deps['drizzle-orm'] = '^0.33.0';\n }\n if (opts.tasks && opts.taskBackend === 'bullmq') deps['bullmq'] = '^5.0.0';\n if (opts.tasks && opts.taskBackend === 'pg-boss') deps['pg-boss'] = '^10.0.0';\n if (opts.mailer) deps['nodemailer'] = '^6.9.0';\n if (opts.database === 'mongodb') deps['bcrypt'] = '^5.1.0';\n\n const devDeps: Record<string, string> = {\n vitest: '^4.1.9',\n };\n if (opts.language === 'typescript') {\n devDeps['typescript'] = '^5.5.0';\n devDeps['@types/node'] = '^22.0.0';\n devDeps['@types/express'] = '^4.17.21';\n devDeps['tsup'] = '^8.2.0';\n devDeps['tsx'] = '^4.0.0';\n if (opts.mailer) devDeps['@types/nodemailer'] = '^6.4.0';\n if (opts.database === 'mongodb') devDeps['@types/bcrypt'] = '^5.0.0';\n }\n\n const pkg = {\n name: opts.projectName,\n version: '0.1.0',\n type: 'module',\n scripts: {\n dev: 'efc start dev',\n build: 'efc build prod',\n start: 'efc start prod',\n test: 'efc run tests',\n },\n dependencies: deps,\n devDependencies: devDeps,\n };\n\n await fs.writeJson(path.join(dest, 'package.json'), pkg, { spaces: 2 });\n}\n\nasync function writeTsConfig(dest: string, opts: ScaffoldOptions): Promise<void> {\n if (opts.language !== 'typescript') return;\n const config = {\n compilerOptions: {\n target: 'ES2022',\n module: 'NodeNext',\n moduleResolution: 'NodeNext',\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n outDir: './dist',\n },\n // No explicit rootDir: efc.config.ts lives at the project root, outside src/, and\n // src/index.ts imports it. `efc build prod` only uses this config for `tsc --noEmit`\n // typechecking — the actual dist/index.js output path is decided by tsup's entry arg,\n // so leaving rootDir implicit here has no effect on the production build's output layout.\n include: ['src/**/*', 'efc.config.ts'],\n exclude: ['node_modules', 'dist'],\n };\n await fs.writeJson(path.join(dest, 'tsconfig.json'), config, { spaces: 2 });\n}\n\nasync function writeEfcConfig(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const tasks = opts.tasks\n ? `{ backend: '${opts.taskBackend ?? 'bullmq'}', concurrency: 5, redisUrl: process.env.REDIS_URL }`\n : 'false';\n\n const content = `import type { EFCConfig } from 'express-file-cluster';\n\n// The framework never reads process.env itself — every runtime value it needs is read\n// here, explicitly, and passed in. Edit .env to change values; edit this file to change\n// which env vars are wired up or add new ones.\nconst corsOrigins = process.env.CORS_ORIGINS\n ? process.env.CORS_ORIGINS.split(',').map((o) => o.trim()).filter(Boolean)\n : undefined;\n\nconst config: EFCConfig = {\n port: process.env.PORT ? Number(process.env.PORT) : undefined,\n databaseUrl: process.env.DATABASE_URL,\n jwtSecret: process.env.JWT_SECRET,\n jwtExpiresIn: process.env.JWT_EXPIRES_IN,\n cookieDomain: process.env.COOKIE_DOMAIN,\n cors: corsOrigins ? { origin: corsOrigins } : true,\n authStrategy: '${opts.authStrategy}',\n tasks: ${tasks},\n globalMiddlewares: [],\n};\n\nexport default config;\n`;\n await fs.outputFile(path.join(dest, `efc.config.${ext}`), content);\n}\n\nasync function writeEntryPoint(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const content = `import { ignite, gracefulShutdown } from 'express-file-cluster';\nimport config from '../efc.config.js';\n\n// Every runtime value (PORT, DATABASE_URL, JWT_SECRET, CORS_ORIGINS, ...) is wired from\n// .env in efc.config.${ext} and spread in below — ignite() itself never touches process.env\n// for these, so this object is the single source of truth for what's actually applied.\nignite({\n ...config,\n cluster: ${opts.cluster},\n}).then(gracefulShutdown).catch(console.error);\n`;\n await fs.outputFile(path.join(dest, 'src', `index.${ext}`), content);\n}\n\nasync function writeGitignore(dest: string): Promise<void> {\n await fs.outputFile(\n path.join(dest, '.gitignore'),\n 'node_modules/\\ndist/\\n.env\\n.env.local\\n*.log\\n',\n );\n}\n\nasync function writeEnvFiles(dest: string, opts: ScaffoldOptions): Promise<void> {\n const secret = crypto.randomBytes(64).toString('hex');\n const projectName = path.basename(dest);\n const dbUrl =\n opts.database === 'mongodb'\n ? `mongodb://localhost:27017/${projectName}`\n : `postgresql://localhost:5432/${projectName}`;\n const dbExampleUrl =\n opts.database === 'mongodb'\n ? `mongodb://localhost:27017/${projectName}`\n : `postgresql://user:password@localhost:5432/${projectName}`;\n\n const isGmail = opts.mailer && opts.smtpProvider !== 'custom';\n const resolvedHost = isGmail ? 'smtp.gmail.com' : (opts.smtpHost ?? 'smtp.gmail.com');\n const resolvedPort = isGmail ? '465' : (opts.smtpPort ?? '587');\n const passComment = isGmail\n ? ' # Gmail App Password (16 chars) — NOT your regular Gmail password. Generate at: Google Account > Security > 2-Step Verification > App passwords'\n : '';\n\n const smtpVars = opts.mailer\n ? `\\nAPP_URL=http://localhost:3000\\nSMTP_HOST=${resolvedHost}\\nSMTP_PORT=${resolvedPort}\\nSMTP_USER=${opts.smtpUser ?? ''}\\nSMTP_PASS=${opts.smtpPass ?? ''}${passComment}\\nSMTP_FROM=${opts.smtpUser ?? 'noreply@example.com'}\\n`\n : '';\n const smtpExample = opts.mailer\n ? `\\nAPP_URL=http://localhost:3000\\nSMTP_HOST=${resolvedHost}\\nSMTP_PORT=${resolvedPort}\\nSMTP_USER=your@email.com\\nSMTP_PASS=${isGmail ? 'your_16_char_app_password' : 'your_smtp_password'}${passComment}\\nSMTP_FROM=noreply@yourapp.com\\n`\n : '';\n const dotenv = `PORT=3000\\nNODE_ENV=development\\nDATABASE_URL=${dbUrl}\\nJWT_SECRET=${secret}\\nREDIS_URL=redis://localhost:6379\\nCORS_ORIGINS=http://localhost:3000${smtpVars}`;\n const example = `PORT=3000\\nNODE_ENV=development\\nDATABASE_URL=${dbExampleUrl}\\nJWT_SECRET=<generate with: openssl rand -hex 64>\\nREDIS_URL=redis://localhost:6379\\nCORS_ORIGINS=http://localhost:3000,https://yourapp.com${smtpExample}`;\n await fs.outputFile(path.join(dest, '.env'), dotenv);\n await fs.outputFile(path.join(dest, '.env.example'), example);\n}\n\nasync function writeExampleRoute(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const metaTs = opts.routeDocs\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n GET: {\\n description: 'Health check — returns server status and current timestamp.',\\n response: { status: 200, body: { status: 'OK', timestamp: '2024-01-01T00:00:00.000Z' } },\\n },\\n};\\n\\n`\n : '';\n const metaJs = opts.routeDocs\n ? `export const meta = {\\n GET: {\\n description: 'Health check — returns server status and current timestamp.',\\n response: { status: 200, body: { status: 'OK', timestamp: '2024-01-01T00:00:00.000Z' } },\\n },\\n};\\n\\n`\n : '';\n const content =\n opts.language === 'typescript'\n ? `import type { Request, Response } from 'express';\\n${metaTs}export const GET = async (_req: Request, res: Response) => {\\n res.json({ status: 'OK', timestamp: new Date().toISOString() });\\n};\\n`\n : `${metaJs}export const GET = async (_req, res) => {\\n res.json({ status: 'OK', timestamp: new Date().toISOString() });\\n};\\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', `health.${ext}`), content);\n}\n\nasync function writeExampleTask(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n\n const tsMailer = `import { defineTask } from 'express-file-cluster/tasks';\nimport nodemailer from 'nodemailer';\n\ninterface SendEmailPayload {\n to: string;\n subject: string;\n body: string;\n}\n\nconst transporter = nodemailer.createTransport({\n host: process.env.SMTP_HOST,\n port: Number(process.env.SMTP_PORT ?? 587),\n secure: Number(process.env.SMTP_PORT) === 465,\n auth: {\n user: process.env.SMTP_USER,\n pass: process.env.SMTP_PASS,\n },\n});\n\nexport default defineTask<SendEmailPayload>(async (payload) => {\n await transporter.sendMail({\n from: process.env.SMTP_FROM ?? process.env.SMTP_USER,\n to: payload.to,\n subject: payload.subject,\n html: payload.body,\n });\n});\n`;\n\n const jsMailer = `import { defineTask } from 'express-file-cluster/tasks';\nimport nodemailer from 'nodemailer';\n\nconst transporter = nodemailer.createTransport({\n host: process.env.SMTP_HOST,\n port: Number(process.env.SMTP_PORT ?? 587),\n secure: Number(process.env.SMTP_PORT) === 465,\n auth: {\n user: process.env.SMTP_USER,\n pass: process.env.SMTP_PASS,\n },\n});\n\nexport default defineTask(async (payload) => {\n await transporter.sendMail({\n from: process.env.SMTP_FROM ?? process.env.SMTP_USER,\n to: payload.to,\n subject: payload.subject,\n html: payload.body,\n });\n});\n`;\n\n const tsStub = `import { defineTask } from 'express-file-cluster/tasks';\n\ninterface SendEmailPayload {\n to: string;\n subject: string;\n body: string;\n}\n\nexport default defineTask<SendEmailPayload>(async (payload) => {\n // TODO: wire up your mailer\n console.log('[SendEmail] Sending to', payload.to);\n});\n`;\n\n const jsStub = `import { defineTask } from 'express-file-cluster/tasks';\n\nexport default defineTask(async (payload) => {\n // TODO: wire up your mailer\n console.log('[SendEmail] Sending to', payload.to);\n});\n`;\n\n const content = opts.mailer\n ? opts.language === 'typescript'\n ? tsMailer\n : jsMailer\n : opts.language === 'typescript'\n ? tsStub\n : jsStub;\n\n await fs.outputFile(path.join(dest, 'src', 'tasks', `SendEmail.${ext}`), content);\n}\n\nasync function writeUserModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface UserDocument {\n name: string;\n email: string;\n password: string;\n role: string;\n avatar?: string;\n isVerified: boolean;\n isActive: boolean;\n verifyToken?: string;\n resetToken?: string;\n resetTokenExpiry?: Date;\n refreshToken?: string;\n refreshTokenExpiry?: Date;\n}\n\nexport const User = defineModel<UserDocument>('User', {\n name: { type: 'string', required: true },\n email: { type: 'string', required: true, unique: true },\n password: { type: 'string', required: true },\n role: { type: 'string', required: true, default: 'user' },\n avatar: { type: 'string' },\n isVerified: { type: 'boolean', default: false },\n isActive: { type: 'boolean', default: true },\n verifyToken: { type: 'string' },\n resetToken: { type: 'string' },\n resetTokenExpiry: { type: 'date' },\n refreshToken: { type: 'string' },\n refreshTokenExpiry: { type: 'date' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const User = defineModel('User', {\n name: { type: 'string', required: true },\n email: { type: 'string', required: true, unique: true },\n password: { type: 'string', required: true },\n role: { type: 'string', required: true, default: 'user' },\n avatar: { type: 'string' },\n isVerified: { type: 'boolean', default: false },\n isActive: { type: 'boolean', default: true },\n verifyToken: { type: 'string' },\n resetToken: { type: 'string' },\n resetTokenExpiry: { type: 'date' },\n refreshToken: { type: 'string' },\n refreshTokenExpiry: { type: 'date' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for User\n// import { pgTable, serial, text, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const users = pgTable('users', {\n// id: serial('id').primaryKey(),\n// name: text('name').notNull(),\n// email: text('email').notNull().unique(),\n// password: text('password').notNull(),\n// role: text('role').notNull().default('user'),\n// avatar: text('avatar'),\n// isVerified: boolean('is_verified').notNull().default(false),\n// isActive: boolean('is_active').notNull().default(true),\n// createdAt: timestamp('created_at').defaultNow(),\n// updatedAt: timestamp('updated_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for User\nexport {};\n`;\n\n await fs.outputFile(path.join(dest, 'src', 'model', `User.${ext}`), content);\n}\n\nasync function writeAdminModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface AdminDocument {\n name: string;\n email: string;\n password: string;\n role: string;\n permissions: string[];\n isActive: boolean;\n resetToken?: string;\n resetTokenExpiry?: Date;\n refreshToken?: string;\n refreshTokenExpiry?: Date;\n}\n\nexport const Admin = defineModel<AdminDocument>('Admin', {\n name: { type: 'string', required: true },\n email: { type: 'string', required: true, unique: true },\n password: { type: 'string', required: true },\n role: { type: 'string', required: true, default: 'admin' },\n permissions: { type: 'array', default: [] },\n isActive: { type: 'boolean', default: true },\n resetToken: { type: 'string' },\n resetTokenExpiry: { type: 'date' },\n refreshToken: { type: 'string' },\n refreshTokenExpiry: { type: 'date' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Admin = defineModel('Admin', {\n name: { type: 'string', required: true },\n email: { type: 'string', required: true, unique: true },\n password: { type: 'string', required: true },\n role: { type: 'string', required: true, default: 'admin' },\n permissions: { type: 'array', default: [] },\n isActive: { type: 'boolean', default: true },\n resetToken: { type: 'string' },\n resetTokenExpiry: { type: 'date' },\n refreshToken: { type: 'string' },\n refreshTokenExpiry: { type: 'date' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Admin\n// import { pgTable, serial, text, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const admins = pgTable('admins', {\n// id: serial('id').primaryKey(),\n// name: text('name').notNull(),\n// email: text('email').notNull().unique(),\n// password: text('password').notNull(),\n// role: text('role').notNull().default('admin'),\n// permissions: text('permissions').array().notNull().default([]),\n// isActive: boolean('is_active').notNull().default(true),\n// createdAt: timestamp('created_at').defaultNow(),\n// updatedAt: timestamp('updated_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Admin\nexport {};\n`;\n\n await fs.outputFile(path.join(dest, 'src', 'model', `Admin.${ext}`), content);\n}\n\nasync function writeAuthRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n\n const loginMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n POST: {\\n description: 'Authenticate a user or admin and issue a JWT.',\\n request: { body: { email: 'user@example.com', password: 'user' } },\\n response: { status: 200, body: { message: 'Logged in as user' } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n POST: {\\n description: 'Authenticate a user or admin and issue a JWT.',\\n request: { body: { email: 'user@example.com', password: 'user' } },\\n response: { status: 200, body: { message: 'Logged in as user' } },\\n },\\n};\\n\\n`\n : '';\n\n // Only reference the models for the portals actually being generated —\n // referencing both unconditionally broke builds when only one portal was selected.\n const hasUser = opts.userPortal;\n const hasAdmin = opts.adminPortal;\n const mongo = opts.database === 'mongodb' && (hasUser || hasAdmin);\n\n const loginDbImports = mongo\n ? `import bcrypt from 'bcrypt';\\nimport crypto from 'node:crypto';\\n${hasUser ? `import { User } from '../../model/User.js';\\n` : ''}${hasAdmin ? `import { Admin } from '../../model/Admin.js';\\n` : ''}`\n : '';\n\n const loginBody =\n hasAdmin && hasUser\n ? ` const admin = await Admin.findOne({ email });\n if (admin) {\n const match = await bcrypt.compare(password, admin.password);\n if (!match) return res.status(401).json({ error: 'Invalid credentials' });\n if (!admin.isActive) return res.status(403).json({ error: 'Account suspended' });\n await issueToken(res, { id: admin.id, role: admin.role, email: admin.email });\n await issueRefreshToken(res, Admin, admin.id);\n return res.json({ message: 'Logged in as admin' });\n }\n\n const user = await User.findOne({ email });\n if (!user) return res.status(401).json({ error: 'Invalid credentials' });\n const match = await bcrypt.compare(password, user.password);\n if (!match) return res.status(401).json({ error: 'Invalid credentials' });\n if (!user.isActive) return res.status(403).json({ error: 'Account suspended' });\n await issueToken(res, { id: user.id, role: user.role, email: user.email });\n await issueRefreshToken(res, User, user.id);\n res.json({ message: 'Logged in' });`\n : hasAdmin\n ? ` const admin = await Admin.findOne({ email });\n if (!admin) return res.status(401).json({ error: 'Invalid credentials' });\n const match = await bcrypt.compare(password, admin.password);\n if (!match) return res.status(401).json({ error: 'Invalid credentials' });\n if (!admin.isActive) return res.status(403).json({ error: 'Account suspended' });\n await issueToken(res, { id: admin.id, role: admin.role, email: admin.email });\n await issueRefreshToken(res, Admin, admin.id);\n res.json({ message: 'Logged in as admin' });`\n : ` const user = await User.findOne({ email });\n if (!user) return res.status(401).json({ error: 'Invalid credentials' });\n const match = await bcrypt.compare(password, user.password);\n if (!match) return res.status(401).json({ error: 'Invalid credentials' });\n if (!user.isActive) return res.status(403).json({ error: 'Account suspended' });\n await issueToken(res, { id: user.id, role: user.role, email: user.email });\n await issueRefreshToken(res, User, user.id);\n res.json({ message: 'Logged in' });`;\n\n const loginContent = mongo\n ? ts\n ? `import { issueToken } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${loginDbImports}${loginMeta}const REFRESH_TOKEN_TTL_MS = 1000 * 60 * 60 * 24 * 30; // 30 days\n\nasync function issueRefreshToken(\n res: Response,\n model: { update: (id: string, data: Record<string, unknown>) => Promise<unknown> },\n id: string,\n): Promise<void> {\n const refreshToken = crypto.randomBytes(40).toString('hex');\n await model.update(id, { refreshToken, refreshTokenExpiry: new Date(Date.now() + REFRESH_TOKEN_TTL_MS) });\n res.cookie('efc_refresh_token', refreshToken, {\n httpOnly: true,\n secure: process.env.NODE_ENV === 'production',\n sameSite: 'strict',\n maxAge: REFRESH_TOKEN_TTL_MS,\n });\n}\n\nexport const POST = async (req: Request, res: Response) => {\n const { email, password } = req.body;\n if (!email || !password) return res.status(400).json({ error: 'email and password are required' });\n\n${loginBody}\n};\n`\n : `import { issueToken } from 'express-file-cluster/auth';\n${loginDbImports}${loginMeta}const REFRESH_TOKEN_TTL_MS = 1000 * 60 * 60 * 24 * 30; // 30 days\n\nasync function issueRefreshToken(res, model, id) {\n const refreshToken = crypto.randomBytes(40).toString('hex');\n await model.update(id, { refreshToken, refreshTokenExpiry: new Date(Date.now() + REFRESH_TOKEN_TTL_MS) });\n res.cookie('efc_refresh_token', refreshToken, {\n httpOnly: true,\n secure: process.env.NODE_ENV === 'production',\n sameSite: 'strict',\n maxAge: REFRESH_TOKEN_TTL_MS,\n });\n}\n\nexport const POST = async (req, res) => {\n const { email, password } = req.body;\n if (!email || !password) return res.status(400).json({ error: 'email and password are required' });\n\n${loginBody}\n};\n`\n : ts\n ? `import { issueToken } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${loginMeta}export const POST = async (req: Request, res: Response) => {\n const { email, password } = req.body;\n // TODO: look up user in DB and compare password\n res.status(401).json({ error: 'Invalid credentials' });\n};\n`\n : `import { issueToken } from 'express-file-cluster/auth';\n${loginMeta}export const POST = async (req, res) => {\n const { email, password } = req.body;\n // TODO: look up user in DB and compare password\n res.status(401).json({ error: 'Invalid credentials' });\n};\n`;\n\n const logoutMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n POST: {\\n description: 'Clear the auth cookie and log the user out.',\\n response: { status: 200, body: { message: 'Logged out successfully' } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n POST: {\\n description: 'Clear the auth cookie and log the user out.',\\n response: { status: 200, body: { message: 'Logged out successfully' } },\\n },\\n};\\n\\n`\n : '';\n\n const logoutContent = ts\n ? `import { revokeToken } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${logoutMeta}export const POST = async (_req: Request, res: Response) => {\n revokeToken(res);\n res.clearCookie('efc_refresh_token');\n res.json({ message: 'Logged out successfully' });\n};\n`\n : `import { revokeToken } from 'express-file-cluster/auth';\n${logoutMeta}export const POST = async (_req, res) => {\n revokeToken(res);\n res.clearCookie('efc_refresh_token');\n res.json({ message: 'Logged out successfully' });\n};\n`;\n\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `login.${ext}`), loginContent);\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `logout.${ext}`), logoutContent);\n\n if (!opts.userPortal) return;\n\n const registerMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n POST: {\\n description: 'Register a new user account.',\\n request: { body: { name: 'Jane Doe', email: 'jane@example.com', password: 'secret' } },\\n response: { status: 201, body: { message: 'Account created successfully' } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n POST: {\\n description: 'Register a new user account.',\\n request: { body: { name: 'Jane Doe', email: 'jane@example.com', password: 'secret' } },\\n response: { status: 201, body: { message: 'Account created successfully' } },\\n },\\n};\\n\\n`\n : '';\n\n const registerDbImports =\n opts.database === 'mongodb'\n ? `import bcrypt from 'bcrypt';\\nimport crypto from 'node:crypto';\\n${opts.mailer ? \"import { enqueue } from 'express-file-cluster/tasks';\\n\" : ''}import { User } from '../../model/User.js';\\n`\n : '';\n\n const sendVerifyEmail = opts.mailer\n ? `\n var appUrl = process.env.APP_URL || 'http://localhost:3000';\n await enqueue('SendEmail', {\n to: email,\n subject: 'Verify your email address',\n body: 'Welcome, ' + name + '! Verify your email: ' + appUrl + '/auth/verify-email?token=' + verifyToken,\n });\n`\n : `\n // TODO: email this token to the user — enable the Mailer feature to auto-wire SendEmail\n`;\n\n const registerContent =\n opts.database === 'mongodb'\n ? ts\n ? `import type { Request, Response } from 'express';\n${registerDbImports}${registerMeta}export const POST = async (req: Request, res: Response) => {\n const { name, email, password } = req.body;\n if (!name || !email || !password) {\n return res.status(400).json({ error: 'name, email and password are required' });\n }\n const existing = await User.findOne({ email });\n if (existing) return res.status(409).json({ error: 'Email already in use' });\n const hashed = await bcrypt.hash(password, 10);\n const verifyToken = crypto.randomBytes(32).toString('hex');\n const user = await User.create({ name, email, password: hashed, verifyToken });\n${sendVerifyEmail}\n const { password: _, verifyToken: __, ...safe } = user;\n res.status(201).json({ message: 'Account created successfully', user: safe });\n};\n`\n : `${registerDbImports}${registerMeta}export const POST = async (req, res) => {\n const { name, email, password } = req.body;\n if (!name || !email || !password) {\n return res.status(400).json({ error: 'name, email and password are required' });\n }\n const existing = await User.findOne({ email });\n if (existing) return res.status(409).json({ error: 'Email already in use' });\n const hashed = await bcrypt.hash(password, 10);\n const verifyToken = crypto.randomBytes(32).toString('hex');\n const user = await User.create({ name, email, password: hashed, verifyToken });\n${sendVerifyEmail}\n const { password: _, verifyToken: __, ...safe } = user;\n res.status(201).json({ message: 'Account created successfully', user: safe });\n};\n`\n : ts\n ? `import type { Request, Response } from 'express';\n${registerMeta}export const POST = async (req: Request, res: Response) => {\n const { name, email, password } = req.body;\n if (!name || !email || !password) {\n return res.status(400).json({ error: 'name, email and password are required' });\n }\n // TODO: hash password and persist to DB\n res.status(201).json({ message: 'Account created successfully' });\n};\n`\n : `${registerMeta}export const POST = async (req, res) => {\n const { name, email, password } = req.body;\n if (!name || !email || !password) {\n return res.status(400).json({ error: 'name, email and password are required' });\n }\n // TODO: hash password and persist to DB\n res.status(201).json({ message: 'Account created successfully' });\n};\n`;\n\n const meMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n GET: {\\n description: 'Return the currently authenticated user.',\\n response: { status: 200, body: { user: { id: '1', role: 'user', email: 'user@example.com' } } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n GET: {\\n description: 'Return the currently authenticated user.',\\n response: { status: 200, body: { user: { id: '1', role: 'user', email: 'user@example.com' } } },\\n },\\n};\\n\\n`\n : '';\n const meMiddlewares = opts.rbac\n ? `export const middlewares = [requireAuth('user', 'admin')];\\n\\n`\n : `export const middlewares = [requireAuth];\\n\\n`;\n\n const meContent = ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${meMeta}${meMiddlewares}export const GET = async (req: Request, res: Response) => {\n res.json({ user: (req as any).user });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${meMeta}${meMiddlewares}export const GET = async (req, res) => {\n res.json({ user: req.user });\n};\n`;\n\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `register.${ext}`), registerContent);\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `me.${ext}`), meContent);\n}\n\nasync function writeAdminRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const middlewares = opts.rbac\n ? `export const middlewares = [requireAuth('admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n const roleGuard = opts.rbac\n ? ''\n : ts\n ? ` const user = (req as any).user;\\n if (user?.role !== 'admin') {\\n return res.status(403).json({ error: 'Forbidden: Admin access required' });\\n }\\n\\n`\n : ` const user = req.user;\\n if (user?.role !== 'admin') {\\n return res.status(403).json({ error: 'Forbidden: Admin access required' });\\n }\\n\\n`;\n\n const dashboardMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n GET: {\\n description: 'Admin dashboard stats. Requires admin role.',\\n response: { status: 200, body: { stats: { totalUsers: 120, activeUsers: 98, verifiedUsers: 84 } } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n GET: {\\n description: 'Admin dashboard stats. Requires admin role.',\\n response: { status: 200, body: { stats: { totalUsers: 120, activeUsers: 98, verifiedUsers: 84 } } },\\n },\\n};\\n\\n`\n : '';\n\n // Real stats need the User model, which only exists when userManagement is on.\n const dashboardHasUserModel = opts.database === 'mongodb' && opts.adminFeatures.userManagement;\n\n const dashboardDbImport = dashboardHasUserModel\n ? `import { User } from '../../model/User.js';\\n`\n : '';\n\n const dashboardContent = dashboardHasUserModel\n ? ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${dashboardDbImport}${dashboardMeta}${middlewares}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} const [totalUsers, activeUsers, verifiedUsers] = await Promise.all([\n User.count({}),\n User.count({ isActive: true }),\n User.count({ isVerified: true }),\n ]);\n res.json({ stats: { totalUsers, activeUsers, verifiedUsers } });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${dashboardDbImport}${dashboardMeta}${middlewares}\nexport const GET = async (_req, res) => {\n${roleGuard} const [totalUsers, activeUsers, verifiedUsers] = await Promise.all([\n User.count({}),\n User.count({ isActive: true }),\n User.count({ isVerified: true }),\n ]);\n res.json({ stats: { totalUsers, activeUsers, verifiedUsers } });\n};\n`\n : ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${dashboardMeta}${middlewares}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: aggregate stats from DB\n res.json({ stats: { users: 0 } });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${dashboardMeta}${middlewares}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: aggregate stats from DB\n res.json({ stats: { users: 0 } });\n};\n`;\n\n await fs.outputFile(path.join(dest, 'src', 'api', 'admin', `dashboard.${ext}`), dashboardContent);\n\n if (!opts.adminFeatures.userManagement) return;\n\n // Admin user management routes\n const usersListMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n GET: {\\n description: 'List all users, paginated (admin only).',\\n request: { query: { page: '1', limit: '20' } },\\n response: { status: 200, body: { users: [], total: 0, page: 1, limit: 20 } },\\n },\\n POST: {\\n description: 'Create a new user account (admin only).',\\n request: { body: { name: 'Jane Doe', email: 'jane@example.com', password: 'secret', role: 'user' } },\\n response: { status: 201, body: { message: 'User created', user: { id: 'new-id', name: 'Jane Doe', email: 'jane@example.com', role: 'user' } } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n GET: {\\n description: 'List all users, paginated (admin only).',\\n request: { query: { page: '1', limit: '20' } },\\n response: { status: 200, body: { users: [], total: 0, page: 1, limit: 20 } },\\n },\\n POST: {\\n description: 'Create a new user account (admin only).',\\n request: { body: { name: 'Jane Doe', email: 'jane@example.com', password: 'secret', role: 'user' } },\\n response: { status: 201, body: { message: 'User created', user: { id: 'new-id', name: 'Jane Doe', email: 'jane@example.com', role: 'user' } } },\\n },\\n};\\n\\n`\n : '';\n\n const adminUsersDbImport =\n opts.database === 'mongodb'\n ? ts\n ? `import bcrypt from 'bcrypt';\\nimport { User } from '../../../model/User.js';\\n`\n : `import bcrypt from 'bcrypt';\\nimport { User } from '../../../model/User.js';\\n`\n : '';\n\n const usersListContent =\n opts.database === 'mongodb'\n ? ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${adminUsersDbImport}${usersListMeta}${middlewares}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const page = Math.max(1, Number(req.query.page) || 1);\n const limit = Math.min(100, Number(req.query.limit) || 20);\n const [all, total] = await Promise.all([User.find({}), User.count({})]);\n const users = all.slice((page - 1) * limit, page * limit).map(({ password: _, ...u }) => u);\n res.json({ users, total, page, limit });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { name, email, password, role } = req.body;\n if (!name || !email || !password) return res.status(400).json({ error: 'name, email and password are required' });\n const existing = await User.findOne({ email });\n if (existing) return res.status(409).json({ error: 'Email already in use' });\n const hashed = await bcrypt.hash(password, 10);\n const user = await User.create({ name, email, password: hashed, role: role ?? 'user' });\n const { password: _, ...safe } = user;\n res.status(201).json({ message: 'User created', user: safe });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${adminUsersDbImport}${usersListMeta}${middlewares}\nexport const GET = async (req, res) => {\n${roleGuard} const page = Math.max(1, Number(req.query.page) || 1);\n const limit = Math.min(100, Number(req.query.limit) || 20);\n const [all, total] = await Promise.all([User.find({}), User.count({})]);\n const users = all.slice((page - 1) * limit, page * limit).map(({ password: _, ...u }) => u);\n res.json({ users, total, page, limit });\n};\n\nexport const POST = async (req, res) => {\n${roleGuard} const { name, email, password, role } = req.body;\n if (!name || !email || !password) return res.status(400).json({ error: 'name, email and password are required' });\n const existing = await User.findOne({ email });\n if (existing) return res.status(409).json({ error: 'Email already in use' });\n const hashed = await bcrypt.hash(password, 10);\n const user = await User.create({ name, email, password: hashed, role: role ?? 'user' });\n const { password: _, ...safe } = user;\n res.status(201).json({ message: 'User created', user: safe });\n};\n`\n : ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${usersListMeta}${middlewares}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: fetch users from DB with pagination\n res.json({ users: [], total: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { name, email, role } = req.body;\n if (!name || !email) return res.status(400).json({ error: 'name and email are required' });\n // TODO: create user in DB\n res.status(201).json({ message: 'User created', user: { id: 'new-id', name, email, role: role ?? 'user' } });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${usersListMeta}${middlewares}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: fetch users from DB with pagination\n res.json({ users: [], total: 0 });\n};\n\nexport const POST = async (req, res) => {\n${roleGuard} const { name, email, role } = req.body;\n if (!name || !email) return res.status(400).json({ error: 'name and email are required' });\n // TODO: create user in DB\n res.status(201).json({ message: 'User created', user: { id: 'new-id', name, email, role: role ?? 'user' } });\n};\n`;\n\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'users', `index.${ext}`),\n usersListContent,\n );\n\n const userByIdMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n GET: {\\n description: 'Fetch a single user by ID (admin only).',\\n request: { params: { id: 'usr_01HXZ' } },\\n response: { status: 200, body: { user: { id: 'usr_01HXZ', name: 'Jane Doe', email: 'jane@example.com', role: 'user' } } },\\n },\\n PUT: {\\n description: 'Update a user by ID (admin only).',\\n request: { params: { id: 'usr_01HXZ' }, body: { name: 'Jane Doe', email: 'jane@example.com', role: 'user', isActive: true } },\\n response: { status: 200, body: { message: 'User updated', user: { id: 'usr_01HXZ', name: 'Jane Doe', email: 'jane@example.com', role: 'user' } } },\\n },\\n DELETE: {\\n description: 'Delete a user by ID (admin only).',\\n request: { params: { id: 'usr_01HXZ' } },\\n response: { status: 200, body: { message: 'User usr_01HXZ deleted' } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n GET: {\\n description: 'Fetch a single user by ID (admin only).',\\n request: { params: { id: 'usr_01HXZ' } },\\n response: { status: 200, body: { user: { id: 'usr_01HXZ', name: 'Jane Doe', email: 'jane@example.com', role: 'user' } } },\\n },\\n PUT: {\\n description: 'Update a user by ID (admin only).',\\n request: { params: { id: 'usr_01HXZ' }, body: { name: 'Jane Doe', email: 'jane@example.com', role: 'user', isActive: true } },\\n response: { status: 200, body: { message: 'User updated', user: { id: 'usr_01HXZ', name: 'Jane Doe', email: 'jane@example.com', role: 'user' } } },\\n },\\n DELETE: {\\n description: 'Delete a user by ID (admin only).',\\n request: { params: { id: 'usr_01HXZ' } },\\n response: { status: 200, body: { message: 'User usr_01HXZ deleted' } },\\n },\\n};\\n\\n`\n : '';\n\n const adminUserByIdDbImport =\n opts.database === 'mongodb' ? `import { User } from '../../../model/User.js';\\n` : '';\n\n const userByIdContent =\n opts.database === 'mongodb'\n ? ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${adminUserByIdDbImport}${userByIdMeta}${middlewares}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n const user = await User.findById(id);\n if (!user) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = user;\n res.json({ user: safe });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n const { name, email, role, isActive } = req.body;\n const updated = await User.update(id, { name, email, role, isActive });\n if (!updated) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = updated;\n res.json({ message: 'User updated', user: safe });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n const user = await User.findById(id);\n if (!user) return res.status(404).json({ error: 'User not found' });\n await User.delete(id);\n res.json({ message: \\`User \\${id} deleted\\` });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${adminUserByIdDbImport}${userByIdMeta}${middlewares}\nexport const GET = async (req, res) => {\n${roleGuard} const { id } = req.params;\n const user = await User.findById(id);\n if (!user) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = user;\n res.json({ user: safe });\n};\n\nexport const PUT = async (req, res) => {\n${roleGuard} const { id } = req.params;\n const { name, email, role, isActive } = req.body;\n const updated = await User.update(id, { name, email, role, isActive });\n if (!updated) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = updated;\n res.json({ message: 'User updated', user: safe });\n};\n\nexport const DELETE = async (req, res) => {\n${roleGuard} const { id } = req.params;\n const user = await User.findById(id);\n if (!user) return res.status(404).json({ error: 'User not found' });\n await User.delete(id);\n res.json({ message: \\`User \\${id} deleted\\` });\n};\n`\n : ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${userByIdMeta}${middlewares}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch user from DB\n res.json({ user: { id } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: update user in DB\n res.json({ message: 'User updated', user: { id, ...req.body } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: delete user from DB\n res.json({ message: \\`User \\${id} deleted\\` });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${userByIdMeta}${middlewares}\nexport const GET = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch user from DB\n res.json({ user: { id } });\n};\n\nexport const PUT = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: update user in DB\n res.json({ message: 'User updated', user: { id, ...req.body } });\n};\n\nexport const DELETE = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: delete user from DB\n res.json({ message: \\`User \\${id} deleted\\` });\n};\n`;\n\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'users', `[id].${ext}`),\n userByIdContent,\n );\n}\n\nasync function writeUserRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const middlewares = opts.rbac\n ? `export const middlewares = [requireAuth('user', 'admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n\n const profileMeta = opts.routeDocs\n ? ts\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n GET: {\\n description: \"Fetch the authenticated user's profile.\",\\n response: { status: 200, body: { user: { id: '1', role: 'user', email: 'user@example.com' } } },\\n },\\n PUT: {\\n description: \"Update the authenticated user's profile.\",\\n request: { body: { name: 'Jane Doe', email: 'jane@example.com' } },\\n response: { status: 200, body: { message: 'Profile updated', user: { id: '1', role: 'user', email: 'jane@example.com' } } },\\n },\\n};\\n\\n`\n : `export const meta = {\\n GET: {\\n description: \"Fetch the authenticated user's profile.\",\\n response: { status: 200, body: { user: { id: '1', role: 'user', email: 'user@example.com' } } },\\n },\\n PUT: {\\n description: \"Update the authenticated user's profile.\",\\n request: { body: { name: 'Jane Doe', email: 'jane@example.com' } },\\n response: { status: 200, body: { message: 'Profile updated', user: { id: '1', role: 'user', email: 'jane@example.com' } } },\\n },\\n};\\n\\n`\n : '';\n\n const profileDbImport =\n opts.database === 'mongodb' ? `import { User } from '../../model/User.js';\\n` : '';\n\n const profileContent =\n opts.database === 'mongodb'\n ? ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${profileDbImport}${profileMeta}${middlewares}\nexport const GET = async (req: Request, res: Response) => {\n const { id } = (req as any).user;\n const user = await User.findById(id);\n if (!user) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = user;\n res.json({ user: safe });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n const { id } = (req as any).user;\n const { name, email } = req.body;\n const updated = await User.update(id, { name, email });\n if (!updated) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = updated;\n res.json({ message: 'Profile updated', user: safe });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${profileDbImport}${profileMeta}${middlewares}\nexport const GET = async (req, res) => {\n const { id } = req.user;\n const user = await User.findById(id);\n if (!user) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = user;\n res.json({ user: safe });\n};\n\nexport const PUT = async (req, res) => {\n const { id } = req.user;\n const { name, email } = req.body;\n const updated = await User.update(id, { name, email });\n if (!updated) return res.status(404).json({ error: 'User not found' });\n const { password: _, ...safe } = updated;\n res.json({ message: 'Profile updated', user: safe });\n};\n`\n : ts\n ? `import { requireAuth } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\n${profileMeta}${middlewares}\nexport const GET = async (req: Request, res: Response) => {\n res.json({ user: (req as any).user });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n const { name, email } = req.body;\n // TODO: update user in DB\n res.json({ message: 'Profile updated', user: { ...(req as any).user, name, email } });\n};\n`\n : `import { requireAuth } from 'express-file-cluster/auth';\n${profileMeta}${middlewares}\nexport const GET = async (req, res) => {\n res.json({ user: req.user });\n};\n\nexport const PUT = async (req, res) => {\n const { name, email } = req.body;\n // TODO: update user in DB\n res.json({ message: 'Profile updated', user: { ...req.user, name, email } });\n};\n`;\n\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `profile.${ext}`), profileContent);\n}\n\n// ─── META HELPER ─────────────────────────────────────────────────────────\n\ninterface MethodMetaSpec {\n description: string;\n params?: string;\n query?: string;\n request?: string;\n response?: string;\n status?: number;\n}\n\nfunction mkMeta(opts: ScaffoldOptions, methods: Record<string, MethodMetaSpec>): string {\n if (!opts.routeDocs) return '';\n const blocks = Object.entries(methods)\n .map(([method, m]) => {\n const reqParts: string[] = [];\n if (m.params) reqParts.push(`params: ${m.params}`);\n if (m.query) reqParts.push(`query: ${m.query}`);\n if (m.request) reqParts.push(`body: ${m.request}`);\n const reqLine = reqParts.length ? ` request: { ${reqParts.join(', ')} },\\n` : '';\n const status = m.status ?? 200;\n const respLine =\n m.response !== undefined\n ? ` response: { status: ${status}, body: ${m.response} },\\n`\n : ` response: { status: ${status} },\\n`;\n const description = m.description.replace(/'/g, \"\\\\'\");\n return ` ${method}: {\\n description: '${description}',\\n${reqLine}${respLine} },`;\n })\n .join('\\n');\n return opts.language === 'typescript'\n ? `import type { RouteMeta } from 'express-file-cluster';\\n\\nexport const meta: RouteMeta = {\\n${blocks}\\n};\\n\\n`\n : `export const meta = {\\n${blocks}\\n};\\n\\n`;\n}\n\n// ─── EXTENDED MODEL WRITERS ───────────────────────────────────────────────\n\nasync function writeSessionModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface SessionDocument {\n userId: string;\n token: string;\n ip: string;\n userAgent: string;\n expiresAt: Date;\n isActive: boolean;\n}\n\nexport const Session = defineModel<SessionDocument>('Session', {\n userId: { type: 'string', required: true },\n token: { type: 'string', required: true, unique: true },\n ip: { type: 'string', required: true },\n userAgent: { type: 'string', required: true },\n expiresAt: { type: 'date', required: true },\n isActive: { type: 'boolean', default: true },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Session = defineModel('Session', {\n userId: { type: 'string', required: true },\n token: { type: 'string', required: true, unique: true },\n ip: { type: 'string', required: true },\n userAgent: { type: 'string', required: true },\n expiresAt: { type: 'date', required: true },\n isActive: { type: 'boolean', default: true },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Session\n// import { pgTable, serial, text, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const sessions = pgTable('sessions', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// token: text('token').notNull().unique(),\n// ip: text('ip').notNull(),\n// userAgent: text('user_agent').notNull(),\n// expiresAt: timestamp('expires_at').notNull(),\n// isActive: boolean('is_active').notNull().default(true),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Session\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Session.${ext}`), content);\n}\n\nasync function writeNotificationModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface NotificationDocument {\n userId: string;\n title: string;\n message: string;\n type: string;\n isRead: boolean;\n link?: string;\n}\n\nexport const Notification = defineModel<NotificationDocument>('Notification', {\n userId: { type: 'string', required: true },\n title: { type: 'string', required: true },\n message: { type: 'string', required: true },\n type: { type: 'string', required: true, default: 'info' },\n isRead: { type: 'boolean', default: false },\n link: { type: 'string' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Notification = defineModel('Notification', {\n userId: { type: 'string', required: true },\n title: { type: 'string', required: true },\n message: { type: 'string', required: true },\n type: { type: 'string', required: true, default: 'info' },\n isRead: { type: 'boolean', default: false },\n link: { type: 'string' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Notification\n// import { pgTable, serial, text, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const notifications = pgTable('notifications', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// title: text('title').notNull(),\n// message: text('message').notNull(),\n// type: text('type').notNull().default('info'),\n// isRead: boolean('is_read').notNull().default(false),\n// link: text('link'),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Notification\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Notification.${ext}`), content);\n}\n\nasync function writeFileModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface FileDocument {\n userId: string;\n filename: string;\n originalName: string;\n mimeType: string;\n size: number;\n url: string;\n isPublic: boolean;\n}\n\nexport const File = defineModel<FileDocument>('File', {\n userId: { type: 'string', required: true },\n filename: { type: 'string', required: true },\n originalName: { type: 'string', required: true },\n mimeType: { type: 'string', required: true },\n size: { type: 'number', required: true },\n url: { type: 'string', required: true },\n isPublic: { type: 'boolean', default: false },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const File = defineModel('File', {\n userId: { type: 'string', required: true },\n filename: { type: 'string', required: true },\n originalName: { type: 'string', required: true },\n mimeType: { type: 'string', required: true },\n size: { type: 'number', required: true },\n url: { type: 'string', required: true },\n isPublic: { type: 'boolean', default: false },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for File\n// import { pgTable, serial, text, boolean, integer, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const files = pgTable('files', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// filename: text('filename').notNull(),\n// originalName: text('original_name').notNull(),\n// mimeType: text('mime_type').notNull(),\n// size: integer('size').notNull(),\n// url: text('url').notNull(),\n// isPublic: boolean('is_public').notNull().default(false),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for File\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `File.${ext}`), content);\n}\n\nasync function writeSupportTicketModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface SupportTicketDocument {\n userId: string;\n subject: string;\n message: string;\n status: string;\n priority: string;\n assignedTo?: string;\n}\n\nexport const SupportTicket = defineModel<SupportTicketDocument>('SupportTicket', {\n userId: { type: 'string', required: true },\n subject: { type: 'string', required: true },\n message: { type: 'string', required: true },\n status: { type: 'string', required: true, default: 'open' },\n priority: { type: 'string', required: true, default: 'normal' },\n assignedTo: { type: 'string' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const SupportTicket = defineModel('SupportTicket', {\n userId: { type: 'string', required: true },\n subject: { type: 'string', required: true },\n message: { type: 'string', required: true },\n status: { type: 'string', required: true, default: 'open' },\n priority: { type: 'string', required: true, default: 'normal' },\n assignedTo: { type: 'string' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for SupportTicket\n// import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const supportTickets = pgTable('support_tickets', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// subject: text('subject').notNull(),\n// message: text('message').notNull(),\n// status: text('status').notNull().default('open'),\n// priority: text('priority').notNull().default('normal'),\n// assignedTo: text('assigned_to'),\n// createdAt: timestamp('created_at').defaultNow(),\n// updatedAt: timestamp('updated_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for SupportTicket\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `SupportTicket.${ext}`), content);\n}\n\nasync function writeAuditLogModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface AuditLogDocument {\n adminId: string;\n action: string;\n entity: string;\n entityId: string;\n metadata?: Record<string, unknown>;\n ip: string;\n}\n\nexport const AuditLog = defineModel<AuditLogDocument>('AuditLog', {\n adminId: { type: 'string', required: true },\n action: { type: 'string', required: true },\n entity: { type: 'string', required: true },\n entityId: { type: 'string', required: true },\n metadata: { type: 'object' },\n ip: { type: 'string', required: true },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const AuditLog = defineModel('AuditLog', {\n adminId: { type: 'string', required: true },\n action: { type: 'string', required: true },\n entity: { type: 'string', required: true },\n entityId: { type: 'string', required: true },\n metadata: { type: 'object' },\n ip: { type: 'string', required: true },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for AuditLog\n// import { pgTable, serial, text, jsonb, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const auditLogs = pgTable('audit_logs', {\n// id: serial('id').primaryKey(),\n// adminId: text('admin_id').notNull(),\n// action: text('action').notNull(),\n// entity: text('entity').notNull(),\n// entityId: text('entity_id').notNull(),\n// metadata: jsonb('metadata'),\n// ip: text('ip').notNull(),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for AuditLog\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `AuditLog.${ext}`), content);\n}\n\nasync function writeSubscriptionModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface SubscriptionDocument {\n userId: string;\n planId: string;\n status: string;\n startDate: Date;\n endDate: Date;\n cancelledAt?: Date;\n}\n\nexport const Subscription = defineModel<SubscriptionDocument>('Subscription', {\n userId: { type: 'string', required: true },\n planId: { type: 'string', required: true },\n status: { type: 'string', required: true, default: 'active' },\n startDate: { type: 'date', required: true },\n endDate: { type: 'date', required: true },\n cancelledAt: { type: 'date' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Subscription = defineModel('Subscription', {\n userId: { type: 'string', required: true },\n planId: { type: 'string', required: true },\n status: { type: 'string', required: true, default: 'active' },\n startDate: { type: 'date', required: true },\n endDate: { type: 'date', required: true },\n cancelledAt: { type: 'date' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Subscription\n// import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const subscriptions = pgTable('subscriptions', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// planId: text('plan_id').notNull(),\n// status: text('status').notNull().default('active'),\n// startDate: timestamp('start_date').notNull(),\n// endDate: timestamp('end_date').notNull(),\n// cancelledAt: timestamp('cancelled_at'),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Subscription\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Subscription.${ext}`), content);\n}\n\nasync function writePlanModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface PlanDocument {\n name: string;\n description: string;\n price: number;\n interval: string;\n features: string[];\n isActive: boolean;\n}\n\nexport const Plan = defineModel<PlanDocument>('Plan', {\n name: { type: 'string', required: true },\n description: { type: 'string', required: true },\n price: { type: 'number', required: true },\n interval: { type: 'string', required: true, default: 'monthly' },\n features: { type: 'array', default: [] },\n isActive: { type: 'boolean', default: true },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Plan = defineModel('Plan', {\n name: { type: 'string', required: true },\n description: { type: 'string', required: true },\n price: { type: 'number', required: true },\n interval: { type: 'string', required: true, default: 'monthly' },\n features: { type: 'array', default: [] },\n isActive: { type: 'boolean', default: true },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Plan\n// import { pgTable, serial, text, numeric, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const plans = pgTable('plans', {\n// id: serial('id').primaryKey(),\n// name: text('name').notNull(),\n// description: text('description').notNull(),\n// price: numeric('price').notNull(),\n// interval: text('interval').notNull().default('monthly'),\n// features: text('features').array().notNull().default([]),\n// isActive: boolean('is_active').notNull().default(true),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Plan\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Plan.${ext}`), content);\n}\n\nasync function writeInvoiceModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface InvoiceDocument {\n userId: string;\n subscriptionId: string;\n amount: number;\n currency: string;\n status: string;\n paidAt?: Date;\n}\n\nexport const Invoice = defineModel<InvoiceDocument>('Invoice', {\n userId: { type: 'string', required: true },\n subscriptionId: { type: 'string', required: true },\n amount: { type: 'number', required: true },\n currency: { type: 'string', required: true, default: 'USD' },\n status: { type: 'string', required: true, default: 'pending' },\n paidAt: { type: 'date' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Invoice = defineModel('Invoice', {\n userId: { type: 'string', required: true },\n subscriptionId: { type: 'string', required: true },\n amount: { type: 'number', required: true },\n currency: { type: 'string', required: true, default: 'USD' },\n status: { type: 'string', required: true, default: 'pending' },\n paidAt: { type: 'date' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Invoice\n// import { pgTable, serial, text, numeric, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const invoices = pgTable('invoices', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// subscriptionId: text('subscription_id').notNull(),\n// amount: numeric('amount').notNull(),\n// currency: text('currency').notNull().default('USD'),\n// status: text('status').notNull().default('pending'),\n// paidAt: timestamp('paid_at'),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Invoice\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Invoice.${ext}`), content);\n}\n\nasync function writeApiKeyModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface ApiKeyDocument {\n userId: string;\n name: string;\n key: string;\n lastUsed?: Date;\n expiresAt?: Date;\n isActive: boolean;\n}\n\nexport const ApiKey = defineModel<ApiKeyDocument>('ApiKey', {\n userId: { type: 'string', required: true },\n name: { type: 'string', required: true },\n key: { type: 'string', required: true, unique: true },\n lastUsed: { type: 'date' },\n expiresAt:{ type: 'date' },\n isActive: { type: 'boolean', default: true },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const ApiKey = defineModel('ApiKey', {\n userId: { type: 'string', required: true },\n name: { type: 'string', required: true },\n key: { type: 'string', required: true, unique: true },\n lastUsed: { type: 'date' },\n expiresAt: { type: 'date' },\n isActive: { type: 'boolean', default: true },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for ApiKey\n// import { pgTable, serial, text, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const apiKeys = pgTable('api_keys', {\n// id: serial('id').primaryKey(),\n// userId: text('user_id').notNull(),\n// name: text('name').notNull(),\n// key: text('key').notNull().unique(),\n// lastUsed: timestamp('last_used'),\n// expiresAt: timestamp('expires_at'),\n// isActive: boolean('is_active').notNull().default(true),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for ApiKey\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `ApiKey.${ext}`), content);\n}\n\nasync function writeRoleModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface RoleDocument {\n name: string;\n description: string;\n permissions: string[];\n}\n\nexport const Role = defineModel<RoleDocument>('Role', {\n name: { type: 'string', required: true, unique: true },\n description: { type: 'string', required: true },\n permissions: { type: 'array', default: [] },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Role = defineModel('Role', {\n name: { type: 'string', required: true, unique: true },\n description: { type: 'string', required: true },\n permissions: { type: 'array', default: [] },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Role\n// import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const roles = pgTable('roles', {\n// id: serial('id').primaryKey(),\n// name: text('name').notNull().unique(),\n// description: text('description').notNull(),\n// permissions: text('permissions').array().notNull().default([]),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Role\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Role.${ext}`), content);\n}\n\nasync function writeFAQModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface FAQDocument {\n question: string;\n answer: string;\n category: string;\n order: number;\n isPublished: boolean;\n}\n\nexport const FAQ = defineModel<FAQDocument>('FAQ', {\n question: { type: 'string', required: true },\n answer: { type: 'string', required: true },\n category: { type: 'string', required: true, default: 'general' },\n order: { type: 'number', default: 0 },\n isPublished: { type: 'boolean', default: false },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const FAQ = defineModel('FAQ', {\n question: { type: 'string', required: true },\n answer: { type: 'string', required: true },\n category: { type: 'string', required: true, default: 'general' },\n order: { type: 'number', default: 0 },\n isPublished: { type: 'boolean', default: false },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for FAQ\n// import { pgTable, serial, text, boolean, integer, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const faqs = pgTable('faqs', {\n// id: serial('id').primaryKey(),\n// question: text('question').notNull(),\n// answer: text('answer').notNull(),\n// category: text('category').notNull().default('general'),\n// order: integer('order').notNull().default(0),\n// isPublished: boolean('is_published').notNull().default(false),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for FAQ\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `FAQ.${ext}`), content);\n}\n\nasync function writeBlogModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface BlogDocument {\n title: string;\n slug: string;\n content: string;\n authorId: string;\n category: string;\n tags: string[];\n status: string;\n publishedAt?: Date;\n}\n\nexport const Blog = defineModel<BlogDocument>('Blog', {\n title: { type: 'string', required: true },\n slug: { type: 'string', required: true, unique: true },\n content: { type: 'string', required: true },\n authorId: { type: 'string', required: true },\n category: { type: 'string', required: true, default: 'general' },\n tags: { type: 'array', default: [] },\n status: { type: 'string', required: true, default: 'draft' },\n publishedAt: { type: 'date' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Blog = defineModel('Blog', {\n title: { type: 'string', required: true },\n slug: { type: 'string', required: true, unique: true },\n content: { type: 'string', required: true },\n authorId: { type: 'string', required: true },\n category: { type: 'string', required: true, default: 'general' },\n tags: { type: 'array', default: [] },\n status: { type: 'string', required: true, default: 'draft' },\n publishedAt: { type: 'date' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Blog\n// import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const blogs = pgTable('blogs', {\n// id: serial('id').primaryKey(),\n// title: text('title').notNull(),\n// slug: text('slug').notNull().unique(),\n// content: text('content').notNull(),\n// authorId: text('author_id').notNull(),\n// category: text('category').notNull().default('general'),\n// tags: text('tags').array().notNull().default([]),\n// status: text('status').notNull().default('draft'),\n// publishedAt: timestamp('published_at'),\n// createdAt: timestamp('created_at').defaultNow(),\n// updatedAt: timestamp('updated_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Blog\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Blog.${ext}`), content);\n}\n\nasync function writeCategoryModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface CategoryDocument {\n name: string;\n slug: string;\n description?: string;\n parentId?: string;\n}\n\nexport const Category = defineModel<CategoryDocument>('Category', {\n name: { type: 'string', required: true },\n slug: { type: 'string', required: true, unique: true },\n description: { type: 'string' },\n parentId: { type: 'string' },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Category = defineModel('Category', {\n name: { type: 'string', required: true },\n slug: { type: 'string', required: true, unique: true },\n description: { type: 'string' },\n parentId: { type: 'string' },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Category\n// import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const categories = pgTable('categories', {\n// id: serial('id').primaryKey(),\n// name: text('name').notNull(),\n// slug: text('slug').notNull().unique(),\n// description: text('description'),\n// parentId: text('parent_id'),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Category\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Category.${ext}`), content);\n}\n\nasync function writeCouponModel(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const content =\n opts.database === 'mongodb'\n ? ts\n ? `import { defineModel } from 'express-file-cluster';\n\nexport interface CouponDocument {\n code: string;\n type: string;\n value: number;\n maxUses: number;\n usedCount: number;\n expiresAt?: Date;\n isActive: boolean;\n}\n\nexport const Coupon = defineModel<CouponDocument>('Coupon', {\n code: { type: 'string', required: true, unique: true },\n type: { type: 'string', required: true, default: 'percent' },\n value: { type: 'number', required: true },\n maxUses: { type: 'number', default: 0 },\n usedCount: { type: 'number', default: 0 },\n expiresAt: { type: 'date' },\n isActive: { type: 'boolean', default: true },\n});\n`\n : `import { defineModel } from 'express-file-cluster';\n\nexport const Coupon = defineModel('Coupon', {\n code: { type: 'string', required: true, unique: true },\n type: { type: 'string', required: true, default: 'percent' },\n value: { type: 'number', required: true },\n maxUses: { type: 'number', default: 0 },\n usedCount: { type: 'number', default: 0 },\n expiresAt: { type: 'date' },\n isActive: { type: 'boolean', default: true },\n});\n`\n : ts\n ? `// TODO: define your Drizzle schema for Coupon\n// import { pgTable, serial, text, numeric, integer, boolean, timestamp } from 'drizzle-orm/pg-core';\n//\n// export const coupons = pgTable('coupons', {\n// id: serial('id').primaryKey(),\n// code: text('code').notNull().unique(),\n// type: text('type').notNull().default('percent'),\n// value: numeric('value').notNull(),\n// maxUses: integer('max_uses').notNull().default(0),\n// usedCount: integer('used_count').notNull().default(0),\n// expiresAt: timestamp('expires_at'),\n// isActive: boolean('is_active').notNull().default(true),\n// createdAt: timestamp('created_at').defaultNow(),\n// });\nexport {};\n`\n : `// TODO: define your Drizzle schema for Coupon\nexport {};\n`;\n await fs.outputFile(path.join(dest, 'src', 'model', `Coupon.${ext}`), content);\n}\n\n// ─── EXTENDED ROUTE WRITERS ───────────────────────────────────────────────\n\nasync function writeAuthExtendedRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n const mwUser2 = opts.rbac\n ? `export const middlewares = [requireAuth('user', 'admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n const mwUser3 = mwUser2;\n const reqT = ts ? `import type { Request, Response } from 'express';\\n` : '';\n const RA = `import { requireAuth } from 'express-file-cluster/auth';\\n`;\n\n const mongo = opts.database === 'mongodb';\n const hasAdmin = opts.adminPortal;\n const uf = opts.userFeatures;\n const sendResetEmail = opts.mailer\n ? ` var appUrl = process.env.APP_URL || 'http://localhost:3000';\n await enqueue('SendEmail', {\n to: email,\n subject: 'Reset your password',\n body: 'Reset your password: ' + appUrl + '/auth/reset-password?token=' + resetToken,\n });\n`\n : ` // TODO: email this token to the user — enable the Mailer feature to auto-wire SendEmail\n`;\n const sendVerifyEmailResend = opts.mailer\n ? ` var appUrl = process.env.APP_URL || 'http://localhost:3000';\n await enqueue('SendEmail', {\n to: email,\n subject: 'Verify your email address',\n body: 'Verify your email: ' + appUrl + '/auth/verify-email?token=' + verifyToken,\n });\n`\n : ` // TODO: email this token to the user — enable the Mailer feature to auto-wire SendEmail\n`;\n const mailerTaskImport = opts.mailer\n ? `import { enqueue } from 'express-file-cluster/tasks';\\n`\n : '';\n\n // refresh.ts\n if (uf.accountSecurity) {\n const refreshMeta = mkMeta(opts, {\n POST: {\n description: 'Refresh the JWT using the refresh-token cookie and issue a new access token.',\n response: `{ message: 'Token refreshed' }`,\n },\n });\n const refreshModelImports = `import { User } from '../../model/User.js';\\n${hasAdmin ? `import { Admin } from '../../model/Admin.js';\\n` : ''}`;\n const refreshLookup = hasAdmin\n ? ` const user = await User.findOne({ refreshToken: token });\n const admin = user ? null : await Admin.findOne({ refreshToken: token });\n const account = user || admin;`\n : ` const user = await User.findOne({ refreshToken: token });\n const account = user;`;\n const refreshPersist = hasAdmin\n ? ` if (user) await User.update(user.id, { refreshToken: newRefreshToken, refreshTokenExpiry });\n else if (admin) await Admin.update(admin.id, { refreshToken: newRefreshToken, refreshTokenExpiry });`\n : ` await User.update(user.id, { refreshToken: newRefreshToken, refreshTokenExpiry });`;\n const refreshContent = mongo\n ? ts\n ? `import { issueToken } from 'express-file-cluster/auth';\nimport type { Request, Response } from 'express';\nimport crypto from 'node:crypto';\n${refreshModelImports}${refreshMeta}const REFRESH_TOKEN_TTL_MS = 1000 * 60 * 60 * 24 * 30; // 30 days\n\nexport const POST = async (req: Request, res: Response) => {\n const token = req.cookies?.['efc_refresh_token'] || req.body?.refreshToken;\n if (!token) return res.status(401).json({ error: 'Refresh token required' });\n\n${refreshLookup}\n\n if (!account || !account.refreshTokenExpiry || new Date(account.refreshTokenExpiry) < new Date()) {\n return res.status(401).json({ error: 'Invalid or expired refresh token' });\n }\n\n const newRefreshToken = crypto.randomBytes(40).toString('hex');\n const refreshTokenExpiry = new Date(Date.now() + REFRESH_TOKEN_TTL_MS);\n${refreshPersist}\n\n res.cookie('efc_refresh_token', newRefreshToken, {\n httpOnly: true,\n secure: process.env.NODE_ENV === 'production',\n sameSite: 'strict',\n maxAge: REFRESH_TOKEN_TTL_MS,\n });\n\n await issueToken(res, { id: account.id, role: account.role, email: account.email });\n res.json({ message: 'Token refreshed' });\n};\n`\n : `import { issueToken } from 'express-file-cluster/auth';\nimport crypto from 'node:crypto';\n${refreshModelImports}${refreshMeta}const REFRESH_TOKEN_TTL_MS = 1000 * 60 * 60 * 24 * 30; // 30 days\n\nexport const POST = async (req, res) => {\n const token = req.cookies?.efc_refresh_token || req.body?.refreshToken;\n if (!token) return res.status(401).json({ error: 'Refresh token required' });\n\n${refreshLookup}\n\n if (!account || !account.refreshTokenExpiry || new Date(account.refreshTokenExpiry) < new Date()) {\n return res.status(401).json({ error: 'Invalid or expired refresh token' });\n }\n\n const newRefreshToken = crypto.randomBytes(40).toString('hex');\n const refreshTokenExpiry = new Date(Date.now() + REFRESH_TOKEN_TTL_MS);\n${refreshPersist}\n\n res.cookie('efc_refresh_token', newRefreshToken, {\n httpOnly: true,\n secure: process.env.NODE_ENV === 'production',\n sameSite: 'strict',\n maxAge: REFRESH_TOKEN_TTL_MS,\n });\n\n await issueToken(res, { id: account.id, role: account.role, email: account.email });\n res.json({ message: 'Token refreshed' });\n};\n`\n : ts\n ? `${RA}import type { Request, Response } from 'express';\n${refreshMeta}export const POST = async (_req: Request, res: Response) => {\n // TODO: validate refresh token, issue new JWT\n res.json({ message: 'Token refreshed' });\n};\n`\n : `${RA}${refreshMeta}export const POST = async (_req, res) => {\n // TODO: validate refresh token, issue new JWT\n res.json({ message: 'Token refreshed' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `refresh.${ext}`), refreshContent);\n }\n\n // verify-email.ts\n if (uf.emailVerification) {\n const veMeta = mkMeta(opts, {\n GET: {\n description: 'Verify an email address using the token from the verification link.',\n query: `{ token: 'a1b2c3d4' }`,\n response: `{ message: 'Email verified' }`,\n },\n POST: {\n description: 'Resend the verification email to a given address.',\n request: `{ email: 'user@example.com' }`,\n response: `{ message: 'Verification email sent' }`,\n },\n });\n const veContent = mongo\n ? ts\n ? `import type { Request, Response } from 'express';\nimport crypto from 'node:crypto';\n${mailerTaskImport}import { User } from '../../model/User.js';\n${veMeta}export const GET = async (req: Request, res: Response) => {\n const { token } = req.query;\n if (!token || typeof token !== 'string') return res.status(400).json({ error: 'token is required' });\n\n const user = await User.findOne({ verifyToken: token });\n if (!user) return res.status(400).json({ error: 'Invalid or expired verification token' });\n\n await User.update(user.id, { isVerified: true, verifyToken: '' });\n res.json({ message: 'Email verified' });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { email } = req.body;\n if (!email) return res.status(400).json({ error: 'email is required' });\n\n const user = await User.findOne({ email });\n if (user && !user.isVerified) {\n const verifyToken = crypto.randomBytes(32).toString('hex');\n await User.update(user.id, { verifyToken });\n${sendVerifyEmailResend} }\n\n res.json({ message: 'Verification email sent' });\n};\n`\n : `import crypto from 'node:crypto';\n${mailerTaskImport}import { User } from '../../model/User.js';\n${veMeta}export const GET = async (req, res) => {\n const { token } = req.query;\n if (!token || typeof token !== 'string') return res.status(400).json({ error: 'token is required' });\n\n const user = await User.findOne({ verifyToken: token });\n if (!user) return res.status(400).json({ error: 'Invalid or expired verification token' });\n\n await User.update(user.id, { isVerified: true, verifyToken: '' });\n res.json({ message: 'Email verified' });\n};\n\nexport const POST = async (req, res) => {\n const { email } = req.body;\n if (!email) return res.status(400).json({ error: 'email is required' });\n\n const user = await User.findOne({ email });\n if (user && !user.isVerified) {\n const verifyToken = crypto.randomBytes(32).toString('hex');\n await User.update(user.id, { verifyToken });\n${sendVerifyEmailResend} }\n\n res.json({ message: 'Verification email sent' });\n};\n`\n : ts\n ? `${RA}import type { Request, Response } from 'express';\n${veMeta}export const GET = async (req: Request, res: Response) => {\n const { token } = req.query;\n // TODO: verify token and mark user as verified\n res.json({ message: 'Email verified' });\n};\n\nexport const POST = async (_req: Request, res: Response) => {\n // TODO: resend verification email\n res.json({ message: 'Verification email sent' });\n};\n`\n : `${RA}${veMeta}export const GET = async (req, res) => {\n const { token } = req.query;\n // TODO: verify token and mark user as verified\n res.json({ message: 'Email verified' });\n};\n\nexport const POST = async (_req, res) => {\n // TODO: resend verification email\n res.json({ message: 'Verification email sent' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `verify-email.${ext}`), veContent);\n }\n\n // forgot-password.ts / reset-password.ts\n if (uf.forgotPassword) {\n const fpMeta = mkMeta(opts, {\n POST: {\n description: 'Send a password reset email to the given address.',\n request: `{ email: 'user@example.com' }`,\n response: `{ message: 'Reset email sent' }`,\n },\n });\n const fpModelImports = `import { User } from '../../model/User.js';\\n${hasAdmin ? `import { Admin } from '../../model/Admin.js';\\n` : ''}`;\n const fpLookup = hasAdmin\n ? ` const user = await User.findOne({ email });\n const admin = user ? null : await Admin.findOne({ email });`\n : ` const user = await User.findOne({ email });`;\n const fpGuard = hasAdmin ? 'user || admin' : 'user';\n const fpPersist = hasAdmin\n ? ` if (user) await User.update(user.id, { resetToken, resetTokenExpiry });\n else if (admin) await Admin.update(admin.id, { resetToken, resetTokenExpiry });`\n : ` await User.update(user.id, { resetToken, resetTokenExpiry });`;\n const fpContent = mongo\n ? ts\n ? `import type { Request, Response } from 'express';\nimport crypto from 'node:crypto';\n${mailerTaskImport}${fpModelImports}${fpMeta}const RESET_TOKEN_TTL_MS = 1000 * 60 * 60; // 1 hour\n\nexport const POST = async (req: Request, res: Response) => {\n const { email } = req.body;\n if (!email) return res.status(400).json({ error: 'email is required' });\n\n${fpLookup}\n\n // Always respond the same way whether or not the account exists, so this\n // endpoint can't be used to enumerate registered emails.\n if (${fpGuard}) {\n const resetToken = crypto.randomBytes(32).toString('hex');\n const resetTokenExpiry = new Date(Date.now() + RESET_TOKEN_TTL_MS);\n${fpPersist}\n${sendResetEmail} }\n\n res.json({ message: 'Reset email sent' });\n};\n`\n : `import crypto from 'node:crypto';\n${mailerTaskImport}${fpModelImports}${fpMeta}const RESET_TOKEN_TTL_MS = 1000 * 60 * 60; // 1 hour\n\nexport const POST = async (req, res) => {\n const { email } = req.body;\n if (!email) return res.status(400).json({ error: 'email is required' });\n\n${fpLookup}\n\n // Always respond the same way whether or not the account exists, so this\n // endpoint can't be used to enumerate registered emails.\n if (${fpGuard}) {\n const resetToken = crypto.randomBytes(32).toString('hex');\n const resetTokenExpiry = new Date(Date.now() + RESET_TOKEN_TTL_MS);\n${fpPersist}\n${sendResetEmail} }\n\n res.json({ message: 'Reset email sent' });\n};\n`\n : ts\n ? `${RA}import type { Request, Response } from 'express';\n${fpMeta}export const POST = async (req: Request, res: Response) => {\n const { email } = req.body;\n if (!email) return res.status(400).json({ error: 'email is required' });\n // TODO: generate reset token and send email\n res.json({ message: 'Reset email sent' });\n};\n`\n : `${RA}${fpMeta}export const POST = async (req, res) => {\n const { email } = req.body;\n if (!email) return res.status(400).json({ error: 'email is required' });\n // TODO: generate reset token and send email\n res.json({ message: 'Reset email sent' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `forgot-password.${ext}`), fpContent);\n\n // reset-password.ts\n const rpMeta = mkMeta(opts, {\n POST: {\n description: 'Reset password using a valid reset token.',\n request: `{ token: 'reset-token', password: 'newpassword' }`,\n response: `{ message: 'Password reset successfully' }`,\n },\n });\n const rpModelImports = `import { User } from '../../model/User.js';\\n${hasAdmin ? `import { Admin } from '../../model/Admin.js';\\n` : ''}`;\n const rpLookup = hasAdmin\n ? ` const user = await User.findOne({ resetToken: token });\n const admin = user ? null : await Admin.findOne({ resetToken: token });\n const account = user || admin;`\n : ` const user = await User.findOne({ resetToken: token });\n const account = user;`;\n const rpPersist = hasAdmin\n ? ` if (user) await User.update(user.id, { password: hashed, resetToken: '' });\n else if (admin) await Admin.update(admin.id, { password: hashed, resetToken: '' });`\n : ` await User.update(user.id, { password: hashed, resetToken: '' });`;\n const rpContent = mongo\n ? ts\n ? `import type { Request, Response } from 'express';\nimport bcrypt from 'bcrypt';\n${rpModelImports}${rpMeta}export const POST = async (req: Request, res: Response) => {\n const { token, password } = req.body;\n if (!token || !password) return res.status(400).json({ error: 'token and password are required' });\n\n${rpLookup}\n\n if (!account || !account.resetTokenExpiry || new Date(account.resetTokenExpiry) < new Date()) {\n return res.status(400).json({ error: 'Invalid or expired reset token' });\n }\n\n const hashed = await bcrypt.hash(password, 10);\n${rpPersist}\n\n res.json({ message: 'Password reset successfully' });\n};\n`\n : `import bcrypt from 'bcrypt';\n${rpModelImports}${rpMeta}export const POST = async (req, res) => {\n const { token, password } = req.body;\n if (!token || !password) return res.status(400).json({ error: 'token and password are required' });\n\n${rpLookup}\n\n if (!account || !account.resetTokenExpiry || new Date(account.resetTokenExpiry) < new Date()) {\n return res.status(400).json({ error: 'Invalid or expired reset token' });\n }\n\n const hashed = await bcrypt.hash(password, 10);\n${rpPersist}\n\n res.json({ message: 'Password reset successfully' });\n};\n`\n : ts\n ? `${RA}import type { Request, Response } from 'express';\n${rpMeta}export const POST = async (req: Request, res: Response) => {\n const { token, password } = req.body;\n if (!token || !password) return res.status(400).json({ error: 'token and password are required' });\n // TODO: validate token, hash and update password\n res.json({ message: 'Password reset successfully' });\n};\n`\n : `${RA}${rpMeta}export const POST = async (req, res) => {\n const { token, password } = req.body;\n if (!token || !password) return res.status(400).json({ error: 'token and password are required' });\n // TODO: validate token, hash and update password\n res.json({ message: 'Password reset successfully' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `reset-password.${ext}`), rpContent);\n }\n\n // change-password.ts (protected)\n if (uf.accountSecurity) {\n const cpMeta = mkMeta(opts, {\n POST: {\n description: 'Change password for the authenticated user.',\n request: `{ oldPassword: 'current', newPassword: 'newpassword' }`,\n response: `{ message: 'Password changed successfully' }`,\n },\n });\n const cpContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${cpMeta}${mwUser2}\nexport const POST = async (req: Request, res: Response) => {\n const { oldPassword, newPassword } = req.body;\n if (!oldPassword || !newPassword) return res.status(400).json({ error: 'oldPassword and newPassword are required' });\n // TODO: verify old password, hash and update new password\n res.json({ message: 'Password changed successfully' });\n};\n`\n : `${RA}${cpMeta}${mwUser2}\nexport const POST = async (req, res) => {\n const { oldPassword, newPassword } = req.body;\n if (!oldPassword || !newPassword) return res.status(400).json({ error: 'oldPassword and newPassword are required' });\n // TODO: verify old password, hash and update new password\n res.json({ message: 'Password changed successfully' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'auth', `change-password.${ext}`), cpContent);\n\n // 2fa/setup.ts\n const tfaSetupMeta = mkMeta(opts, {\n GET: {\n description: 'Generate a TOTP secret and QR code to set up 2FA.',\n response: `{ qrCode: 'otpauth://totp/...', secret: 'BASE32SECRET' }`,\n },\n POST: {\n description: 'Confirm a TOTP code to enable 2FA for the authenticated user.',\n request: `{ code: '123456' }`,\n response: `{ message: '2FA enabled' }`,\n },\n });\n const tfaSetupContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${tfaSetupMeta}${mwUser3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: generate TOTP secret and return QR code URL\n res.json({ qrCode: 'otpauth://totp/...', secret: 'BASE32SECRET' });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { code } = req.body;\n if (!code) return res.status(400).json({ error: 'code is required' });\n // TODO: verify TOTP code and enable 2FA\n res.json({ message: '2FA enabled' });\n};\n`\n : `${RA}${tfaSetupMeta}${mwUser3}\nexport const GET = async (req, res) => {\n // TODO: generate TOTP secret and return QR code URL\n res.json({ qrCode: 'otpauth://totp/...', secret: 'BASE32SECRET' });\n};\n\nexport const POST = async (req, res) => {\n const { code } = req.body;\n if (!code) return res.status(400).json({ error: 'code is required' });\n // TODO: verify TOTP code and enable 2FA\n res.json({ message: '2FA enabled' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'auth', '2fa', `setup.${ext}`),\n tfaSetupContent,\n );\n\n // 2fa/verify.ts\n const tfaVerifyMeta = mkMeta(opts, {\n POST: {\n description: 'Verify a TOTP code during login.',\n request: `{ code: '123456' }`,\n response: `{ message: '2FA verified' }`,\n },\n });\n const tfaVerifyContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${tfaVerifyMeta}export const POST = async (req: Request, res: Response) => {\n const { code } = req.body;\n if (!code) return res.status(400).json({ error: 'code is required' });\n // TODO: verify TOTP code\n res.json({ message: '2FA verified' });\n};\n`\n : `${RA}${tfaVerifyMeta}export const POST = async (req, res) => {\n const { code } = req.body;\n if (!code) return res.status(400).json({ error: 'code is required' });\n // TODO: verify TOTP code\n res.json({ message: '2FA verified' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'auth', '2fa', `verify.${ext}`),\n tfaVerifyContent,\n );\n\n // 2fa/disable.ts\n const tfaDisableMeta = mkMeta(opts, {\n POST: {\n description: 'Disable 2FA for the authenticated user.',\n request: `{ code: '123456' }`,\n response: `{ message: '2FA disabled' }`,\n },\n });\n const tfaDisableContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${tfaDisableMeta}${mwUser3}\nexport const POST = async (req: Request, res: Response) => {\n const { code } = req.body;\n if (!code) return res.status(400).json({ error: 'code is required' });\n // TODO: verify code and disable 2FA\n res.json({ message: '2FA disabled' });\n};\n`\n : `${RA}${tfaDisableMeta}${mwUser3}\nexport const POST = async (req, res) => {\n const { code } = req.body;\n if (!code) return res.status(400).json({ error: 'code is required' });\n // TODO: verify code and disable 2FA\n res.json({ message: '2FA disabled' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'auth', '2fa', `disable.${ext}`),\n tfaDisableContent,\n );\n\n // sessions/index.ts\n const sessListMeta = mkMeta(opts, {\n GET: {\n description: 'List all active sessions for the authenticated user.',\n response: `{ sessions: [] }`,\n },\n });\n const sessListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${sessListMeta}${mwUser3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch sessions for req.user.id\n res.json({ sessions: [] });\n};\n`\n : `${RA}${sessListMeta}${mwUser3}\nexport const GET = async (req, res) => {\n // TODO: fetch sessions for req.user.id\n res.json({ sessions: [] });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'auth', 'sessions', `index.${ext}`),\n sessListContent,\n );\n\n // sessions/[id].ts\n const sessRevokeMeta = mkMeta(opts, {\n DELETE: {\n description: 'Revoke a single active session by ID.',\n params: `{ id: 'sess_01HXZ' }`,\n response: `{ message: 'Session sess_01HXZ revoked' }`,\n },\n });\n const sessRevokeContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${sessRevokeMeta}${mwUser3}\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: revoke session by id\n res.json({ message: \\`Session \\${id} revoked\\` });\n};\n`\n : `${RA}${sessRevokeMeta}${mwUser3}\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: revoke session by id\n res.json({ message: \\`Session \\${id} revoked\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'auth', 'sessions', `[id].${ext}`),\n sessRevokeContent,\n );\n }\n}\n\nasync function writeUserExtendedRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n // user/* = 2 levels up to src/, user/subdir/* = 3 levels\n const mw2 = opts.rbac\n ? `export const middlewares = [requireAuth('user', 'admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n const mw3 = mw2;\n const RA = `import { requireAuth } from 'express-file-cluster/auth';\\n`;\n const user = ts ? `(req as any).user` : `req.user`;\n const uf = opts.userFeatures;\n\n // avatar.ts\n if (uf.accountSettings) {\n const avatarMeta = mkMeta(opts, {\n POST: {\n description: 'Upload a new avatar image for the authenticated user.',\n response: `{ message: 'Avatar updated', url: 'https://example.com/avatar.jpg' }`,\n },\n DELETE: {\n description: \"Remove the authenticated user's avatar.\",\n response: `{ message: 'Avatar removed' }`,\n },\n });\n const avatarContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${avatarMeta}${mw2}\nexport const POST = async (req: Request, res: Response) => {\n // TODO: handle multipart upload, store file, update user.avatar\n res.json({ message: 'Avatar updated', url: 'https://example.com/avatar.jpg' });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n // TODO: remove avatar and clear user.avatar\n res.json({ message: 'Avatar removed' });\n};\n`\n : `${RA}${avatarMeta}${mw2}\nexport const POST = async (req, res) => {\n // TODO: handle multipart upload, store file, update user.avatar\n res.json({ message: 'Avatar updated', url: 'https://example.com/avatar.jpg' });\n};\n\nexport const DELETE = async (req, res) => {\n // TODO: remove avatar and clear user.avatar\n res.json({ message: 'Avatar removed' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `avatar.${ext}`), avatarContent);\n\n // settings.ts\n const settingsMeta = mkMeta(opts, {\n GET: {\n description:\n 'Get account settings (notifications, language, theme, privacy) for the authenticated user.',\n response: `{ settings: { notifications: true, language: 'en', theme: 'system', privacy: 'public' } }`,\n },\n PUT: {\n description: 'Update account settings for the authenticated user.',\n request: `{ notifications: true, language: 'en', theme: 'system', privacy: 'public' }`,\n response: `{ message: 'Settings updated', settings: { notifications: true, language: 'en', theme: 'system', privacy: 'public' } }`,\n },\n });\n const settingsContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${settingsMeta}${mw2}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch user settings from DB\n res.json({ settings: { notifications: true, language: 'en', theme: 'system', privacy: 'public' } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n const { notifications, language, theme, privacy } = req.body;\n // TODO: update user settings in DB\n res.json({ message: 'Settings updated', settings: { notifications, language, theme, privacy } });\n};\n`\n : `${RA}${settingsMeta}${mw2}\nexport const GET = async (req, res) => {\n // TODO: fetch user settings from DB\n res.json({ settings: { notifications: true, language: 'en', theme: 'system', privacy: 'public' } });\n};\n\nexport const PUT = async (req, res) => {\n const { notifications, language, theme, privacy } = req.body;\n // TODO: update user settings in DB\n res.json({ message: 'Settings updated', settings: { notifications, language, theme, privacy } });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `settings.${ext}`), settingsContent);\n\n // account.ts\n const accountMeta = mkMeta(opts, {\n GET: {\n description: 'Download a personal data export for the authenticated user.',\n response: `{ data: { user: { id: '1', role: 'user', email: 'user@example.com' }, exportedAt: '2026-01-01T00:00:00.000Z' } }`,\n },\n DELETE: {\n description:\n 'Schedule the authenticated account for deletion (requires password confirmation).',\n request: `{ password: 'current' }`,\n response: `{ message: 'Account scheduled for deletion' }`,\n },\n });\n const accountContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${accountMeta}${mw2}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: compile and return personal data export\n res.json({ data: { user: ${user}, exportedAt: new Date().toISOString() } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n const { password } = req.body;\n if (!password) return res.status(400).json({ error: 'password confirmation required' });\n // TODO: verify password, schedule account deletion\n res.json({ message: 'Account scheduled for deletion' });\n};\n`\n : `${RA}${accountMeta}${mw2}\nexport const GET = async (req, res) => {\n // TODO: compile and return personal data export\n res.json({ data: { user: ${user}, exportedAt: new Date().toISOString() } });\n};\n\nexport const DELETE = async (req, res) => {\n const { password } = req.body;\n if (!password) return res.status(400).json({ error: 'password confirmation required' });\n // TODO: verify password, schedule account deletion\n res.json({ message: 'Account scheduled for deletion' });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `account.${ext}`), accountContent);\n\n // dashboard.ts\n const dashMeta = mkMeta(opts, {\n GET: {\n description: 'Personal dashboard: stats, recent activity, and quick actions.',\n response: `{ stats: {}, recentActivity: [], quickActions: [] }`,\n },\n });\n const dashContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${dashMeta}${mw2}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: aggregate personal stats and activity\n res.json({ stats: {}, recentActivity: [], quickActions: [] });\n};\n`\n : `${RA}${dashMeta}${mw2}\nexport const GET = async (req, res) => {\n // TODO: aggregate personal stats and activity\n res.json({ stats: {}, recentActivity: [], quickActions: [] });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `dashboard.${ext}`), dashContent);\n\n // activity.ts\n const actMeta = mkMeta(opts, {\n GET: {\n description: 'Paginated activity history for the authenticated user.',\n query: `{ page: '1', limit: '20' }`,\n response: `{ activities: [], total: 0, page: 1, limit: 20 }`,\n },\n });\n const actContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${actMeta}${mw2}\nexport const GET = async (req: Request, res: Response) => {\n const { page = 1, limit = 20 } = req.query;\n // TODO: fetch paginated activity log\n res.json({ activities: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`\n : `${RA}${actMeta}${mw2}\nexport const GET = async (req, res) => {\n const { page = 1, limit = 20 } = req.query;\n // TODO: fetch paginated activity log\n res.json({ activities: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `activity.${ext}`), actContent);\n }\n\n // notifications/index.ts\n if (uf.notifications) {\n const notifListMeta = mkMeta(opts, {\n GET: {\n description: 'List notifications for the authenticated user.',\n response: `{ notifications: [], total: 0, unread: 0 }`,\n },\n POST: {\n description: 'Mark all notifications as read for the authenticated user.',\n response: `{ message: 'All notifications marked as read' }`,\n },\n });\n const notifListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${notifListMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch notifications for user\n res.json({ notifications: [], total: 0, unread: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n // TODO: mark all notifications as read\n res.json({ message: 'All notifications marked as read' });\n};\n`\n : `${RA}${notifListMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch notifications for user\n res.json({ notifications: [], total: 0, unread: 0 });\n};\n\nexport const POST = async (req, res) => {\n // TODO: mark all notifications as read\n res.json({ message: 'All notifications marked as read' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'notifications', `index.${ext}`),\n notifListContent,\n );\n\n // notifications/[id].ts\n const notifByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Fetch a single notification by ID.',\n params: `{ id: 'notif_01HXZ' }`,\n response: `{ notification: { id: 'notif_01HXZ' } }`,\n },\n PATCH: {\n description: 'Mark a single notification as read.',\n params: `{ id: 'notif_01HXZ' }`,\n response: `{ message: 'Notification marked as read', id: 'notif_01HXZ' }`,\n },\n DELETE: {\n description: 'Delete a single notification.',\n params: `{ id: 'notif_01HXZ' }`,\n response: `{ message: 'Notification notif_01HXZ deleted' }`,\n },\n });\n const notifByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${notifByIdMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: fetch notification by id\n res.json({ notification: { id } });\n};\n\nexport const PATCH = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: mark notification as read\n res.json({ message: 'Notification marked as read', id });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: delete notification\n res.json({ message: \\`Notification \\${id} deleted\\` });\n};\n`\n : `${RA}${notifByIdMeta}${mw3}\nexport const GET = async (req, res) => {\n const { id } = req.params;\n // TODO: fetch notification by id\n res.json({ notification: { id } });\n};\n\nexport const PATCH = async (req, res) => {\n const { id } = req.params;\n // TODO: mark notification as read\n res.json({ message: 'Notification marked as read', id });\n};\n\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: delete notification\n res.json({ message: \\`Notification \\${id} deleted\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'notifications', `[id].${ext}`),\n notifByIdContent,\n );\n }\n\n // files/index.ts (files, favorites, bookmarks & search share the filesAndMedia toggle)\n if (uf.filesAndMedia) {\n const filesListMeta = mkMeta(opts, {\n GET: {\n description: 'List uploaded files with storage usage for the authenticated user.',\n response: `{ files: [], total: 0, storageUsed: 0 }`,\n },\n POST: {\n description: 'Upload a new file for the authenticated user.',\n response: `{ message: 'File uploaded', file: { id: 'new-id' } }`,\n status: 201,\n },\n });\n const filesListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${filesListMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch user files and compute storage usage\n res.json({ files: [], total: 0, storageUsed: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n // TODO: handle multipart upload, persist file record\n res.status(201).json({ message: 'File uploaded', file: { id: 'new-id' } });\n};\n`\n : `${RA}${filesListMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch user files and compute storage usage\n res.json({ files: [], total: 0, storageUsed: 0 });\n};\n\nexport const POST = async (req, res) => {\n // TODO: handle multipart upload, persist file record\n res.status(201).json({ message: 'File uploaded', file: { id: 'new-id' } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'files', `index.${ext}`),\n filesListContent,\n );\n\n // files/[id].ts\n const fileByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Get a download/preview URL for a single file by ID.',\n params: `{ id: 'file_01HXZ' }`,\n response: `{ file: { id: 'file_01HXZ', url: 'https://example.com/files/file_01HXZ' } }`,\n },\n DELETE: {\n description: 'Delete a file from storage.',\n params: `{ id: 'file_01HXZ' }`,\n response: `{ message: 'File file_01HXZ deleted' }`,\n },\n });\n const fileByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${fileByIdMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: stream or redirect to file download/preview URL\n res.json({ file: { id, url: 'https://...' } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: delete file from storage and DB\n res.json({ message: \\`File \\${id} deleted\\` });\n};\n`\n : `${RA}${fileByIdMeta}${mw3}\nexport const GET = async (req, res) => {\n const { id } = req.params;\n // TODO: stream or redirect to file download/preview URL\n res.json({ file: { id, url: 'https://...' } });\n};\n\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: delete file from storage and DB\n res.json({ message: \\`File \\${id} deleted\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'files', `[id].${ext}`),\n fileByIdContent,\n );\n\n // favorites/index.ts\n const favListMeta = mkMeta(opts, {\n GET: {\n description: 'List favorites for the authenticated user.',\n response: `{ favorites: [] }`,\n },\n POST: {\n description: \"Add an entity to the authenticated user's favorites.\",\n request: `{ entityId: 'post_01HXZ', entityType: 'post' }`,\n response: `{ message: 'Added to favorites' }`,\n status: 201,\n },\n });\n const favListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${favListMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch user favorites\n res.json({ favorites: [] });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { entityId, entityType } = req.body;\n if (!entityId || !entityType) return res.status(400).json({ error: 'entityId and entityType are required' });\n // TODO: add to favorites\n res.status(201).json({ message: 'Added to favorites' });\n};\n`\n : `${RA}${favListMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch user favorites\n res.json({ favorites: [] });\n};\n\nexport const POST = async (req, res) => {\n const { entityId, entityType } = req.body;\n if (!entityId || !entityType) return res.status(400).json({ error: 'entityId and entityType are required' });\n // TODO: add to favorites\n res.status(201).json({ message: 'Added to favorites' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'favorites', `index.${ext}`),\n favListContent,\n );\n\n // favorites/[id].ts\n const favByIdMeta = mkMeta(opts, {\n DELETE: {\n description: 'Remove an entity from the authenticated user favorites.',\n params: `{ id: 'fav_01HXZ' }`,\n response: `{ message: 'Removed favorite fav_01HXZ' }`,\n },\n });\n const favByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${favByIdMeta}${mw3}\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: remove from favorites\n res.json({ message: \\`Removed favorite \\${id}\\` });\n};\n`\n : `${RA}${favByIdMeta}${mw3}\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: remove from favorites\n res.json({ message: \\`Removed favorite \\${id}\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'favorites', `[id].${ext}`),\n favByIdContent,\n );\n\n // bookmarks/index.ts\n const bkListMeta = mkMeta(opts, {\n GET: {\n description: 'List bookmarks for the authenticated user.',\n response: `{ bookmarks: [] }`,\n },\n POST: {\n description: 'Save a new bookmark for the authenticated user.',\n request: `{ url: 'https://example.com', title: 'Example' }`,\n response: `{ message: 'Bookmark saved' }`,\n status: 201,\n },\n });\n const bkListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${bkListMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch user bookmarks\n res.json({ bookmarks: [] });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { url, title } = req.body;\n if (!url) return res.status(400).json({ error: 'url is required' });\n // TODO: save bookmark\n res.status(201).json({ message: 'Bookmark saved' });\n};\n`\n : `${RA}${bkListMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch user bookmarks\n res.json({ bookmarks: [] });\n};\n\nexport const POST = async (req, res) => {\n const { url, title } = req.body;\n if (!url) return res.status(400).json({ error: 'url is required' });\n // TODO: save bookmark\n res.status(201).json({ message: 'Bookmark saved' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'bookmarks', `index.${ext}`),\n bkListContent,\n );\n\n // bookmarks/[id].ts\n const bkByIdMeta = mkMeta(opts, {\n DELETE: {\n description: 'Delete a bookmark by ID.',\n params: `{ id: 'bm_01HXZ' }`,\n response: `{ message: 'Bookmark bm_01HXZ removed' }`,\n },\n });\n const bkByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${bkByIdMeta}${mw3}\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: delete bookmark\n res.json({ message: \\`Bookmark \\${id} removed\\` });\n};\n`\n : `${RA}${bkByIdMeta}${mw3}\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: delete bookmark\n res.json({ message: \\`Bookmark \\${id} removed\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'bookmarks', `[id].${ext}`),\n bkByIdContent,\n );\n\n // search.ts\n const searchMeta = mkMeta(opts, {\n GET: {\n description: 'Search with filters, sort, and pagination.',\n query: `{ q: 'query', filter: 'active', sort: 'newest', page: '1', limit: '20' }`,\n response: `{ results: [], total: 0, page: 1, limit: 20 }`,\n },\n });\n const searchContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${searchMeta}${mw2}\nexport const GET = async (req: Request, res: Response) => {\n const { q, filter, sort, page = 1, limit = 20 } = req.query;\n // TODO: implement search\n res.json({ results: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`\n : `${RA}${searchMeta}${mw2}\nexport const GET = async (req, res) => {\n const { q, filter, sort, page = 1, limit = 20 } = req.query;\n // TODO: implement search\n res.json({ results: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`;\n await fs.outputFile(path.join(dest, 'src', 'api', 'user', `search.${ext}`), searchContent);\n }\n\n // api-keys/index.ts\n if (uf.apiAndBilling) {\n const akListMeta = mkMeta(opts, {\n GET: { description: 'List API keys for the authenticated user.', response: `{ apiKeys: [] }` },\n POST: {\n description: 'Generate a new API key for the authenticated user.',\n request: `{ name: 'CI key' }`,\n response: `{ message: 'API key created', key: 'efc_...' }`,\n status: 201,\n },\n });\n const akListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${akListMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch api keys for user\n res.json({ apiKeys: [] });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { name } = req.body;\n if (!name) return res.status(400).json({ error: 'name is required' });\n // TODO: generate and store API key\n res.status(201).json({ message: 'API key created', key: 'efc_...' });\n};\n`\n : `${RA}${akListMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch api keys for user\n res.json({ apiKeys: [] });\n};\n\nexport const POST = async (req, res) => {\n const { name } = req.body;\n if (!name) return res.status(400).json({ error: 'name is required' });\n // TODO: generate and store API key\n res.status(201).json({ message: 'API key created', key: 'efc_...' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'api-keys', `index.${ext}`),\n akListContent,\n );\n\n // api-keys/[id].ts\n const akByIdMeta = mkMeta(opts, {\n DELETE: {\n description: 'Revoke and delete an API key by ID.',\n params: `{ id: 'key_01HXZ' }`,\n response: `{ message: 'API key key_01HXZ revoked' }`,\n },\n });\n const akByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${akByIdMeta}${mw3}\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: revoke and delete API key\n res.json({ message: \\`API key \\${id} revoked\\` });\n};\n`\n : `${RA}${akByIdMeta}${mw3}\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: revoke and delete API key\n res.json({ message: \\`API key \\${id} revoked\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'api-keys', `[id].${ext}`),\n akByIdContent,\n );\n }\n}\n\nasync function writeUserBillingRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n // user/billing/* = 3 levels, user/billing/subdir/* = 4 levels\n const mw3 = opts.rbac\n ? `export const middlewares = [requireAuth('user', 'admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n const mw4 = mw3;\n const RA = `import { requireAuth } from 'express-file-cluster/auth';\\n`;\n\n // billing/plans.ts\n const plansMeta = mkMeta(opts, {\n GET: { description: 'List all available subscription plans.', response: `{ plans: [] }` },\n });\n const plansContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${plansMeta}${mw3}\nexport const GET = async (_req: Request, res: Response) => {\n // TODO: fetch active plans from DB\n res.json({ plans: [] });\n};\n`\n : `${RA}${plansMeta}${mw3}\nexport const GET = async (_req, res) => {\n // TODO: fetch active plans from DB\n res.json({ plans: [] });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'billing', `plans.${ext}`),\n plansContent,\n );\n\n // billing/subscription.ts\n const subMeta = mkMeta(opts, {\n GET: {\n description: 'Get the current subscription for the authenticated user.',\n response: `{ subscription: null }`,\n },\n POST: {\n description: 'Subscribe the authenticated user to a plan.',\n request: `{ planId: 'plan_01HXZ' }`,\n response: `{ message: 'Subscribed', subscription: { planId: 'plan_01HXZ' } }`,\n status: 201,\n },\n DELETE: {\n description: 'Cancel the current subscription at period end.',\n response: `{ message: 'Subscription cancelled' }`,\n },\n });\n const subContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${subMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch current subscription for user\n res.json({ subscription: null });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { planId } = req.body;\n if (!planId) return res.status(400).json({ error: 'planId is required' });\n // TODO: create subscription via payment gateway\n res.status(201).json({ message: 'Subscribed', subscription: { planId } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n // TODO: cancel subscription at period end\n res.json({ message: 'Subscription cancelled' });\n};\n`\n : `${RA}${subMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch current subscription for user\n res.json({ subscription: null });\n};\n\nexport const POST = async (req, res) => {\n const { planId } = req.body;\n if (!planId) return res.status(400).json({ error: 'planId is required' });\n // TODO: create subscription via payment gateway\n res.status(201).json({ message: 'Subscribed', subscription: { planId } });\n};\n\nexport const DELETE = async (req, res) => {\n // TODO: cancel subscription at period end\n res.json({ message: 'Subscription cancelled' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'billing', `subscription.${ext}`),\n subContent,\n );\n\n // billing/payment-methods/index.ts\n const pmListMeta = mkMeta(opts, {\n GET: {\n description: 'List payment methods for the authenticated user.',\n response: `{ paymentMethods: [] }`,\n },\n POST: {\n description: 'Attach a new payment method via the payment gateway.',\n request: `{ token: 'tok_...' }`,\n response: `{ message: 'Payment method added' }`,\n status: 201,\n },\n });\n const pmListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${pmListMeta}${mw4}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch payment methods for user\n res.json({ paymentMethods: [] });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { token } = req.body;\n if (!token) return res.status(400).json({ error: 'payment token is required' });\n // TODO: attach payment method via payment gateway\n res.status(201).json({ message: 'Payment method added' });\n};\n`\n : `${RA}${pmListMeta}${mw4}\nexport const GET = async (req, res) => {\n // TODO: fetch payment methods for user\n res.json({ paymentMethods: [] });\n};\n\nexport const POST = async (req, res) => {\n const { token } = req.body;\n if (!token) return res.status(400).json({ error: 'payment token is required' });\n // TODO: attach payment method via payment gateway\n res.status(201).json({ message: 'Payment method added' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'billing', 'payment-methods', `index.${ext}`),\n pmListContent,\n );\n\n // billing/payment-methods/[id].ts\n const pmByIdMeta = mkMeta(opts, {\n DELETE: {\n description: 'Detach a payment method from the payment gateway.',\n params: `{ id: 'pm_01HXZ' }`,\n response: `{ message: 'Payment method pm_01HXZ removed' }`,\n },\n });\n const pmByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${pmByIdMeta}${mw4}\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: detach payment method from payment gateway\n res.json({ message: \\`Payment method \\${id} removed\\` });\n};\n`\n : `${RA}${pmByIdMeta}${mw4}\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: detach payment method from payment gateway\n res.json({ message: \\`Payment method \\${id} removed\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'billing', 'payment-methods', `[id].${ext}`),\n pmByIdContent,\n );\n\n // billing/invoices/index.ts\n const invListMeta = mkMeta(opts, {\n GET: {\n description: 'List all invoices for the authenticated user.',\n response: `{ invoices: [], total: 0 }`,\n },\n });\n const invListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${invListMeta}${mw4}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch invoices for user\n res.json({ invoices: [], total: 0 });\n};\n`\n : `${RA}${invListMeta}${mw4}\nexport const GET = async (req, res) => {\n // TODO: fetch invoices for user\n res.json({ invoices: [], total: 0 });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'billing', 'invoices', `index.${ext}`),\n invListContent,\n );\n\n // billing/invoices/[id].ts\n const invByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Get the download URL for a single invoice by ID.',\n params: `{ id: 'inv_01HXZ' }`,\n response: `{ invoice: { id: 'inv_01HXZ', downloadUrl: 'https://example.com/invoices/inv_01HXZ.pdf' } }`,\n },\n });\n const invByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${invByIdMeta}${mw4}\nexport const GET = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: return invoice PDF URL or inline data\n res.json({ invoice: { id, downloadUrl: 'https://...' } });\n};\n`\n : `${RA}${invByIdMeta}${mw4}\nexport const GET = async (req, res) => {\n const { id } = req.params;\n // TODO: return invoice PDF URL or inline data\n res.json({ invoice: { id, downloadUrl: 'https://...' } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'user', 'billing', 'invoices', `[id].${ext}`),\n invByIdContent,\n );\n}\n\nasync function writeSupportRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n // support/tickets/* = 3 levels\n const mw3 = opts.rbac\n ? `export const middlewares = [requireAuth('user', 'admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n const RA = `import { requireAuth } from 'express-file-cluster/auth';\\n`;\n\n // support/tickets/index.ts\n const ticketListMeta = mkMeta(opts, {\n GET: {\n description: \"List the authenticated user's own support tickets.\",\n response: `{ tickets: [], total: 0 }`,\n },\n POST: {\n description: 'Create a new support ticket.',\n request: `{ subject: 'Issue with login', message: 'I cannot log in', priority: 'normal' }`,\n response: `{ message: 'Ticket created', ticket: { id: 'new-id', subject: 'Issue with login', status: 'open' } }`,\n status: 201,\n },\n });\n const ticketListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${ticketListMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n // TODO: fetch tickets for current user\n res.json({ tickets: [], total: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { subject, message, priority } = req.body;\n if (!subject || !message) return res.status(400).json({ error: 'subject and message are required' });\n // TODO: create support ticket in DB\n res.status(201).json({ message: 'Ticket created', ticket: { id: 'new-id', subject, status: 'open' } });\n};\n`\n : `${RA}${ticketListMeta}${mw3}\nexport const GET = async (req, res) => {\n // TODO: fetch tickets for current user\n res.json({ tickets: [], total: 0 });\n};\n\nexport const POST = async (req, res) => {\n const { subject, message, priority } = req.body;\n if (!subject || !message) return res.status(400).json({ error: 'subject and message are required' });\n // TODO: create support ticket in DB\n res.status(201).json({ message: 'Ticket created', ticket: { id: 'new-id', subject, status: 'open' } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'support', 'tickets', `index.${ext}`),\n ticketListContent,\n );\n\n // support/tickets/[id].ts\n const ticketByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Fetch a single support ticket by ID.',\n params: `{ id: 'tk_01HXZ' }`,\n response: `{ ticket: { id: 'tk_01HXZ', subject: 'Issue', status: 'open', replies: [] } }`,\n },\n PUT: {\n description: 'Add a reply to a support ticket or update its status.',\n params: `{ id: 'tk_01HXZ' }`,\n request: `{ reply: 'Thanks, resolved.', status: 'closed' }`,\n response: `{ message: 'Ticket updated', ticket: { id: 'tk_01HXZ', status: 'closed' } }`,\n },\n });\n const ticketByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${ticketByIdMeta}${mw3}\nexport const GET = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: fetch ticket by id, verify ownership\n res.json({ ticket: { id, subject: '', status: 'open', replies: [] } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n const { id } = req.params;\n const { reply, status } = req.body;\n // TODO: add reply or update status\n res.json({ message: 'Ticket updated', ticket: { id, status: status ?? 'open' } });\n};\n`\n : `${RA}${ticketByIdMeta}${mw3}\nexport const GET = async (req, res) => {\n const { id } = req.params;\n // TODO: fetch ticket by id, verify ownership\n res.json({ ticket: { id, subject: '', status: 'open', replies: [] } });\n};\n\nexport const PUT = async (req, res) => {\n const { id } = req.params;\n const { reply, status } = req.body;\n // TODO: add reply or update status\n res.json({ message: 'Ticket updated', ticket: { id, status: status ?? 'open' } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'support', 'tickets', `[id].${ext}`),\n ticketByIdContent,\n );\n}\n\nasync function writeAdminExtendedRoutes(dest: string, opts: ScaffoldOptions): Promise<void> {\n const ext = opts.language === 'typescript' ? 'ts' : 'js';\n const ts = opts.language === 'typescript';\n // depth: admin/subdir/* = 3, admin/subdir/subdir/* = 4, admin/users/[id]/* = 4\n const mwAdmin3 = opts.rbac\n ? `export const middlewares = [requireAuth('admin')];\\n`\n : `export const middlewares = [requireAuth];\\n`;\n const mwAdmin4 = mwAdmin3;\n const roleGuard = opts.rbac\n ? ''\n : ts\n ? ` const user = (req as any).user;\\n if (user?.role !== 'admin') return res.status(403).json({ error: 'Forbidden' });\\n`\n : ` const user = req.user;\\n if (user?.role !== 'admin') return res.status(403).json({ error: 'Forbidden' });\\n`;\n const RA = `import { requireAuth } from 'express-file-cluster/auth';\\n`;\n const af = opts.adminFeatures;\n\n // ── Analytics ──────────────────────────────────────────────────────────\n if (af.analytics) {\n // admin/analytics/index.ts\n const analyticsOverviewMeta = mkMeta(opts, {\n GET: {\n description: 'Analytics overview: users, revenue, traffic (admin only).',\n response: `{ users: {}, revenue: {}, traffic: {} }`,\n },\n });\n const analyticsOverviewContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${analyticsOverviewMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} // TODO: aggregate analytics overview\n res.json({ users: {}, revenue: {}, traffic: {} });\n};\n`\n : `${RA}${analyticsOverviewMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} // TODO: aggregate analytics overview\n res.json({ users: {}, revenue: {}, traffic: {} });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'analytics', `index.${ext}`),\n analyticsOverviewContent,\n );\n\n const analyticsUsersMeta = mkMeta(opts, {\n GET: {\n description: 'User analytics: registrations, active users, churn (admin only).',\n query: `{ period: '30d' }`,\n response: `{ registrations: [], activeUsers: 0, churn: 0, period: '30d' }`,\n },\n });\n const analyticsUsersContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${analyticsUsersMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { period = '30d' } = req.query;\n // TODO: fetch user analytics for period\n res.json({ registrations: [], activeUsers: 0, churn: 0, period });\n};\n`\n : `${RA}${analyticsUsersMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { period = '30d' } = req.query;\n // TODO: fetch user analytics for period\n res.json({ registrations: [], activeUsers: 0, churn: 0, period });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'analytics', `users.${ext}`),\n analyticsUsersContent,\n );\n\n const analyticsRevenueMeta = mkMeta(opts, {\n GET: {\n description: 'Revenue analytics: MRR, ARR, payment history (admin only).',\n query: `{ period: '30d' }`,\n response: `{ mrr: 0, arr: 0, history: [], period: '30d' }`,\n },\n });\n const analyticsRevenueContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${analyticsRevenueMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { period = '30d' } = req.query;\n // TODO: fetch revenue analytics for period\n res.json({ mrr: 0, arr: 0, history: [], period });\n};\n`\n : `${RA}${analyticsRevenueMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { period = '30d' } = req.query;\n // TODO: fetch revenue analytics for period\n res.json({ mrr: 0, arr: 0, history: [], period });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'analytics', `revenue.${ext}`),\n analyticsRevenueContent,\n );\n\n const analyticsTrafficMeta = mkMeta(opts, {\n GET: {\n description: 'Traffic analytics: page views, devices, countries (admin only).',\n query: `{ period: '30d' }`,\n response: `{ pageViews: 0, devices: {}, countries: {}, period: '30d' }`,\n },\n });\n const analyticsTrafficContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${analyticsTrafficMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { period = '30d' } = req.query;\n // TODO: fetch traffic analytics for period\n res.json({ pageViews: 0, devices: {}, countries: {}, period });\n};\n`\n : `${RA}${analyticsTrafficMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { period = '30d' } = req.query;\n // TODO: fetch traffic analytics for period\n res.json({ pageViews: 0, devices: {}, countries: {}, period });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'analytics', `traffic.${ext}`),\n analyticsTrafficContent,\n );\n }\n\n // ── User Actions ──────────────────────────────────────────────────────\n if (af.userManagement) {\n // admin/users/[id]/suspend.ts\n const suspendMeta = mkMeta(opts, {\n POST: {\n description: 'Suspend a user account (admin only).',\n params: `{ id: 'usr_01HXZ' }`,\n request: `{ reason: 'Terms of service violation' }`,\n response: `{ message: 'User usr_01HXZ suspended', reason: 'Terms of service violation' }`,\n },\n });\n const suspendContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${suspendMeta}${mwAdmin4}\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n const { reason } = req.body;\n // TODO: set user.isActive = false, log audit event\n res.json({ message: \\`User \\${id} suspended\\`, reason });\n};\n`\n : `${RA}${suspendMeta}${mwAdmin4}\nexport const POST = async (req, res) => {\n${roleGuard} const { id } = req.params;\n const { reason } = req.body;\n // TODO: set user.isActive = false, log audit event\n res.json({ message: \\`User \\${id} suspended\\`, reason });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'users', '[id]', `suspend.${ext}`),\n suspendContent,\n );\n\n // admin/users/[id]/activate.ts\n const activateMeta = mkMeta(opts, {\n POST: {\n description: 'Reactivate a suspended user account (admin only).',\n params: `{ id: 'usr_01HXZ' }`,\n response: `{ message: 'User usr_01HXZ activated' }`,\n },\n });\n const activateContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${activateMeta}${mwAdmin4}\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: set user.isActive = true, log audit event\n res.json({ message: \\`User \\${id} activated\\` });\n};\n`\n : `${RA}${activateMeta}${mwAdmin4}\nexport const POST = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: set user.isActive = true, log audit event\n res.json({ message: \\`User \\${id} activated\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'users', '[id]', `activate.${ext}`),\n activateContent,\n );\n\n // admin/users/[id]/verify.ts\n const verifyUserMeta = mkMeta(opts, {\n POST: {\n description: \"Mark a user's email as verified (admin only).\",\n params: `{ id: 'usr_01HXZ' }`,\n response: `{ message: 'User usr_01HXZ verified' }`,\n },\n });\n const verifyUserContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${verifyUserMeta}${mwAdmin4}\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: set user.isVerified = true\n res.json({ message: \\`User \\${id} verified\\` });\n};\n`\n : `${RA}${verifyUserMeta}${mwAdmin4}\nexport const POST = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: set user.isVerified = true\n res.json({ message: \\`User \\${id} verified\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'users', '[id]', `verify.${ext}`),\n verifyUserContent,\n );\n\n // admin/users/export.ts\n const exportMeta = mkMeta(opts, {\n GET: {\n description: 'Export all users as a CSV download (admin only).',\n response: `'id,name,email,role,createdAt\\\\n'`,\n },\n });\n const exportContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${exportMeta}${mwAdmin3}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: generate CSV of all users and stream response\n res.setHeader('Content-Type', 'text/csv');\n res.setHeader('Content-Disposition', 'attachment; filename=\"users.csv\"');\n res.send('id,name,email,role,createdAt\\\\n');\n};\n`\n : `${RA}${exportMeta}${mwAdmin3}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: generate CSV of all users and stream response\n res.setHeader('Content-Type', 'text/csv');\n res.setHeader('Content-Disposition', 'attachment; filename=\"users.csv\"');\n res.send('id,name,email,role,createdAt\\\\n');\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'users', `export.${ext}`),\n exportContent,\n );\n }\n\n // ── Admins ────────────────────────────────────────────────────────────\n if (af.adminManagement) {\n // admin/admins/index.ts\n const adminsListMeta = mkMeta(opts, {\n GET: {\n description: 'List all admin accounts (admin only).',\n response: `{ admins: [], total: 0 }`,\n },\n POST: {\n description: 'Create a new admin account (admin only).',\n request: `{ name: 'Jane Doe', email: 'jane@example.com', role: 'admin' }`,\n response: `{ message: 'Admin created', admin: { id: 'new-id', name: 'Jane Doe', email: 'jane@example.com', role: 'admin' } }`,\n status: 201,\n },\n });\n const adminsListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${adminsListMeta}${mwAdmin3}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: fetch admins from DB\n res.json({ admins: [], total: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { name, email, role } = req.body;\n if (!name || !email) return res.status(400).json({ error: 'name and email are required' });\n // TODO: create admin account\n res.status(201).json({ message: 'Admin created', admin: { id: 'new-id', name, email, role: role ?? 'admin' } });\n};\n`\n : `${RA}${adminsListMeta}${mwAdmin3}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: fetch admins from DB\n res.json({ admins: [], total: 0 });\n};\n\nexport const POST = async (req, res) => {\n${roleGuard} const { name, email, role } = req.body;\n if (!name || !email) return res.status(400).json({ error: 'name and email are required' });\n // TODO: create admin account\n res.status(201).json({ message: 'Admin created', admin: { id: 'new-id', name, email, role: role ?? 'admin' } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'admins', `index.${ext}`),\n adminsListContent,\n );\n\n // admin/admins/[id].ts\n const adminByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Fetch a single admin account by ID (admin only).',\n params: `{ id: 'adm_01HXZ' }`,\n response: `{ admin: { id: 'adm_01HXZ' } }`,\n },\n PUT: {\n description: 'Update an admin account by ID (admin only).',\n params: `{ id: 'adm_01HXZ' }`,\n request: `{ name: 'Jane Doe', role: 'admin' }`,\n response: `{ message: 'Admin updated', admin: { id: 'adm_01HXZ', name: 'Jane Doe', role: 'admin' } }`,\n },\n DELETE: {\n description: 'Delete an admin account by ID (admin only).',\n params: `{ id: 'adm_01HXZ' }`,\n response: `{ message: 'Admin adm_01HXZ deleted' }`,\n },\n });\n const adminByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${adminByIdMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch admin by id\n res.json({ admin: { id } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: update admin record\n res.json({ message: 'Admin updated', admin: { id, ...req.body } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: delete admin\n res.json({ message: \\`Admin \\${id} deleted\\` });\n};\n`\n : `${RA}${adminByIdMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch admin by id\n res.json({ admin: { id } });\n};\n\nexport const PUT = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: update admin record\n res.json({ message: 'Admin updated', admin: { id, ...req.body } });\n};\n\nexport const DELETE = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: delete admin\n res.json({ message: \\`Admin \\${id} deleted\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'admins', `[id].${ext}`),\n adminByIdContent,\n );\n\n // ── Roles (rbac only) ─────────────────────────────────────────────────\n\n if (opts.rbac) {\n const rolesListMeta = mkMeta(opts, {\n GET: { description: 'List all roles (admin only).', response: `{ roles: [] }` },\n POST: {\n description: 'Create a new role (admin only).',\n request: `{ name: 'editor', description: 'Can edit content', permissions: ['content:write'] }`,\n response: `{ message: 'Role created', role: { id: 'new-id', name: 'editor', permissions: ['content:write'] } }`,\n status: 201,\n },\n });\n const rolesListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${rolesListMeta}${mwAdmin3}\nexport const GET = async (_req: Request, res: Response) => {\n // TODO: fetch all roles\n res.json({ roles: [] });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n const { name, description, permissions } = req.body;\n if (!name) return res.status(400).json({ error: 'name is required' });\n // TODO: create role\n res.status(201).json({ message: 'Role created', role: { id: 'new-id', name, permissions: permissions ?? [] } });\n};\n`\n : `${RA}${rolesListMeta}${mwAdmin3}\nexport const GET = async (_req, res) => {\n // TODO: fetch all roles\n res.json({ roles: [] });\n};\n\nexport const POST = async (req, res) => {\n const { name, description, permissions } = req.body;\n if (!name) return res.status(400).json({ error: 'name is required' });\n // TODO: create role\n res.status(201).json({ message: 'Role created', role: { id: 'new-id', name, permissions: permissions ?? [] } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'roles', `index.${ext}`),\n rolesListContent,\n );\n\n const roleByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Fetch a single role by ID (admin only).',\n params: `{ id: 'role_01HXZ' }`,\n response: `{ role: { id: 'role_01HXZ', name: 'editor', permissions: ['content:write'] } }`,\n },\n PUT: {\n description: 'Update a role by ID (admin only).',\n params: `{ id: 'role_01HXZ' }`,\n request: `{ name: 'editor', permissions: ['content:write'] }`,\n response: `{ message: 'Role updated', role: { id: 'role_01HXZ', name: 'editor', permissions: ['content:write'] } }`,\n },\n DELETE: {\n description: 'Delete a role by ID (admin only).',\n params: `{ id: 'role_01HXZ' }`,\n response: `{ message: 'Role role_01HXZ deleted' }`,\n },\n });\n const roleByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${roleByIdMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: fetch role by id\n res.json({ role: { id } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: update role\n res.json({ message: 'Role updated', role: { id, ...req.body } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n const { id } = req.params;\n // TODO: delete role\n res.json({ message: \\`Role \\${id} deleted\\` });\n};\n`\n : `${RA}${roleByIdMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n const { id } = req.params;\n // TODO: fetch role by id\n res.json({ role: { id } });\n};\n\nexport const PUT = async (req, res) => {\n const { id } = req.params;\n // TODO: update role\n res.json({ message: 'Role updated', role: { id, ...req.body } });\n};\n\nexport const DELETE = async (req, res) => {\n const { id } = req.params;\n // TODO: delete role\n res.json({ message: \\`Role \\${id} deleted\\` });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'roles', `[id].${ext}`),\n roleByIdContent,\n );\n }\n }\n\n // ── Notifications ─────────────────────────────────────────────────────\n if (af.notificationsAndLogs) {\n // admin/notifications/index.ts\n const adminNotifMeta = mkMeta(opts, {\n GET: {\n description: 'List all sent notifications (admin only).',\n response: `{ notifications: [], total: 0 }`,\n },\n POST: {\n description: 'Send a notification to a specific user (admin only).',\n request: `{ userId: 'usr_01HXZ', title: 'Welcome', message: 'Thanks for joining!', type: 'info' }`,\n response: `{ message: 'Notification sent' }`,\n status: 201,\n },\n });\n const adminNotifContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${adminNotifMeta}${mwAdmin3}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: fetch sent notifications\n res.json({ notifications: [], total: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { userId, title, message, type } = req.body;\n if (!userId || !title || !message) return res.status(400).json({ error: 'userId, title and message are required' });\n // TODO: create and send notification to user\n res.status(201).json({ message: 'Notification sent' });\n};\n`\n : `${RA}${adminNotifMeta}${mwAdmin3}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: fetch sent notifications\n res.json({ notifications: [], total: 0 });\n};\n\nexport const POST = async (req, res) => {\n${roleGuard} const { userId, title, message, type } = req.body;\n if (!userId || !title || !message) return res.status(400).json({ error: 'userId, title and message are required' });\n // TODO: create and send notification to user\n res.status(201).json({ message: 'Notification sent' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'notifications', `index.${ext}`),\n adminNotifContent,\n );\n\n // admin/notifications/broadcast.ts\n const broadcastMeta = mkMeta(opts, {\n POST: {\n description: 'Broadcast a notification to all users (admin only).',\n request: `{ title: 'Announcement', message: 'Hello everyone!', type: 'info' }`,\n response: `{ message: 'Broadcast sent', count: 0 }`,\n },\n });\n const broadcastContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${broadcastMeta}${mwAdmin3}\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { title, message, type } = req.body;\n if (!title || !message) return res.status(400).json({ error: 'title and message are required' });\n // TODO: send notification to all users\n res.json({ message: 'Broadcast sent', count: 0 });\n};\n`\n : `${RA}${broadcastMeta}${mwAdmin3}\nexport const POST = async (req, res) => {\n${roleGuard} const { title, message, type } = req.body;\n if (!title || !message) return res.status(400).json({ error: 'title and message are required' });\n // TODO: send notification to all users\n res.json({ message: 'Broadcast sent', count: 0 });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'notifications', `broadcast.${ext}`),\n broadcastContent,\n );\n\n // ── Logs ──────────────────────────────────────────────────────────────\n\n const mkLogContent = (label: string) => {\n const meta = mkMeta(opts, {\n GET: {\n description: `Paginated ${label} log entries (admin only).`,\n query: `{ page: '1', limit: '50' }`,\n response: `{ logs: [], total: 0, page: 1, limit: 50 }`,\n },\n });\n return ts\n ? `${RA}import type { Request, Response } from 'express';\n${meta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { page = 1, limit = 50 } = req.query;\n // TODO: fetch ${label} logs with pagination\n res.json({ logs: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`\n : `${RA}${meta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { page = 1, limit = 50 } = req.query;\n // TODO: fetch ${label} logs with pagination\n res.json({ logs: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`;\n };\n\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'logs', `audit.${ext}`),\n mkLogContent('audit'),\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'logs', `activity.${ext}`),\n mkLogContent('activity'),\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'logs', `security.${ext}`),\n mkLogContent('security'),\n );\n }\n\n // ── Settings & System ─────────────────────────────────────────────────\n if (af.systemSettings) {\n // admin/settings/index.ts\n const settingsMeta = mkMeta(opts, {\n GET: { description: 'Get system-wide settings (admin only).', response: `{ settings: {} }` },\n PUT: {\n description: 'Update system-wide settings (admin only).',\n request: `{ maintenanceMode: false }`,\n response: `{ message: 'Settings updated', settings: { maintenanceMode: false } }`,\n },\n });\n const settingsContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${settingsMeta}${mwAdmin3}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: fetch system settings from DB\n res.json({ settings: {} });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n${roleGuard} // TODO: update system settings\n res.json({ message: 'Settings updated', settings: req.body });\n};\n`\n : `${RA}${settingsMeta}${mwAdmin3}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: fetch system settings from DB\n res.json({ settings: {} });\n};\n\nexport const PUT = async (req, res) => {\n${roleGuard} // TODO: update system settings\n res.json({ message: 'Settings updated', settings: req.body });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'settings', `index.${ext}`),\n settingsContent,\n );\n\n // admin/system/health.ts\n const healthMeta = mkMeta(opts, {\n GET: {\n description: 'System health check: DB, queue, cache status (admin only).',\n response: `{ status: 'ok', db: 'ok', queue: 'ok', uptime: 12345 }`,\n },\n });\n const healthContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${healthMeta}${mwAdmin3}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: check DB connection, queue, cache health\n res.json({ status: 'ok', db: 'ok', queue: 'ok', uptime: process.uptime() });\n};\n`\n : `${RA}${healthMeta}${mwAdmin3}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: check DB connection, queue, cache health\n res.json({ status: 'ok', db: 'ok', queue: 'ok', uptime: process.uptime() });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'system', `health.${ext}`),\n healthContent,\n );\n\n // admin/system/cache.ts\n const cacheMeta = mkMeta(opts, {\n DELETE: {\n description: 'Flush the application cache (admin only).',\n response: `{ message: 'Cache cleared' }`,\n },\n });\n const cacheContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${cacheMeta}${mwAdmin3}\nexport const DELETE = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: flush Redis or in-memory cache\n res.json({ message: 'Cache cleared' });\n};\n`\n : `${RA}${cacheMeta}${mwAdmin3}\nexport const DELETE = async (_req, res) => {\n${roleGuard} // TODO: flush Redis or in-memory cache\n res.json({ message: 'Cache cleared' });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'system', `cache.${ext}`),\n cacheContent,\n );\n }\n\n // ── Support Tickets (admin view) ──────────────────────────────────────\n if (af.supportManagement) {\n // admin/tickets/index.ts\n const adminTicketsListMeta = mkMeta(opts, {\n GET: {\n description: 'List all support tickets with filters (admin only).',\n query: `{ status: 'open', priority: 'normal', page: '1', limit: '20' }`,\n response: `{ tickets: [], total: 0, page: 1, limit: 20 }`,\n },\n });\n const adminTicketsListContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${adminTicketsListMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { status, priority, page = 1, limit = 20 } = req.query;\n // TODO: fetch all tickets with filters\n res.json({ tickets: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`\n : `${RA}${adminTicketsListMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { status, priority, page = 1, limit = 20 } = req.query;\n // TODO: fetch all tickets with filters\n res.json({ tickets: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'tickets', `index.${ext}`),\n adminTicketsListContent,\n );\n\n // admin/tickets/[id].ts\n const adminTicketByIdMeta = mkMeta(opts, {\n GET: {\n description: 'Fetch a single support ticket by ID (admin only).',\n params: `{ id: 'tk_01HXZ' }`,\n response: `{ ticket: { id: 'tk_01HXZ' } }`,\n },\n PUT: {\n description: 'Assign, reply to, or change the status of a support ticket (admin only).',\n params: `{ id: 'tk_01HXZ' }`,\n request: `{ reply: 'Looking into it.', status: 'in_progress', assignedTo: 'adm_01HXZ' }`,\n response: `{ message: 'Ticket updated', ticket: { id: 'tk_01HXZ', status: 'in_progress', assignedTo: 'adm_01HXZ' } }`,\n },\n });\n const adminTicketByIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${adminTicketByIdMeta}${mwAdmin3}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch ticket by id\n res.json({ ticket: { id } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n const { reply, status, assignedTo } = req.body;\n // TODO: update ticket (assign, change status, add reply)\n res.json({ message: 'Ticket updated', ticket: { id, status, assignedTo } });\n};\n`\n : `${RA}${adminTicketByIdMeta}${mwAdmin3}\nexport const GET = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch ticket by id\n res.json({ ticket: { id } });\n};\n\nexport const PUT = async (req, res) => {\n${roleGuard} const { id } = req.params;\n const { reply, status, assignedTo } = req.body;\n // TODO: update ticket (assign, change status, add reply)\n res.json({ message: 'Ticket updated', ticket: { id, status, assignedTo } });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'tickets', `[id].${ext}`),\n adminTicketByIdContent,\n );\n }\n\n // Shared by Content (FAQs/blogs/categories) and Billing (plans/coupons) below.\n const mkContentCrud = (name: string, namePlural: string, dir: string[], createFields: string) => {\n const lower = name.toLowerCase();\n const firstField = createFields.split(', ')[0];\n const sampleCreateBody = `{ ${createFields\n .split(', ')\n .map((f) => `${f}: 'sample-${f}'`)\n .join(', ')} }`;\n const sampleCreatedRecord = `{ id: 'new-id', ${firstField}: 'sample-${firstField}' }`;\n const sampleFullRecord = `{ id: '${lower}_01HXZ', ${createFields\n .split(', ')\n .map((f) => `${f}: 'sample-${f}'`)\n .join(', ')} }`;\n\n const listMeta = mkMeta(opts, {\n GET: {\n description: `List all ${namePlural} (admin only).`,\n response: `{ ${namePlural}: [], total: 0 }`,\n },\n POST: {\n description: `Create a new ${lower} (admin only).`,\n request: sampleCreateBody,\n response: `{ message: '${name} created', ${lower}: ${sampleCreatedRecord} }`,\n status: 201,\n },\n });\n const listContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${listMeta}${mwAdmin4}\nexport const GET = async (_req: Request, res: Response) => {\n${roleGuard} // TODO: fetch ${namePlural}\n res.json({ ${namePlural}: [], total: 0 });\n};\n\nexport const POST = async (req: Request, res: Response) => {\n${roleGuard} const { ${createFields} } = req.body;\n // TODO: create ${name}\n res.status(201).json({ message: '${name} created', ${lower}: { id: 'new-id', ${firstField} } });\n};\n`\n : `${RA}${listMeta}${mwAdmin4}\nexport const GET = async (_req, res) => {\n${roleGuard} // TODO: fetch ${namePlural}\n res.json({ ${namePlural}: [], total: 0 });\n};\n\nexport const POST = async (req, res) => {\n${roleGuard} const { ${createFields} } = req.body;\n // TODO: create ${name}\n res.status(201).json({ message: '${name} created', ${lower}: { id: 'new-id' } });\n};\n`;\n const byIdMeta = mkMeta(opts, {\n GET: {\n description: `Fetch a single ${lower} by ID (admin only).`,\n params: `{ id: '${lower}_01HXZ' }`,\n response: `{ ${lower}: ${sampleFullRecord} }`,\n },\n PUT: {\n description: `Update a ${lower} by ID (admin only).`,\n params: `{ id: '${lower}_01HXZ' }`,\n request: sampleCreateBody,\n response: `{ message: '${name} updated', ${lower}: ${sampleFullRecord} }`,\n },\n DELETE: {\n description: `Delete a ${lower} by ID (admin only).`,\n params: `{ id: '${lower}_01HXZ' }`,\n response: `{ message: '${name} ${lower}_01HXZ deleted' }`,\n },\n });\n const byIdContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${byIdMeta}${mwAdmin4}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch ${name} by id\n res.json({ ${lower}: { id } });\n};\n\nexport const PUT = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: update ${name}\n res.json({ message: '${name} updated', ${lower}: { id, ...req.body } });\n};\n\nexport const DELETE = async (req: Request, res: Response) => {\n${roleGuard} const { id } = req.params;\n // TODO: delete ${name}\n res.json({ message: \\`${name} \\${id} deleted\\` });\n};\n`\n : `${RA}${byIdMeta}${mwAdmin4}\nexport const GET = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: fetch ${name} by id\n res.json({ ${lower}: { id } });\n};\n\nexport const PUT = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: update ${name}\n res.json({ message: '${name} updated', ${lower}: { id, ...req.body } });\n};\n\nexport const DELETE = async (req, res) => {\n${roleGuard} const { id } = req.params;\n // TODO: delete ${name}\n res.json({ message: \\`${name} \\${id} deleted\\` });\n};\n`;\n return { listContent, byIdContent };\n };\n\n // ── Content ───────────────────────────────────────────────────────────\n if (af.contentManagement) {\n const { listContent: faqList, byIdContent: faqById } = mkContentCrud(\n 'FAQ',\n 'faqs',\n [],\n 'question, answer, category',\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'content', 'faqs', `index.${ext}`),\n faqList,\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'content', 'faqs', `[id].${ext}`),\n faqById,\n );\n\n const { listContent: blogList, byIdContent: blogById } = mkContentCrud(\n 'Blog',\n 'blogs',\n [],\n 'title, slug, content',\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'content', 'blogs', `index.${ext}`),\n blogList,\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'content', 'blogs', `[id].${ext}`),\n blogById,\n );\n\n const { listContent: catList, byIdContent: catById } = mkContentCrud(\n 'Category',\n 'categories',\n [],\n 'name, slug',\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'content', 'categories', `index.${ext}`),\n catList,\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'content', 'categories', `[id].${ext}`),\n catById,\n );\n }\n\n // ── Billing (admin) ───────────────────────────────────────────────────\n if (af.billingManagement) {\n const { listContent: planList, byIdContent: planById } = mkContentCrud(\n 'Plan',\n 'plans',\n [],\n 'name, price, interval',\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'billing', 'plans', `index.${ext}`),\n planList,\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'billing', 'plans', `[id].${ext}`),\n planById,\n );\n\n const { listContent: couponList, byIdContent: couponById } = mkContentCrud(\n 'Coupon',\n 'coupons',\n [],\n 'code, type, value',\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'billing', 'coupons', `index.${ext}`),\n couponList,\n );\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'billing', 'coupons', `[id].${ext}`),\n couponById,\n );\n\n // admin/billing/subscriptions/index.ts\n const adminSubsMeta = mkMeta(opts, {\n GET: {\n description: 'List all subscriptions with filters (admin only).',\n query: `{ status: 'active', page: '1', limit: '20' }`,\n response: `{ subscriptions: [], total: 0, page: 1, limit: 20 }`,\n },\n });\n const adminSubsContent = ts\n ? `${RA}import type { Request, Response } from 'express';\n${adminSubsMeta}${mwAdmin4}\nexport const GET = async (req: Request, res: Response) => {\n${roleGuard} const { status, page = 1, limit = 20 } = req.query;\n // TODO: fetch all subscriptions with filters\n res.json({ subscriptions: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`\n : `${RA}${adminSubsMeta}${mwAdmin4}\nexport const GET = async (req, res) => {\n${roleGuard} const { status, page = 1, limit = 20 } = req.query;\n // TODO: fetch all subscriptions with filters\n res.json({ subscriptions: [], total: 0, page: Number(page), limit: Number(limit) });\n};\n`;\n await fs.outputFile(\n path.join(dest, 'src', 'api', 'admin', 'billing', 'subscriptions', `index.${ext}`),\n adminSubsContent,\n );\n }\n}\n"],"mappings":";;;AAAA,YAAY,OAAO;AACnB,OAAO,QAAQ;AACf,SAAS,aAAa;;;ACFtB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,YAAY;AAyBZ,IAAM,oBAAmC;AAAA,EAC9C,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,sBAAsB;AAAA,EACtB,gBAAgB;AAClB;AAEO,IAAM,mBAAiC;AAAA,EAC5C,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EACf,SAAS;AACX;A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