@msishamim/create-next-monorepo 1.0.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/project-config.ts","../src/generator.ts","../src/version-resolver.ts","../src/logger.ts","../src/expected-paths.ts","../src/templates/root-templates.ts","../src/templates/config-templates.ts","../src/templates/lib-templates.ts","../src/templates/ui-templates.ts","../src/templates/nextjs-templates.ts","../src/templates/license-templates.ts","../src/templates/skills-templates.ts","../src/templates/github-templates.ts","../src/templates/strategies/nestjs-templates.ts","../src/templates/strategies/express-templates.ts","../src/templates/strategies/backend-factory.ts","../src/templates/strategies/prisma-templates.ts","../src/templates/strategies/drizzle-templates.ts","../src/templates/strategies/orm-factory.ts","../src/templates/strategies/next-auth-templates.ts","../src/templates/strategies/custom-auth-templates.ts","../src/templates/strategies/auth-factory.ts","../src/templates/strategies/zustand-templates.ts","../src/templates/strategies/jotai-templates.ts","../src/templates/strategies/redux-templates.ts","../src/templates/strategies/tanstack-query-templates.ts","../src/templates/strategies/state-factory.ts","../src/doctor.ts","../src/config-detector.ts","../src/workflow.ts"],"sourcesContent":["/**\n * ProjectConfig — Immutable configuration model holding all user choices.\n * Auto-derives package names, case variants, and computed properties.\n * Mirrors flutter_monorepo's ProjectConfig pattern.\n */\n\n// ── Enums (as const objects + type aliases) ──────────────────────────\n\nexport const Backend = { nestjs: 'nestjs', express: 'express' } as const;\nexport type Backend = (typeof Backend)[keyof typeof Backend];\n\nexport const Styling = {\n tailwind: 'tailwind',\n cssModules: 'css-modules',\n styledComponents: 'styled-components',\n} as const;\nexport type Styling = (typeof Styling)[keyof typeof Styling];\n\nexport const ORM = { prisma: 'prisma', drizzle: 'drizzle', none: 'none' } as const;\nexport type ORM = (typeof ORM)[keyof typeof ORM];\n\nexport const Database = {\n postgres: 'postgres',\n mysql: 'mysql',\n sqlite: 'sqlite',\n mongodb: 'mongodb',\n} as const;\nexport type Database = (typeof Database)[keyof typeof Database];\n\nexport const Auth = {\n nextAuth: 'next-auth',\n custom: 'custom',\n none: 'none',\n} as const;\nexport type Auth = (typeof Auth)[keyof typeof Auth];\n\nexport const StateManagement = {\n zustand: 'zustand',\n jotai: 'jotai',\n redux: 'redux',\n tanstackQuery: 'tanstack-query',\n none: 'none',\n} as const;\nexport type StateManagement = (typeof StateManagement)[keyof typeof StateManagement];\n\nexport const TestFramework = { vitest: 'vitest', jest: 'jest' } as const;\nexport type TestFramework = (typeof TestFramework)[keyof typeof TestFramework];\n\nexport const PackageManager = {\n pnpm: 'pnpm',\n npm: 'npm',\n yarn: 'yarn',\n bun: 'bun',\n} as const;\nexport type PackageManager = (typeof PackageManager)[keyof typeof PackageManager];\n\nexport const LicenseType = {\n MIT: 'MIT',\n Apache2: 'Apache-2.0',\n BSD2: 'BSD-2-Clause',\n BSD3: 'BSD-3-Clause',\n GPL2: 'GPL-2.0',\n GPL3: 'GPL-3.0',\n LGPL21: 'LGPL-2.1',\n MPL2: 'MPL-2.0',\n ISC: 'ISC',\n Unlicense: 'Unlicense',\n Proprietary: 'proprietary',\n} as const;\nexport type LicenseType = (typeof LicenseType)[keyof typeof LicenseType];\n\n// ── Display name mappings ────────────────────────────────────────────\n\nexport const backendDisplayName: Record<Backend, string> = {\n nestjs: 'NestJS',\n express: 'Express',\n};\n\nexport const stylingDisplayName: Record<Styling, string> = {\n tailwind: 'Tailwind CSS',\n 'css-modules': 'CSS Modules',\n 'styled-components': 'Styled Components',\n};\n\nexport const ormDisplayName: Record<ORM, string> = {\n prisma: 'Prisma',\n drizzle: 'Drizzle',\n none: 'None',\n};\n\nexport const stateDisplayName: Record<StateManagement, string> = {\n zustand: 'Zustand',\n jotai: 'Jotai',\n redux: 'Redux Toolkit',\n 'tanstack-query': 'TanStack Query',\n none: 'None',\n};\n\nexport const authDisplayName: Record<Auth, string> = {\n 'next-auth': 'NextAuth.js',\n custom: 'Custom JWT',\n none: 'None',\n};\n\n// ── ProjectConfig ────────────────────────────────────────────────────\n\nexport interface ProjectConfigOptions {\n name: string;\n backend?: Backend;\n styling?: Styling;\n orm?: ORM;\n db?: Database;\n auth?: Auth;\n state?: StateManagement;\n testing?: TestFramework;\n license?: LicenseType;\n packageManager?: PackageManager;\n gitInit?: boolean;\n githubFiles?: boolean;\n}\n\nexport class ProjectConfig {\n /** Project name in kebab-case (e.g. \"my-app\") */\n readonly name: string;\n readonly backend: Backend;\n readonly styling: Styling;\n readonly orm: ORM;\n readonly db: Database;\n readonly auth: Auth;\n readonly state: StateManagement;\n readonly testing: TestFramework;\n readonly license: LicenseType;\n readonly packageManager: PackageManager;\n readonly gitInit: boolean;\n readonly githubFiles: boolean;\n\n /** Resolved npm package versions — set by Generator before template rendering */\n versions: Record<string, string> = {};\n\n constructor(options: ProjectConfigOptions) {\n this.name = options.name;\n this.backend = options.backend ?? 'nestjs';\n this.styling = options.styling ?? 'tailwind';\n this.orm = options.orm ?? 'prisma';\n this.db = options.db ?? 'postgres';\n this.auth = options.auth ?? 'next-auth';\n this.state = options.state ?? 'zustand';\n this.testing = options.testing ?? 'vitest';\n this.license = options.license ?? 'MIT';\n this.packageManager = options.packageManager ?? 'pnpm';\n this.gitInit = options.gitInit ?? true;\n this.githubFiles = options.githubFiles ?? false;\n }\n\n // ── Derived name variants ──────────────────────────────────────\n\n /** PascalCase (e.g. \"my-app\" → \"MyApp\") */\n get pascalCase(): string {\n return this.name\n .split('-')\n .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join('');\n }\n\n /** camelCase (e.g. \"my-app\" → \"myApp\") */\n get camelCase(): string {\n const pascal = this.pascalCase;\n return pascal.charAt(0).toLowerCase() + pascal.slice(1);\n }\n\n /** SCREAMING_SNAKE_CASE (e.g. \"my-app\" → \"MY_APP\") */\n get screamingSnakeCase(): string {\n return this.name.replace(/-/g, '_').toUpperCase();\n }\n\n // ── Computed properties ────────────────────────────────────────\n\n get hasDatabase(): boolean {\n return this.orm !== 'none';\n }\n\n get hasAuth(): boolean {\n return this.auth !== 'none';\n }\n\n get hasState(): boolean {\n return this.state !== 'none';\n }\n\n get usesTailwind(): boolean {\n return this.styling === 'tailwind';\n }\n\n /** Install command for the selected package manager */\n get installCommand(): string {\n switch (this.packageManager) {\n case 'pnpm':\n return 'pnpm install';\n case 'npm':\n return 'npm install';\n case 'yarn':\n return 'yarn install';\n case 'bun':\n return 'bun install';\n }\n }\n\n /** Run command prefix for the selected package manager */\n get runCommand(): string {\n switch (this.packageManager) {\n case 'pnpm':\n return 'pnpm';\n case 'npm':\n return 'npm run';\n case 'yarn':\n return 'yarn';\n case 'bun':\n return 'bun run';\n }\n }\n\n /** Workspace config file name */\n get workspaceConfigFile(): string {\n return this.packageManager === 'pnpm' ? 'pnpm-workspace.yaml' : 'package.json';\n }\n\n /** List of npm packages required based on current config */\n get requiredPackages(): string[] {\n const packages: string[] = [\n // Core — always needed\n 'next',\n 'react',\n 'react-dom',\n 'typescript',\n 'turbo',\n '@types/react',\n '@types/react-dom',\n '@types/node',\n 'eslint',\n 'prettier',\n ];\n\n // Backend\n if (this.backend === 'nestjs') {\n packages.push(\n '@nestjs/core',\n '@nestjs/common',\n '@nestjs/platform-express',\n 'reflect-metadata',\n 'rxjs',\n );\n } else {\n packages.push('express', '@types/express', 'cors', '@types/cors');\n }\n\n // Styling\n if (this.styling === 'tailwind') {\n packages.push('tailwindcss', 'postcss', 'autoprefixer', '@tailwindcss/postcss');\n } else if (this.styling === 'styled-components') {\n packages.push('styled-components');\n }\n\n // ORM\n if (this.orm === 'prisma') {\n packages.push('prisma', '@prisma/client');\n } else if (this.orm === 'drizzle') {\n packages.push('drizzle-orm', 'drizzle-kit');\n if (this.db === 'postgres') packages.push('pg', '@types/pg');\n if (this.db === 'mysql') packages.push('mysql2');\n if (this.db === 'sqlite') packages.push('better-sqlite3');\n }\n\n // Auth\n if (this.auth === 'next-auth') {\n packages.push('next-auth', '@auth/core');\n if (this.orm === 'prisma') packages.push('@auth/prisma-adapter');\n if (this.orm === 'drizzle') packages.push('@auth/drizzle-adapter');\n } else if (this.auth === 'custom') {\n packages.push('jsonwebtoken', '@types/jsonwebtoken', 'bcryptjs', '@types/bcryptjs');\n }\n\n // State management\n if (this.state === 'zustand') packages.push('zustand');\n if (this.state === 'jotai') packages.push('jotai');\n if (this.state === 'redux') packages.push('@reduxjs/toolkit', 'react-redux');\n if (this.state === 'tanstack-query') packages.push('@tanstack/react-query');\n\n // Testing\n if (this.testing === 'vitest') {\n packages.push('vitest', '@vitejs/plugin-react');\n } else {\n packages.push('jest', '@types/jest', 'ts-jest');\n }\n\n // Validation — always include zod for shared validators\n packages.push('zod');\n\n return packages;\n }\n}\n","/**\n * Generator — 16-step pipeline that creates a complete monorepo.\n * Mirrors flutter_monorepo's Generator class architecture.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { execSync } from 'node:child_process';\nimport type { ProjectConfig } from './project-config.js';\nimport { VersionResolver } from './version-resolver.js';\nimport { logger } from './logger.js';\nimport { getExpectedDirectories } from './expected-paths.js';\n\n// Template imports\nimport * as root from './templates/root-templates.js';\nimport * as config from './templates/config-templates.js';\nimport * as lib from './templates/lib-templates.js';\nimport * as ui from './templates/ui-templates.js';\nimport * as nextjs from './templates/nextjs-templates.js';\nimport * as license from './templates/license-templates.js';\nimport * as skills from './templates/skills-templates.js';\nimport * as github from './templates/github-templates.js';\n\n// Strategy imports\nimport { createBackendStrategy } from './templates/strategies/backend-factory.js';\nimport { createOrmStrategy } from './templates/strategies/orm-factory.js';\nimport { createAuthStrategy } from './templates/strategies/auth-factory.js';\nimport { createStateStrategy } from './templates/strategies/state-factory.js';\n\nconst TOTAL_STEPS = 16;\n\nexport class Generator {\n private rootPath: string;\n private config: ProjectConfig;\n\n constructor(config: ProjectConfig, rootPath: string) {\n this.config = config;\n this.rootPath = rootPath;\n }\n\n /** Run the full 16-step generation pipeline */\n async run(): Promise<void> {\n logger.header(`Creating ${this.config.pascalCase} monorepo...`);\n logger.newline();\n\n await this.resolveVersions(); // Step 1\n this.createRootWorkspace(); // Step 2\n this.createDirectories(); // Step 3\n this.writeRootFiles(); // Step 4\n this.writeGithubFiles(); // Step 5\n this.writeConfigPackage(); // Step 6\n this.writeLibPackage(); // Step 7\n this.writeUiPackage(); // Step 8\n this.writeDatabasePackage(); // Step 9\n this.writeNextjsApp(); // Step 10\n this.writeBackendApp(); // Step 11\n this.writeAuthLayer(); // Step 12\n this.writeSkills(); // Step 13\n await this.installDependencies(); // Step 14\n await this.initializeGit(); // Step 15\n this.printSummary(); // Step 16\n }\n\n // ── Step 1: Resolve versions ─────────────────────────────────────\n\n private async resolveVersions(): Promise<void> {\n logger.step(1, TOTAL_STEPS, 'Resolving latest package versions...');\n\n const resolver = new VersionResolver();\n this.config.versions = await resolver.resolve(this.config.requiredPackages);\n\n logger.success(`Resolved ${Object.keys(this.config.versions).length} package versions`);\n }\n\n // ── Step 2: Create root workspace ────────────────────────────────\n\n private createRootWorkspace(): void {\n logger.step(2, TOTAL_STEPS, 'Creating root workspace...');\n\n fs.mkdirSync(this.rootPath, { recursive: true });\n\n this.write('package.json', root.rootPackageJson(this.config));\n this.write('turbo.json', root.turboJson(this.config));\n\n if (this.config.packageManager === 'pnpm') {\n this.write('pnpm-workspace.yaml', root.pnpmWorkspaceYaml());\n }\n\n logger.success('Root workspace created');\n }\n\n // ── Step 3: Create directories ───────────────────────────────────\n\n private createDirectories(): void {\n logger.step(3, TOTAL_STEPS, 'Creating directory structure...');\n\n const dirs = getExpectedDirectories(this.config);\n for (const dir of dirs) {\n const fullPath = path.join(this.rootPath, dir);\n fs.mkdirSync(fullPath, { recursive: true });\n }\n\n logger.success(`Created ${dirs.length} directories`);\n }\n\n // ── Step 4: Write root files ─────────────────────────────────────\n\n private writeRootFiles(): void {\n logger.step(4, TOTAL_STEPS, 'Writing root configuration files...');\n\n this.write('.gitignore', root.gitignore());\n this.write('.env.example', root.envExample(this.config));\n this.write('.prettierrc', root.prettierrc());\n this.write('README.md', root.readmeMd(this.config));\n this.write('CONTRIBUTING.md', root.contributingMd(this.config));\n this.write('LICENSE', license.licenseText(this.config));\n\n const dockerContent = root.dockerCompose(this.config);\n if (dockerContent) {\n this.write('docker-compose.yml', dockerContent);\n }\n\n logger.success('Root files written');\n }\n\n // ── Step 5: Write GitHub files ───────────────────────────────────\n\n private writeGithubFiles(): void {\n if (!this.config.githubFiles) {\n logger.step(5, TOTAL_STEPS, 'Skipping GitHub files (--no-github)');\n return;\n }\n\n logger.step(5, TOTAL_STEPS, 'Writing GitHub community files...');\n\n this.write('CODE_OF_CONDUCT.md', github.codeOfConduct());\n this.write('.github/FUNDING.yml', github.fundingYml());\n this.write('.github/ISSUE_TEMPLATE/bug_report.md', github.bugReport());\n this.write('.github/ISSUE_TEMPLATE/feature_request.md', github.featureRequest());\n this.write('.github/pull_request_template.md', github.pullRequestTemplate());\n this.write('.github/workflows/ci.yml', github.ciWorkflow(this.config));\n\n logger.success('GitHub files written');\n }\n\n // ── Step 6: Write config package ─────────────────────────────────\n\n private writeConfigPackage(): void {\n logger.step(6, TOTAL_STEPS, 'Writing shared config package...');\n\n this.write('packages/config/package.json', config.configPackageJson(this.config));\n this.write('packages/config/eslint/base.js', config.eslintBase(this.config));\n this.write('packages/config/typescript/base.json', config.tsConfigBase());\n this.write('packages/config/typescript/nextjs.json', config.tsConfigNextjs());\n this.write('packages/config/typescript/node.json', config.tsConfigNode());\n\n if (this.config.usesTailwind) {\n this.write('packages/config/tailwind/base.js', config.tailwindBase(this.config));\n }\n\n logger.success('Config package written');\n }\n\n // ── Step 7: Write lib package ────────────────────────────────────\n\n private writeLibPackage(): void {\n logger.step(7, TOTAL_STEPS, 'Writing shared lib package...');\n\n this.write('packages/lib/package.json', lib.libPackageJson(this.config));\n this.write('packages/lib/tsconfig.json', lib.libTsConfig().replace('{name}', this.config.name));\n this.write('packages/lib/src/index.ts', lib.libIndex());\n this.write('packages/lib/src/types/index.ts', lib.libTypes());\n this.write('packages/lib/src/utils/index.ts', lib.libUtils());\n this.write('packages/lib/src/constants/index.ts', lib.libConstants());\n this.write('packages/lib/src/validators/index.ts', lib.libValidators());\n\n logger.success('Lib package written');\n }\n\n // ── Step 8: Write UI package ─────────────────────────────────────\n\n private writeUiPackage(): void {\n logger.step(8, TOTAL_STEPS, 'Writing shared UI package...');\n\n this.write('packages/ui/package.json', ui.uiPackageJson(this.config));\n this.write('packages/ui/tsconfig.json', ui.uiTsConfig(this.config));\n this.write('packages/ui/src/index.ts', ui.uiIndex());\n this.write('packages/ui/src/components/index.ts', ui.uiComponentsIndex());\n this.write('packages/ui/src/components/button.tsx', ui.uiButton(this.config));\n this.write('packages/ui/src/components/card.tsx', ui.uiCard(this.config));\n this.write('packages/ui/src/components/input.tsx', ui.uiInput(this.config));\n this.write('packages/ui/src/hooks/index.ts', ui.uiHooksIndex());\n this.write('packages/ui/src/hooks/use-media-query.ts', ui.uiUseMediaQuery());\n this.write('packages/ui/src/hooks/use-debounce.ts', ui.uiUseDebounce());\n\n // CSS Modules stylesheets\n if (this.config.styling === 'css-modules') {\n this.write('packages/ui/src/components/button.module.css', ui.uiButtonCss());\n this.write('packages/ui/src/components/card.module.css', ui.uiCardCss());\n this.write('packages/ui/src/components/input.module.css', ui.uiInputCss());\n }\n\n logger.success('UI package written');\n }\n\n // ── Step 9: Write database package ───────────────────────────────\n\n private writeDatabasePackage(): void {\n if (!this.config.hasDatabase) {\n logger.step(9, TOTAL_STEPS, 'Skipping database package (--orm none)');\n return;\n }\n\n logger.step(9, TOTAL_STEPS, `Writing database package (${this.config.orm})...`);\n\n const ormStrategy = createOrmStrategy(this.config.orm);\n if (!ormStrategy) return;\n\n this.write('packages/database/package.json', ormStrategy.packageJson(this.config));\n this.write('packages/database/tsconfig.json', ormStrategy.tsConfig(this.config));\n this.write('packages/database/src/index.ts', ormStrategy.index(this.config));\n this.write('packages/database/src/client.ts', ormStrategy.clientFile(this.config));\n this.write('packages/database/src/seed.ts', ormStrategy.seedFile(this.config));\n\n // Schema file location differs by ORM\n if (this.config.orm === 'prisma') {\n this.write('packages/database/prisma/schema.prisma', ormStrategy.schemaFile(this.config));\n } else {\n this.write('packages/database/src/schema/index.ts', ormStrategy.schemaFile(this.config));\n }\n\n logger.success('Database package written');\n }\n\n // ── Step 10: Write Next.js app ───────────────────────────────────\n\n private writeNextjsApp(): void {\n logger.step(10, TOTAL_STEPS, 'Writing Next.js 15 app...');\n\n this.write('apps/web/package.json', nextjs.webPackageJson(this.config));\n this.write('apps/web/tsconfig.json', nextjs.webTsConfig(this.config));\n this.write('apps/web/next.config.ts', nextjs.nextConfig(this.config));\n this.write('apps/web/app/globals.css', nextjs.globalsCss(this.config));\n this.write('apps/web/app/layout.tsx', nextjs.rootLayout(this.config));\n this.write('apps/web/app/page.tsx', nextjs.homePage(this.config));\n this.write('apps/web/app/not-found.tsx', nextjs.notFoundPage(this.config));\n this.write('apps/web/app/error.tsx', nextjs.errorPage());\n this.write('apps/web/app/loading.tsx', nextjs.loadingPage());\n\n // Tailwind PostCSS config\n if (this.config.usesTailwind) {\n this.write('apps/web/postcss.config.mjs', nextjs.postcssConfig());\n }\n\n // State management files\n const stateStrategy = createStateStrategy(this.config.state);\n if (stateStrategy) {\n const stateDir =\n this.config.state === 'tanstack-query' ? 'lib/query' : 'lib/store';\n\n this.write(`apps/web/${stateDir}/index.ts`, stateStrategy.storeSetup(this.config));\n\n if (this.config.state === 'tanstack-query') {\n this.write(`apps/web/${stateDir}/query-client.ts`, stateStrategy.exampleStore(this.config));\n } else if (this.config.state === 'zustand') {\n this.write(`apps/web/${stateDir}/theme-store.ts`, stateStrategy.exampleStore(this.config));\n } else if (this.config.state === 'jotai') {\n this.write(`apps/web/${stateDir}/theme-atom.ts`, stateStrategy.exampleStore(this.config));\n } else if (this.config.state === 'redux') {\n this.write(`apps/web/${stateDir}/store.ts`, stateStrategy.storeSetup(this.config));\n this.write(`apps/web/${stateDir}/theme-slice.ts`, stateStrategy.exampleStore(this.config));\n }\n\n const provider = stateStrategy.providerWrapper(this.config);\n if (provider) {\n this.write(`apps/web/${stateDir}/provider.tsx`, provider);\n }\n }\n\n logger.success('Next.js app written');\n }\n\n // ── Step 11: Write backend app ───────────────────────────────────\n\n private writeBackendApp(): void {\n logger.step(11, TOTAL_STEPS, `Writing ${this.config.backend} backend...`);\n\n const backendStrategy = createBackendStrategy(this.config.backend);\n\n this.write('apps/api/package.json', backendStrategy.packageJson(this.config));\n this.write('apps/api/tsconfig.json', backendStrategy.tsConfig(this.config));\n\n if (this.config.backend === 'nestjs') {\n this.write('apps/api/src/main.ts', backendStrategy.mainEntry(this.config));\n this.write('apps/api/src/app.module.ts', backendStrategy.appSetup(this.config));\n this.write('apps/api/src/app.controller.ts', backendStrategy.appController(this.config));\n this.write('apps/api/src/app.service.ts', backendStrategy.appService(this.config));\n this.write('apps/api/src/common/filters/http-exception.filter.ts', backendStrategy.exceptionFilter(this.config));\n this.write('apps/api/src/common/interceptors/logging.interceptor.ts', backendStrategy.loggingInterceptor(this.config));\n this.write('apps/api/src/common/guards/auth.guard.ts', backendStrategy.authGuard(this.config));\n this.write('apps/api/src/common/pipes/zod-validation.pipe.ts', backendStrategy.validationPipe(this.config));\n } else {\n this.write('apps/api/src/main.ts', backendStrategy.mainEntry(this.config));\n this.write('apps/api/src/app.ts', backendStrategy.appSetup(this.config));\n this.write('apps/api/src/routes/health.ts', backendStrategy.appController(this.config));\n this.write('apps/api/src/services/app.service.ts', backendStrategy.appService(this.config));\n this.write('apps/api/src/common/filters/error-handler.ts', backendStrategy.exceptionFilter(this.config));\n this.write('apps/api/src/common/interceptors/request-logger.ts', backendStrategy.loggingInterceptor(this.config));\n this.write('apps/api/src/common/guards/auth.guard.ts', backendStrategy.authGuard(this.config));\n this.write('apps/api/src/common/pipes/validate.ts', backendStrategy.validationPipe(this.config));\n }\n\n logger.success(`${this.config.backend === 'nestjs' ? 'NestJS' : 'Express'} backend written`);\n }\n\n // ── Step 12: Write auth layer ────────────────────────────────────\n\n private writeAuthLayer(): void {\n if (!this.config.hasAuth) {\n logger.step(12, TOTAL_STEPS, 'Skipping auth layer (--auth none)');\n return;\n }\n\n logger.step(12, TOTAL_STEPS, `Writing ${this.config.auth} auth layer...`);\n\n const authStrategy = createAuthStrategy(this.config.auth);\n if (!authStrategy) return;\n\n if (this.config.auth === 'next-auth') {\n this.write('apps/web/app/api/auth/[...nextauth]/route.ts', authStrategy.apiRoute(this.config));\n this.write('apps/web/lib/auth.ts', authStrategy.authConfig(this.config));\n this.write('apps/web/middleware.ts', authStrategy.middleware(this.config));\n this.write('apps/web/types/next-auth.d.ts', authStrategy.types(this.config));\n } else {\n this.write('apps/web/app/api/auth/login/route.ts', authStrategy.apiRoute(this.config));\n this.write('apps/web/lib/auth.ts', authStrategy.authConfig(this.config));\n this.write('apps/web/middleware.ts', authStrategy.middleware(this.config));\n this.write('apps/web/types/auth.ts', authStrategy.types(this.config));\n }\n\n logger.success('Auth layer written');\n }\n\n // ── Step 13: Write AI skills ─────────────────────────────────────\n\n private writeSkills(): void {\n logger.step(13, TOTAL_STEPS, 'Writing AI agent skills...');\n\n this.write('.claude/settings.json', skills.claudeSettings(this.config));\n this.write('.claude/skills/component-design/SKILL.md', skills.componentDesignSkill(this.config));\n this.write('.claude/skills/page-design/SKILL.md', skills.pageDesignSkill(this.config));\n this.write('.claude/skills/api-feature/SKILL.md', skills.apiFeatureSkill(this.config));\n this.write('.claude/skills/monorepo-doctor/SKILL.md', skills.monrepoDoctorSkill());\n\n logger.success('AI skills written');\n }\n\n // ── Step 14: Install dependencies ────────────────────────────────\n\n private async installDependencies(): Promise<void> {\n logger.step(14, TOTAL_STEPS, `Installing dependencies (${this.config.packageManager})...`);\n\n try {\n execSync(this.config.installCommand, {\n cwd: this.rootPath,\n stdio: 'pipe',\n timeout: 120_000,\n });\n logger.success('Dependencies installed');\n } catch {\n logger.warn('Dependency installation failed — run manually after setup');\n }\n }\n\n // ── Step 15: Initialize git ──────────────────────────────────────\n\n private async initializeGit(): Promise<void> {\n if (!this.config.gitInit) {\n logger.step(15, TOTAL_STEPS, 'Skipping git init (--no-git)');\n return;\n }\n\n logger.step(15, TOTAL_STEPS, 'Initializing git repository...');\n\n try {\n execSync('git init', { cwd: this.rootPath, stdio: 'pipe' });\n execSync('git add .', { cwd: this.rootPath, stdio: 'pipe' });\n execSync(`git commit -m \"Initial commit: ${this.config.pascalCase} monorepo\"`, {\n cwd: this.rootPath,\n stdio: 'pipe',\n });\n logger.success('Git repository initialized with initial commit');\n } catch {\n logger.warn('Git initialization failed — run manually');\n }\n }\n\n // ── Step 16: Print summary ───────────────────────────────────────\n\n private printSummary(): void {\n logger.step(16, TOTAL_STEPS, 'Done!');\n\n logger.summary([\n `${this.config.pascalCase} monorepo created successfully!`,\n '',\n ` cd ${this.config.name}`,\n ` ${this.config.runCommand} dev`,\n '',\n `Frontend: http://localhost:3000`,\n `Backend: http://localhost:3001/api`,\n ]);\n }\n\n // ── Helper: Write file to disk ───────────────────────────────────\n\n private write(relativePath: string, content: string): void {\n if (!content) return;\n\n const fullPath = path.join(this.rootPath, relativePath);\n const dir = path.dirname(fullPath);\n\n fs.mkdirSync(dir, { recursive: true });\n fs.writeFileSync(fullPath, content, 'utf-8');\n }\n}\n","/**\n * VersionResolver — Fetches latest compatible versions from npm registry.\n * Falls back to hardcoded tested versions when offline.\n */\n\n/** Hardcoded fallback versions (tested and known to work together) */\nconst FALLBACK_VERSIONS: Record<string, string> = {\n // Core\n next: '^15.3.1',\n react: '^19.1.0',\n 'react-dom': '^19.1.0',\n typescript: '^5.8.3',\n turbo: '^2.5.0',\n '@types/react': '^19.1.2',\n '@types/react-dom': '^19.1.2',\n '@types/node': '^22.15.3',\n eslint: '^9.25.1',\n prettier: '^3.5.3',\n\n // NestJS\n '@nestjs/core': '^11.0.20',\n '@nestjs/common': '^11.0.20',\n '@nestjs/platform-express': '^11.0.20',\n 'reflect-metadata': '^0.2.2',\n rxjs: '^7.8.2',\n '@nestjs/testing': '^11.0.20',\n '@nestjs/cli': '^11.0.5',\n\n // Express\n express: '^5.1.0',\n '@types/express': '^5.0.2',\n cors: '^2.8.5',\n '@types/cors': '^2.8.17',\n\n // Tailwind\n tailwindcss: '^4.1.4',\n postcss: '^8.5.3',\n autoprefixer: '^10.4.21',\n '@tailwindcss/postcss': '^4.1.4',\n\n // Styled Components\n 'styled-components': '^6.1.18',\n\n // Prisma\n prisma: '^6.6.0',\n '@prisma/client': '^6.6.0',\n\n // Drizzle\n 'drizzle-orm': '^0.43.1',\n 'drizzle-kit': '^0.31.1',\n pg: '^8.14.1',\n '@types/pg': '^8.11.13',\n mysql2: '^3.14.0',\n 'better-sqlite3': '^11.9.1',\n\n // Auth\n 'next-auth': '^5.0.0-beta.25',\n '@auth/core': '^0.37.4',\n '@auth/prisma-adapter': '^2.7.4',\n '@auth/drizzle-adapter': '^1.7.4',\n jsonwebtoken: '^9.0.2',\n '@types/jsonwebtoken': '^9.0.9',\n bcryptjs: '^3.0.2',\n '@types/bcryptjs': '^2.4.6',\n\n // State management\n zustand: '^5.0.3',\n jotai: '^2.12.3',\n '@reduxjs/toolkit': '^2.7.0',\n 'react-redux': '^9.2.0',\n '@tanstack/react-query': '^5.74.4',\n\n // Testing\n vitest: '^3.1.2',\n '@vitejs/plugin-react': '^4.4.1',\n jest: '^29.7.0',\n '@types/jest': '^29.5.14',\n 'ts-jest': '^29.3.2',\n\n // Validation\n zod: '^3.24.3',\n};\n\nexport class VersionResolver {\n private resolved: Record<string, string> = {};\n\n /**\n * Resolve versions for the given package names.\n * Attempts to fetch latest from npm registry; falls back to hardcoded versions.\n */\n async resolve(packageNames: string[]): Promise<Record<string, string>> {\n const results = await Promise.allSettled(\n packageNames.map((name) => this.fetchLatestVersion(name)),\n );\n\n for (let i = 0; i < packageNames.length; i++) {\n const packageName = packageNames[i];\n const result = results[i];\n\n if (result.status === 'fulfilled' && result.value) {\n this.resolved[packageName] = `^${result.value}`;\n } else {\n this.resolved[packageName] = this.getFallback(packageName);\n }\n }\n\n return this.resolved;\n }\n\n /** Get the fallback version for a package */\n getFallback(packageName: string): string {\n return FALLBACK_VERSIONS[packageName] ?? 'latest';\n }\n\n /** Fetch the latest version of a package from the npm registry */\n private async fetchLatestVersion(packageName: string): Promise<string | null> {\n try {\n const encodedName = packageName.startsWith('@')\n ? `@${encodeURIComponent(packageName.slice(1))}`\n : encodeURIComponent(packageName);\n\n const response = await fetch(\n `https://registry.npmjs.org/${encodedName}/latest`,\n {\n headers: { Accept: 'application/json' },\n signal: AbortSignal.timeout(5000),\n },\n );\n\n if (!response.ok) return null;\n\n const data = (await response.json()) as { version?: string };\n return data.version ?? null;\n } catch {\n return null;\n }\n }\n\n /** Get all resolved versions */\n getVersions(): Record<string, string> {\n return { ...this.resolved };\n }\n\n /** Get all fallback versions (for testing/reference) */\n static getFallbacks(): Record<string, string> {\n return { ...FALLBACK_VERSIONS };\n }\n}\n","/**\n * Logger — Colored terminal output utility using chalk.\n */\n\nimport chalk from 'chalk';\n\nexport const logger = {\n /** Step indicator (e.g. \"[1/16] Resolving versions...\") */\n step(current: number, total: number, message: string): void {\n console.log(chalk.cyan(` [${current}/${total}] `) + message);\n },\n\n /** Success message with green checkmark */\n success(message: string): void {\n console.log(chalk.green(' ✓ ') + message);\n },\n\n /** Warning message with yellow indicator */\n warn(message: string): void {\n console.log(chalk.yellow(' ⚠ ') + message);\n },\n\n /** Error message with red indicator */\n error(message: string): void {\n console.log(chalk.red(' ✗ ') + message);\n },\n\n /** Info message */\n info(message: string): void {\n console.log(chalk.blue(' ℹ ') + message);\n },\n\n /** Plain message with indent */\n log(message: string): void {\n console.log(' ' + message);\n },\n\n /** Section header */\n header(message: string): void {\n console.log();\n console.log(chalk.bold.white(message));\n },\n\n /** Dim secondary text */\n dim(message: string): void {\n console.log(chalk.dim(' ' + message));\n },\n\n /** Blank line */\n newline(): void {\n console.log();\n },\n\n /** Banner for CLI startup */\n banner(version: string): void {\n console.log();\n console.log(\n chalk.bold.cyan(' create-next-monorepo') + chalk.dim(` v${version}`),\n );\n console.log(\n chalk.dim(' Generate production-ready Next.js monorepos in one command'),\n );\n console.log();\n },\n\n /** Summary box after generation */\n summary(lines: string[]): void {\n const maxLength = Math.max(...lines.map((line) => line.length));\n const border = '─'.repeat(maxLength + 4);\n\n console.log();\n console.log(chalk.green(' ┌' + border + '┐'));\n for (const line of lines) {\n console.log(\n chalk.green(' │') +\n ' ' +\n line.padEnd(maxLength + 2) +\n chalk.green('│'),\n );\n }\n console.log(chalk.green(' └' + border + '┘'));\n console.log();\n },\n};\n","/**\n * Expected directories and files for a generated monorepo.\n * Shared by Generator (creation) and Doctor (validation).\n */\n\nimport type { ProjectConfig } from './project-config.js';\n\n/** All directories that should exist in a generated monorepo */\nexport function getExpectedDirectories(config: ProjectConfig): string[] {\n const dirs = [\n // Apps\n 'apps/web/app',\n 'apps/web/app/api',\n 'apps/web/components',\n 'apps/web/hooks',\n 'apps/web/lib',\n 'apps/web/public',\n 'apps/web/types',\n 'apps/api/src',\n 'apps/api/test',\n\n // Packages\n 'packages/config/eslint',\n 'packages/config/typescript',\n 'packages/ui/src/components',\n 'packages/ui/src/hooks',\n 'packages/lib/src/types',\n 'packages/lib/src/utils',\n 'packages/lib/src/constants',\n 'packages/lib/src/validators',\n\n // AI Skills (always present)\n '.claude/skills/component-design',\n '.claude/skills/page-design',\n '.claude/skills/api-feature',\n '.claude/skills/monorepo-doctor',\n ];\n\n // Tailwind config dir\n if (config.usesTailwind) {\n dirs.push('packages/config/tailwind');\n }\n\n // Backend-specific dirs\n if (config.backend === 'nestjs') {\n dirs.push(\n 'apps/api/src/common/filters',\n 'apps/api/src/common/guards',\n 'apps/api/src/common/interceptors',\n 'apps/api/src/common/pipes',\n );\n } else {\n dirs.push(\n 'apps/api/src/routes',\n 'apps/api/src/services',\n 'apps/api/src/common/filters',\n 'apps/api/src/common/guards',\n 'apps/api/src/common/interceptors',\n 'apps/api/src/common/pipes',\n );\n }\n\n // Database dirs\n if (config.hasDatabase) {\n dirs.push('packages/database/src');\n if (config.orm === 'prisma') {\n dirs.push('packages/database/prisma');\n } else {\n dirs.push('packages/database/src/schema');\n }\n }\n\n // Auth dirs\n if (config.hasAuth) {\n if (config.auth === 'next-auth') {\n dirs.push('apps/web/app/api/auth/[...nextauth]');\n } else {\n dirs.push('apps/web/app/api/auth/login');\n }\n }\n\n // State dirs\n if (config.hasState) {\n const stateDir =\n config.state === 'tanstack-query' ? 'apps/web/lib/query' : 'apps/web/lib/store';\n dirs.push(stateDir);\n }\n\n // GitHub dirs (conditional)\n if (config.githubFiles) {\n dirs.push(\n '.github/ISSUE_TEMPLATE',\n '.github/workflows',\n );\n }\n\n return dirs;\n}\n\n/** All files that should exist in a generated monorepo */\nexport function getExpectedFiles(config: ProjectConfig): string[] {\n const files = [\n // Root\n 'package.json',\n 'turbo.json',\n '.gitignore',\n '.env.example',\n '.prettierrc',\n 'README.md',\n 'LICENSE',\n 'CONTRIBUTING.md',\n\n // AI Skills (always present)\n '.claude/settings.json',\n '.claude/skills/component-design/SKILL.md',\n '.claude/skills/page-design/SKILL.md',\n '.claude/skills/api-feature/SKILL.md',\n '.claude/skills/monorepo-doctor/SKILL.md',\n ];\n\n // Workspace config\n if (config.packageManager === 'pnpm') {\n files.push('pnpm-workspace.yaml');\n }\n\n // Docker compose (only for non-sqlite DBs)\n if (config.hasDatabase && config.db !== 'sqlite') {\n files.push('docker-compose.yml');\n }\n\n // ── packages/config ──\n files.push(\n 'packages/config/package.json',\n 'packages/config/eslint/base.js',\n 'packages/config/typescript/base.json',\n 'packages/config/typescript/nextjs.json',\n 'packages/config/typescript/node.json',\n );\n if (config.usesTailwind) {\n files.push('packages/config/tailwind/base.js');\n }\n\n // ── packages/lib ──\n files.push(\n 'packages/lib/package.json',\n 'packages/lib/tsconfig.json',\n 'packages/lib/src/index.ts',\n 'packages/lib/src/types/index.ts',\n 'packages/lib/src/utils/index.ts',\n 'packages/lib/src/constants/index.ts',\n 'packages/lib/src/validators/index.ts',\n );\n\n // ── packages/ui ──\n files.push(\n 'packages/ui/package.json',\n 'packages/ui/tsconfig.json',\n 'packages/ui/src/index.ts',\n 'packages/ui/src/components/index.ts',\n 'packages/ui/src/components/button.tsx',\n 'packages/ui/src/components/card.tsx',\n 'packages/ui/src/components/input.tsx',\n 'packages/ui/src/hooks/index.ts',\n 'packages/ui/src/hooks/use-media-query.ts',\n 'packages/ui/src/hooks/use-debounce.ts',\n );\n if (config.styling === 'css-modules') {\n files.push(\n 'packages/ui/src/components/button.module.css',\n 'packages/ui/src/components/card.module.css',\n 'packages/ui/src/components/input.module.css',\n );\n }\n\n // ── packages/database ──\n if (config.hasDatabase) {\n files.push(\n 'packages/database/package.json',\n 'packages/database/tsconfig.json',\n 'packages/database/src/index.ts',\n 'packages/database/src/client.ts',\n 'packages/database/src/seed.ts',\n );\n if (config.orm === 'prisma') {\n files.push('packages/database/prisma/schema.prisma');\n } else {\n files.push('packages/database/src/schema/index.ts');\n }\n }\n\n // ── apps/web ──\n files.push(\n 'apps/web/package.json',\n 'apps/web/tsconfig.json',\n 'apps/web/next.config.ts',\n 'apps/web/app/globals.css',\n 'apps/web/app/layout.tsx',\n 'apps/web/app/page.tsx',\n 'apps/web/app/not-found.tsx',\n 'apps/web/app/error.tsx',\n 'apps/web/app/loading.tsx',\n );\n if (config.usesTailwind) {\n files.push('apps/web/postcss.config.mjs');\n }\n\n // State management files\n if (config.hasState) {\n const stateDir =\n config.state === 'tanstack-query' ? 'apps/web/lib/query' : 'apps/web/lib/store';\n files.push(`${stateDir}/index.ts`);\n\n switch (config.state) {\n case 'zustand':\n files.push(`${stateDir}/theme-store.ts`);\n break;\n case 'jotai':\n files.push(`${stateDir}/theme-atom.ts`);\n break;\n case 'redux':\n files.push(`${stateDir}/store.ts`, `${stateDir}/theme-slice.ts`, `${stateDir}/provider.tsx`);\n break;\n case 'tanstack-query':\n files.push(`${stateDir}/query-client.ts`, `${stateDir}/provider.tsx`);\n break;\n }\n }\n\n // Auth files\n if (config.hasAuth) {\n files.push('apps/web/lib/auth.ts', 'apps/web/middleware.ts');\n if (config.auth === 'next-auth') {\n files.push(\n 'apps/web/app/api/auth/[...nextauth]/route.ts',\n 'apps/web/types/next-auth.d.ts',\n );\n } else {\n files.push(\n 'apps/web/app/api/auth/login/route.ts',\n 'apps/web/types/auth.ts',\n );\n }\n }\n\n // ── apps/api ──\n files.push(\n 'apps/api/package.json',\n 'apps/api/tsconfig.json',\n 'apps/api/src/main.ts',\n );\n\n if (config.backend === 'nestjs') {\n files.push(\n 'apps/api/src/app.module.ts',\n 'apps/api/src/app.controller.ts',\n 'apps/api/src/app.service.ts',\n 'apps/api/src/common/filters/http-exception.filter.ts',\n 'apps/api/src/common/interceptors/logging.interceptor.ts',\n 'apps/api/src/common/guards/auth.guard.ts',\n 'apps/api/src/common/pipes/zod-validation.pipe.ts',\n );\n } else {\n files.push(\n 'apps/api/src/app.ts',\n 'apps/api/src/routes/health.ts',\n 'apps/api/src/services/app.service.ts',\n 'apps/api/src/common/filters/error-handler.ts',\n 'apps/api/src/common/interceptors/request-logger.ts',\n 'apps/api/src/common/guards/auth.guard.ts',\n 'apps/api/src/common/pipes/validate.ts',\n );\n }\n\n // GitHub files (conditional)\n if (config.githubFiles) {\n files.push(\n 'CODE_OF_CONDUCT.md',\n '.github/FUNDING.yml',\n '.github/ISSUE_TEMPLATE/bug_report.md',\n '.github/ISSUE_TEMPLATE/feature_request.md',\n '.github/pull_request_template.md',\n '.github/workflows/ci.yml',\n );\n }\n\n return files;\n}\n","/**\n * Root-level templates — package.json, turbo.json, pnpm-workspace.yaml,\n * .gitignore, .env.example, .prettierrc, docker-compose.yml, README, CONTRIBUTING.\n */\n\nimport type { ProjectConfig } from '../project-config.js';\nimport {\n backendDisplayName,\n stylingDisplayName,\n ormDisplayName,\n stateDisplayName,\n authDisplayName,\n} from '../project-config.js';\n\n/** Root package.json for the monorepo workspace */\nexport function rootPackageJson(config: ProjectConfig): string {\n const workspaces =\n config.packageManager !== 'pnpm'\n ? `\\n \"workspaces\": [\\n \"apps/*\",\\n \"packages/*\"\\n ],`\n : '';\n\n return `{\n \"name\": \"${config.name}\",\n \"version\": \"1.0.0\",\n \"private\": true,${workspaces}\n \"scripts\": {\n \"build\": \"${config.runCommand} build\",\n \"dev\": \"${config.runCommand} dev\",\n \"lint\": \"${config.runCommand} lint\",\n \"test\": \"${config.runCommand} test\",\n \"format\": \"prettier --write \\\\\"**/*.{ts,tsx,js,jsx,json,md}\\\\\"\",\n \"format:check\": \"prettier --check \\\\\"**/*.{ts,tsx,js,jsx,json,md}\\\\\"\"\n },\n \"devDependencies\": {\n \"prettier\": \"${config.versions['prettier'] ?? '^3.5.3'}\",\n \"turbo\": \"${config.versions['turbo'] ?? '^2.5.0'}\",\n \"typescript\": \"${config.versions['typescript'] ?? '^5.8.3'}\"\n },\n \"packageManager\": \"${config.packageManager === 'pnpm' ? 'pnpm@10.8.0' : config.packageManager === 'yarn' ? 'yarn@4.9.1' : config.packageManager === 'bun' ? 'bun@1.2.12' : 'npm@10.9.2'}\"\n}\n`;\n}\n\n/** Turborepo pipeline configuration */\nexport function turboJson(_config: ProjectConfig): string {\n return `{\n \"$schema\": \"https://turbo.build/schema.json\",\n \"tasks\": {\n \"build\": {\n \"dependsOn\": [\"^build\"],\n \"outputs\": [\".next/**\", \"!.next/cache/**\", \"dist/**\"]\n },\n \"dev\": {\n \"cache\": false,\n \"persistent\": true\n },\n \"lint\": {\n \"dependsOn\": [\"^build\"]\n },\n \"test\": {\n \"dependsOn\": [\"^build\"]\n },\n \"format\": {},\n \"format:check\": {}\n }\n}\n`;\n}\n\n/** pnpm workspace configuration */\nexport function pnpmWorkspaceYaml(): string {\n return `packages:\n - \"apps/*\"\n - \"packages/*\"\n`;\n}\n\n/** Root .gitignore */\nexport function gitignore(): string {\n return `# Dependencies\nnode_modules/\n.pnp\n.pnp.js\n\n# Build outputs\ndist/\n.next/\nout/\nbuild/\n\n# Environment\n.env\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\n# IDE\n.vscode/settings.json\n.idea/\n*.swp\n*.swo\n\n# OS\n.DS_Store\nThumbs.db\n\n# Debug\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\n\n# Turbo\n.turbo/\n\n# Testing\ncoverage/\n\n# Misc\n*.tsbuildinfo\n`;\n}\n\n/** Environment variables example */\nexport function envExample(config: ProjectConfig): string {\n let content = `# ─── Application ───────────────────────────────────────────\nNODE_ENV=development\nPORT=3001\n\n# ─── Frontend ─────────────────────────────────────────────\nNEXT_PUBLIC_API_URL=http://localhost:3001\n`;\n\n if (config.hasDatabase) {\n content += `\n# ─── Database ─────────────────────────────────────────────\n`;\n switch (config.db) {\n case 'postgres':\n content += `DATABASE_URL=\"postgresql://postgres:password@localhost:5432/${config.name}?schema=public\"\\n`;\n break;\n case 'mysql':\n content += `DATABASE_URL=\"mysql://root:password@localhost:3306/${config.name}\"\\n`;\n break;\n case 'sqlite':\n content += `DATABASE_URL=\"file:./dev.db\"\\n`;\n break;\n case 'mongodb':\n content += `DATABASE_URL=\"mongodb://localhost:27017/${config.name}\"\\n`;\n break;\n }\n }\n\n if (config.hasAuth) {\n content += `\n# ─── Authentication ───────────────────────────────────────\n`;\n if (config.auth === 'next-auth') {\n content += `AUTH_SECRET=\"your-secret-here\"\nAUTH_URL=\"http://localhost:3000\"\n# AUTH_GITHUB_ID=\"\"\n# AUTH_GITHUB_SECRET=\"\"\n# AUTH_GOOGLE_ID=\"\"\n# AUTH_GOOGLE_SECRET=\"\"\n`;\n } else {\n content += `JWT_SECRET=\"your-jwt-secret-here\"\nJWT_EXPIRES_IN=\"7d\"\n`;\n }\n }\n\n return content;\n}\n\n/** Prettier configuration */\nexport function prettierrc(): string {\n return `{\n \"semi\": true,\n \"singleQuote\": true,\n \"trailingComma\": \"all\",\n \"printWidth\": 100,\n \"tabWidth\": 2,\n \"endOfLine\": \"lf\"\n}\n`;\n}\n\n/** Docker Compose for database services */\nexport function dockerCompose(config: ProjectConfig): string {\n if (!config.hasDatabase) return '';\n\n let services = '';\n\n switch (config.db) {\n case 'postgres':\n services = ` postgres:\n image: postgres:17-alpine\n container_name: ${config.name}-postgres\n restart: unless-stopped\n ports:\n - \"5432:5432\"\n environment:\n POSTGRES_DB: ${config.name}\n POSTGRES_USER: postgres\n POSTGRES_PASSWORD: password\n volumes:\n - postgres_data:/var/lib/postgresql/data\n\nvolumes:\n postgres_data:`;\n break;\n\n case 'mysql':\n services = ` mysql:\n image: mysql:8.4\n container_name: ${config.name}-mysql\n restart: unless-stopped\n ports:\n - \"3306:3306\"\n environment:\n MYSQL_DATABASE: ${config.name}\n MYSQL_ROOT_PASSWORD: password\n volumes:\n - mysql_data:/var/lib/mysql\n\nvolumes:\n mysql_data:`;\n break;\n\n case 'mongodb':\n services = ` mongodb:\n image: mongo:8\n container_name: ${config.name}-mongodb\n restart: unless-stopped\n ports:\n - \"27017:27017\"\n volumes:\n - mongo_data:/data/db\n\nvolumes:\n mongo_data:`;\n break;\n\n case 'sqlite':\n return '';\n }\n\n return `services:\n${services}\n`;\n}\n\n/** README.md for the generated monorepo */\nexport function readmeMd(config: ProjectConfig): string {\n const year = new Date().getFullYear();\n\n let dbSection = '';\n if (config.hasDatabase && config.db !== 'sqlite') {\n dbSection = `\n## Database\n\nStart the database with Docker:\n\n\\`\\`\\`bash\ndocker compose up -d\n\\`\\`\\`\n${config.orm === 'prisma' ? `\nRun migrations:\n\n\\`\\`\\`bash\ncd packages/database\nnpx prisma migrate dev\n\\`\\`\\`\n` : `\nPush schema changes:\n\n\\`\\`\\`bash\ncd packages/database\nnpx drizzle-kit push\n\\`\\`\\`\n`}`;\n }\n\n return `# ${config.pascalCase}\n\nA production-ready monorepo built with **Next.js 15**, **${backendDisplayName[config.backend]}**, and **Turborepo**.\n\n## Tech Stack\n\n| Layer | Technology |\n|-------|-----------|\n| Frontend | Next.js 15 (App Router) |\n| Backend | ${backendDisplayName[config.backend]} |\n| Styling | ${stylingDisplayName[config.styling]} |\n| State | ${stateDisplayName[config.state]} |\n| Auth | ${authDisplayName[config.auth]} |\n| ORM | ${ormDisplayName[config.orm]} |\n| Monorepo | Turborepo + ${config.packageManager} workspaces |\n\n## Getting Started\n\n\\`\\`\\`bash\n# Install dependencies\n${config.installCommand}\n\n# Start all apps in development\n${config.runCommand} dev\n\n# Build all apps\n${config.runCommand} build\n\n# Run tests\n${config.runCommand} test\n\n# Format code\n${config.runCommand} format\n\\`\\`\\`\n${dbSection}\n## Project Structure\n\n\\`\\`\\`\n${config.name}/\n├── apps/\n│ ├── web/ # Next.js 15 frontend\n│ └── api/ # ${backendDisplayName[config.backend]} backend\n├── packages/\n│ ├── ui/ # Shared React components\n│ ├── lib/ # Shared utilities & types\n│ ├── config/ # Shared ESLint/TS/Tailwind configs${config.hasDatabase ? '\\n│ └── database/ # ' + ormDisplayName[config.orm] + ' ORM layer' : ''}\n├── turbo.json # Turborepo pipeline\n└── package.json # Workspace root\n\\`\\`\\`\n\n## Apps\n\n### Web (\\`apps/web\\`)\nNext.js 15 application using the App Router, ${stylingDisplayName[config.styling]} for styling${config.hasState ? ', and ' + stateDisplayName[config.state] + ' for state management' : ''}.\n\n### API (\\`apps/api\\`)\n${backendDisplayName[config.backend]} REST API server${config.hasDatabase ? ' with ' + ormDisplayName[config.orm] + ' ORM' : ''}.\n\n## Packages\n\n### UI (\\`packages/ui\\`)\nShared React component library with reusable components and hooks.\n\n### Lib (\\`packages/lib\\`)\nShared TypeScript types, utility functions, constants, and Zod validators.\n\n### Config (\\`packages/config\\`)\nShared configuration for ESLint, TypeScript, and ${config.usesTailwind ? 'Tailwind CSS' : 'other tools'}.\n${config.hasDatabase ? `\n### Database (\\`packages/database\\`)\n${ormDisplayName[config.orm]} ORM setup with schema definitions, migrations, and seed data.\n` : ''}\n\n## License\n\n${config.license === 'proprietary' ? `Copyright ${year}. All rights reserved.` : `This project is licensed under the ${config.license} License — see the [LICENSE](LICENSE) file for details.`}\n`;\n}\n\n/** CONTRIBUTING.md for the generated monorepo */\nexport function contributingMd(config: ProjectConfig): string {\n return `# Contributing to ${config.pascalCase}\n\nThank you for your interest in contributing!\n\n## Development Setup\n\n1. Fork and clone the repository\n2. Install dependencies: \\`${config.installCommand}\\`\n3. Start development: \\`${config.runCommand} dev\\`\n\n## Project Structure\n\nThis is a Turborepo monorepo. Changes to shared packages (\\`packages/*\\`) will be picked up by consuming apps (\\`apps/*\\`) automatically during development.\n\n## Code Style\n\n- Run \\`${config.runCommand} format\\` before committing\n- Run \\`${config.runCommand} lint\\` to check for issues\n- Run \\`${config.runCommand} test\\` to verify changes\n\n## Pull Requests\n\n1. Create a feature branch from \\`main\\`\n2. Make your changes\n3. Ensure all checks pass (lint, test, build)\n4. Submit a pull request with a clear description\n\n## Commit Messages\n\nUse conventional commits: \\`feat:\\`, \\`fix:\\`, \\`docs:\\`, \\`chore:\\`, \\`refactor:\\`, \\`test:\\`\n`;\n}\n","/**\n * Config package templates — shared ESLint, TypeScript, and Tailwind configurations.\n */\n\nimport type { ProjectConfig } from '../project-config.js';\n\n/** packages/config/package.json */\nexport function configPackageJson(config: ProjectConfig): string {\n const tailwindExport = config.usesTailwind\n ? `\\n \"./tailwind\": \"./tailwind/base.js\",`\n : '';\n\n return `{\n \"name\": \"@${config.name}/config\",\n \"version\": \"0.0.0\",\n \"private\": true,\n \"exports\": {\n \"./eslint\": \"./eslint/base.js\",\n \"./typescript/base\": \"./typescript/base.json\",\n \"./typescript/nextjs\": \"./typescript/nextjs.json\",\n \"./typescript/node\": \"./typescript/node.json\"${tailwindExport}\n }\n}\n`;\n}\n\n/** packages/config/eslint/base.js — shared ESLint flat config */\nexport function eslintBase(_config: ProjectConfig): string {\n return `import js from '@eslint/js';\nimport tsPlugin from '@typescript-eslint/eslint-plugin';\nimport tsParser from '@typescript-eslint/parser';\n\n/** @type {import('eslint').Linter.Config[]} */\nexport default [\n js.configs.recommended,\n {\n files: ['**/*.{ts,tsx}'],\n languageOptions: {\n parser: tsParser,\n parserOptions: {\n ecmaVersion: 'latest',\n sourceType: 'module',\n },\n },\n plugins: {\n '@typescript-eslint': tsPlugin,\n },\n rules: {\n ...tsPlugin.configs.recommended.rules,\n '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],\n '@typescript-eslint/no-explicit-any': 'warn',\n '@typescript-eslint/consistent-type-imports': 'error',\n 'no-console': ['warn', { allow: ['warn', 'error'] }],\n },\n },\n {\n ignores: ['**/node_modules/**', '**/dist/**', '**/.next/**', '**/coverage/**'],\n },\n];\n`;\n}\n\n/** packages/config/typescript/base.json — shared base tsconfig */\nexport function tsConfigBase(): string {\n return `{\n \"$schema\": \"https://json.schemastore.org/tsconfig\",\n \"compilerOptions\": {\n \"target\": \"ES2022\",\n \"lib\": [\"ES2022\"],\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"declaration\": true,\n \"declarationMap\": true,\n \"sourceMap\": true,\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"resolveJsonModule\": true,\n \"isolatedModules\": true,\n \"noUnusedLocals\": true,\n \"noUnusedParameters\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"verbatimModuleSyntax\": true\n },\n \"exclude\": [\"node_modules\", \"dist\", \"coverage\"]\n}\n`;\n}\n\n/** packages/config/typescript/nextjs.json — tsconfig for Next.js apps */\nexport function tsConfigNextjs(): string {\n return `{\n \"$schema\": \"https://json.schemastore.org/tsconfig\",\n \"extends\": \"./base.json\",\n \"compilerOptions\": {\n \"target\": \"ES2017\",\n \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n \"module\": \"ESNext\",\n \"jsx\": \"preserve\",\n \"incremental\": true,\n \"plugins\": [{ \"name\": \"next\" }],\n \"paths\": {\n \"@/*\": [\"./*\"]\n },\n \"allowJs\": true,\n \"noEmit\": true,\n \"verbatimModuleSyntax\": false\n }\n}\n`;\n}\n\n/** packages/config/typescript/node.json — tsconfig for Node.js backend apps */\nexport function tsConfigNode(): string {\n return `{\n \"$schema\": \"https://json.schemastore.org/tsconfig\",\n \"extends\": \"./base.json\",\n \"compilerOptions\": {\n \"target\": \"ES2022\",\n \"module\": \"commonjs\",\n \"moduleResolution\": \"node\",\n \"outDir\": \"./dist\",\n \"rootDir\": \"./src\",\n \"emitDecoratorMetadata\": true,\n \"experimentalDecorators\": true,\n \"declaration\": true,\n \"sourceMap\": true,\n \"verbatimModuleSyntax\": false\n }\n}\n`;\n}\n\n/** packages/config/tailwind/base.js — shared Tailwind config */\nexport function tailwindBase(config: ProjectConfig): string {\n if (!config.usesTailwind) return '';\n\n return `/** @type {import('tailwindcss').Config} */\nexport default {\n content: [\n './app/**/*.{ts,tsx}',\n './components/**/*.{ts,tsx}',\n '../../packages/ui/src/**/*.{ts,tsx}',\n ],\n theme: {\n extend: {\n colors: {\n brand: {\n 50: '#eff6ff',\n 100: '#dbeafe',\n 200: '#bfdbfe',\n 300: '#93c5fd',\n 400: '#60a5fa',\n 500: '#3b82f6',\n 600: '#2563eb',\n 700: '#1d4ed8',\n 800: '#1e40af',\n 900: '#1e3a8a',\n 950: '#172554',\n },\n },\n fontFamily: {\n sans: ['Inter', 'system-ui', 'sans-serif'],\n mono: ['JetBrains Mono', 'monospace'],\n },\n },\n },\n plugins: [],\n};\n`;\n}\n","/**\n * Lib package templates — shared types, utils, constants, and Zod validators.\n */\n\nimport type { ProjectConfig } from '../project-config.js';\n\n/** packages/lib/package.json */\nexport function libPackageJson(config: ProjectConfig): string {\n return `{\n \"name\": \"@${config.name}/lib\",\n \"version\": \"0.0.0\",\n \"private\": true,\n \"type\": \"module\",\n \"main\": \"./src/index.ts\",\n \"types\": \"./src/index.ts\",\n \"exports\": {\n \".\": \"./src/index.ts\",\n \"./types\": \"./src/types/index.ts\",\n \"./utils\": \"./src/utils/index.ts\",\n \"./constants\": \"./src/constants/index.ts\",\n \"./validators\": \"./src/validators/index.ts\"\n },\n \"dependencies\": {\n \"zod\": \"${config.versions['zod'] ?? '^3.24.3'}\"\n },\n \"devDependencies\": {\n \"typescript\": \"${config.versions['typescript'] ?? '^5.8.3'}\"\n }\n}\n`;\n}\n\n/** packages/lib/tsconfig.json */\nexport function libTsConfig(): string {\n return `{\n \"extends\": \"@${'{name}'}/config/typescript/base\",\n \"compilerOptions\": {\n \"outDir\": \"./dist\",\n \"rootDir\": \"./src\"\n },\n \"include\": [\"src/**/*\"]\n}\n`;\n}\n\n/** packages/lib/src/index.ts — barrel export */\nexport function libIndex(): string {\n return `export * from './types/index.js';\nexport * from './utils/index.js';\nexport * from './constants/index.js';\nexport * from './validators/index.js';\n`;\n}\n\n/** packages/lib/src/types/index.ts — shared type definitions */\nexport function libTypes(): string {\n return `/**\n * Shared TypeScript types used across the monorepo.\n */\n\n/** Standard API response envelope */\nexport interface ApiResponse<T = unknown> {\n success: boolean;\n data: T;\n message?: string;\n timestamp: string;\n}\n\n/** Paginated API response */\nexport interface PaginatedResponse<T = unknown> extends ApiResponse<T[]> {\n pagination: {\n page: number;\n pageSize: number;\n totalItems: number;\n totalPages: number;\n };\n}\n\n/** API error response */\nexport interface ApiError {\n success: false;\n error: {\n code: string;\n message: string;\n details?: Record<string, string[]>;\n };\n timestamp: string;\n}\n\n/** Result type for operations that can succeed or fail */\nexport type Result<T, E = Error> =\n | { ok: true; value: T }\n | { ok: false; error: E };\n\n/** Helper to create a success result */\nexport function ok<T>(value: T): Result<T, never> {\n return { ok: true, value };\n}\n\n/** Helper to create a failure result */\nexport function err<E>(error: E): Result<never, E> {\n return { ok: false, error };\n}\n\n/** Pagination query parameters */\nexport interface PaginationParams {\n page?: number;\n pageSize?: number;\n sortBy?: string;\n sortOrder?: 'asc' | 'desc';\n}\n\n/** Base entity with common fields */\nexport interface BaseEntity {\n id: string;\n createdAt: Date;\n updatedAt: Date;\n}\n`;\n}\n\n/** packages/lib/src/utils/index.ts — shared utility functions */\nexport function libUtils(): string {\n return `/**\n * Shared utility functions used across the monorepo.\n */\n\n/** Format a date to a locale-aware string */\nexport function formatDate(date: Date | string, locale = 'en-US'): string {\n const dateObj = typeof date === 'string' ? new Date(date) : date;\n return dateObj.toLocaleDateString(locale, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n });\n}\n\n/** Delay execution for the specified milliseconds */\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/** Safely parse JSON, returning null on failure */\nexport function safeJsonParse<T>(json: string): T | null {\n try {\n return JSON.parse(json) as T;\n } catch {\n return null;\n }\n}\n\n/** Generate a URL-friendly slug from a string */\nexport function slugify(text: string): string {\n return text\n .toLowerCase()\n .trim()\n .replace(/[^\\\\w\\\\s-]/g, '')\n .replace(/[\\\\s_]+/g, '-')\n .replace(/-+/g, '-');\n}\n\n/** Truncate a string to the specified length with ellipsis */\nexport function truncate(text: string, maxLength: number): string {\n if (text.length <= maxLength) return text;\n return text.slice(0, maxLength - 3) + '...';\n}\n\n/** Remove undefined and null values from an object */\nexport function compact<T extends Record<string, unknown>>(obj: T): Partial<T> {\n return Object.fromEntries(\n Object.entries(obj).filter(([, value]) => value != null),\n ) as Partial<T>;\n}\n\n/** Clamp a number between min and max */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n`;\n}\n\n/** packages/lib/src/constants/index.ts — shared constants */\nexport function libConstants(): string {\n return `/**\n * Shared constants used across the monorepo.\n */\n\n/** HTTP status codes */\nexport const HttpStatus = {\n OK: 200,\n CREATED: 201,\n NO_CONTENT: 204,\n BAD_REQUEST: 400,\n UNAUTHORIZED: 401,\n FORBIDDEN: 403,\n NOT_FOUND: 404,\n CONFLICT: 409,\n UNPROCESSABLE_ENTITY: 422,\n INTERNAL_SERVER_ERROR: 500,\n SERVICE_UNAVAILABLE: 503,\n} as const;\n\n/** Default pagination values */\nexport const PAGINATION = {\n DEFAULT_PAGE: 1,\n DEFAULT_PAGE_SIZE: 20,\n MAX_PAGE_SIZE: 100,\n} as const;\n\n/** Common regex patterns */\nexport const Patterns = {\n EMAIL: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,}$/,\n SLUG: /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n UUID: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,\n} as const;\n`;\n}\n\n/** packages/lib/src/validators/index.ts — shared Zod schemas */\nexport function libValidators(): string {\n return `/**\n * Shared Zod validation schemas used across the monorepo.\n */\n\nimport { z } from 'zod';\n\n/** Email address validator */\nexport const emailSchema = z.string().email('Invalid email address').trim().toLowerCase();\n\n/** Non-empty string validator */\nexport const requiredString = z.string().trim().min(1, 'This field is required');\n\n/** Pagination query schema */\nexport const paginationSchema = z.object({\n page: z.coerce.number().int().positive().default(1),\n pageSize: z.coerce.number().int().positive().max(100).default(20),\n sortBy: z.string().optional(),\n sortOrder: z.enum(['asc', 'desc']).default('asc'),\n});\n\n/** UUID validator */\nexport const uuidSchema = z.string().uuid('Invalid ID format');\n\n/** Slug validator */\nexport const slugSchema = z\n .string()\n .trim()\n .min(1)\n .max(100)\n .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'Invalid slug format');\n\nexport type PaginationInput = z.infer<typeof paginationSchema>;\n`;\n}\n","/**\n * UI package templates — shared React components and hooks.\n */\n\nimport type { ProjectConfig } from '../project-config.js';\n\n/** packages/ui/package.json */\nexport function uiPackageJson(config: ProjectConfig): string {\n const styledDep =\n config.styling === 'styled-components'\n ? `\\n \"styled-components\": \"${config.versions['styled-components'] ?? '^6.1.18'}\",`\n : '';\n\n return `{\n \"name\": \"@${config.name}/ui\",\n \"version\": \"0.0.0\",\n \"private\": true,\n \"type\": \"module\",\n \"main\": \"./src/index.ts\",\n \"types\": \"./src/index.ts\",\n \"exports\": {\n \".\": \"./src/index.ts\",\n \"./components\": \"./src/components/index.ts\",\n \"./hooks\": \"./src/hooks/index.ts\"\n },\n \"dependencies\": {\n \"react\": \"${config.versions['react'] ?? '^19.1.0'}\",${styledDep}\n \"react-dom\": \"${config.versions['react-dom'] ?? '^19.1.0'}\"\n },\n \"devDependencies\": {\n \"@types/react\": \"${config.versions['@types/react'] ?? '^19.1.2'}\",\n \"@types/react-dom\": \"${config.versions['@types/react-dom'] ?? '^19.1.2'}\",\n \"typescript\": \"${config.versions['typescript'] ?? '^5.8.3'}\"\n }\n}\n`;\n}\n\n/** packages/ui/tsconfig.json */\nexport function uiTsConfig(config: ProjectConfig): string {\n return `{\n \"extends\": \"@${config.name}/config/typescript/base\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"outDir\": \"./dist\",\n \"rootDir\": \"./src\",\n \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n \"verbatimModuleSyntax\": false\n },\n \"include\": [\"src/**/*\"]\n}\n`;\n}\n\n/** packages/ui/src/index.ts — barrel export */\nexport function uiIndex(): string {\n return `export * from './components/index.js';\nexport * from './hooks/index.js';\n`;\n}\n\n/** packages/ui/src/components/index.ts — component barrel */\nexport function uiComponentsIndex(): string {\n return `export { Button } from './button.js';\nexport type { ButtonProps } from './button.js';\n\nexport { Card } from './card.js';\nexport type { CardProps } from './card.js';\n\nexport { Input } from './input.js';\nexport type { InputProps } from './input.js';\n`;\n}\n\n/** packages/ui/src/components/button.tsx */\nexport function uiButton(config: ProjectConfig): string {\n if (config.styling === 'styled-components') {\n return `import React from 'react';\nimport styled from 'styled-components';\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: 'primary' | 'secondary' | 'outline' | 'ghost';\n size?: 'sm' | 'md' | 'lg';\n}\n\nconst StyledButton = styled.button<{ $variant: string; $size: string }>\\`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: 8px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.2s ease;\n\n \\${({ $size }) =>\n $size === 'sm'\n ? 'padding: 6px 12px; font-size: 14px;'\n : $size === 'lg'\n ? 'padding: 12px 24px; font-size: 18px;'\n : 'padding: 8px 16px; font-size: 16px;'}\n\n \\${({ $variant }) =>\n $variant === 'primary'\n ? 'background: #2563eb; color: white; border: none;'\n : $variant === 'secondary'\n ? 'background: #64748b; color: white; border: none;'\n : $variant === 'outline'\n ? 'background: transparent; color: #2563eb; border: 1px solid #2563eb;'\n : 'background: transparent; color: #374151; border: none;'}\n\n &:hover {\n opacity: 0.9;\n transform: translateY(-1px);\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n transform: none;\n }\n\\`;\n\nexport function Button({\n variant = 'primary',\n size = 'md',\n children,\n ...props\n}: ButtonProps) {\n return (\n <StyledButton $variant={variant} $size={size} {...props}>\n {children}\n </StyledButton>\n );\n}\n`;\n }\n\n if (config.styling === 'css-modules') {\n return `import React from 'react';\nimport styles from './button.module.css';\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: 'primary' | 'secondary' | 'outline' | 'ghost';\n size?: 'sm' | 'md' | 'lg';\n}\n\nexport function Button({\n variant = 'primary',\n size = 'md',\n className,\n children,\n ...props\n}: ButtonProps) {\n const classNames = [\n styles.button,\n styles[variant],\n styles[size],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <button className={classNames} {...props}>\n {children}\n </button>\n );\n}\n`;\n }\n\n // Tailwind (default)\n return `import React from 'react';\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: 'primary' | 'secondary' | 'outline' | 'ghost';\n size?: 'sm' | 'md' | 'lg';\n}\n\nconst variantStyles = {\n primary: 'bg-blue-600 text-white hover:bg-blue-700 border-transparent',\n secondary: 'bg-slate-600 text-white hover:bg-slate-700 border-transparent',\n outline: 'bg-transparent text-blue-600 hover:bg-blue-50 border-blue-600',\n ghost: 'bg-transparent text-slate-700 hover:bg-slate-100 border-transparent',\n} as const;\n\nconst sizeStyles = {\n sm: 'px-3 py-1.5 text-sm',\n md: 'px-4 py-2 text-base',\n lg: 'px-6 py-3 text-lg',\n} as const;\n\nexport function Button({\n variant = 'primary',\n size = 'md',\n className = '',\n children,\n ...props\n}: ButtonProps) {\n return (\n <button\n className={\\`inline-flex items-center justify-center rounded-lg font-medium border transition-all duration-200 hover:-translate-y-0.5 disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none \\${variantStyles[variant]} \\${sizeStyles[size]} \\${className}\\`}\n {...props}\n >\n {children}\n </button>\n );\n}\n`;\n}\n\n/** packages/ui/src/components/card.tsx */\nexport function uiCard(config: ProjectConfig): string {\n if (config.styling === 'styled-components') {\n return `import React from 'react';\nimport styled from 'styled-components';\n\nexport interface CardProps {\n title?: string;\n description?: string;\n children?: React.ReactNode;\n className?: string;\n}\n\nconst StyledCard = styled.div\\`\n background: white;\n border: 1px solid #e2e8f0;\n border-radius: 12px;\n padding: 24px;\n transition: box-shadow 0.2s ease;\n\n &:hover {\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n }\n\\`;\n\nconst Title = styled.h3\\`\n font-size: 18px;\n font-weight: 600;\n color: #1e293b;\n margin: 0 0 8px 0;\n\\`;\n\nconst Description = styled.p\\`\n font-size: 14px;\n color: #64748b;\n margin: 0 0 16px 0;\n\\`;\n\nexport function Card({ title, description, children }: CardProps) {\n return (\n <StyledCard>\n {title && <Title>{title}</Title>}\n {description && <Description>{description}</Description>}\n {children}\n </StyledCard>\n );\n}\n`;\n }\n\n if (config.styling === 'css-modules') {\n return `import React from 'react';\nimport styles from './card.module.css';\n\nexport interface CardProps {\n title?: string;\n description?: string;\n children?: React.ReactNode;\n className?: string;\n}\n\nexport function Card({ title, description, children, className }: CardProps) {\n return (\n <div className={\\`\\${styles.card} \\${className ?? ''}\\`}>\n {title && <h3 className={styles.title}>{title}</h3>}\n {description && <p className={styles.description}>{description}</p>}\n {children}\n </div>\n );\n}\n`;\n }\n\n return `import React from 'react';\n\nexport interface CardProps {\n title?: string;\n description?: string;\n children?: React.ReactNode;\n className?: string;\n}\n\nexport function Card({ title, description, children, className = '' }: CardProps) {\n return (\n <div\n className={\\`rounded-xl border border-slate-200 bg-white p-6 transition-shadow hover:shadow-lg \\${className}\\`}\n >\n {title && <h3 className=\"text-lg font-semibold text-slate-900 mb-2\">{title}</h3>}\n {description && <p className=\"text-sm text-slate-500 mb-4\">{description}</p>}\n {children}\n </div>\n );\n}\n`;\n}\n\n/** packages/ui/src/components/input.tsx */\nexport function uiInput(config: ProjectConfig): string {\n if (config.styling === 'styled-components') {\n return `import React from 'react';\nimport styled from 'styled-components';\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n label?: string;\n error?: string;\n}\n\nconst Wrapper = styled.div\\`\n display: flex;\n flex-direction: column;\n gap: 4px;\n\\`;\n\nconst Label = styled.label\\`\n font-size: 14px;\n font-weight: 500;\n color: #374151;\n\\`;\n\nconst StyledInput = styled.input<{ $hasError: boolean }>\\`\n width: 100%;\n padding: 8px 12px;\n border: 1px solid \\${({ $hasError }) => ($hasError ? '#ef4444' : '#d1d5db')};\n border-radius: 8px;\n font-size: 16px;\n outline: none;\n transition: border-color 0.2s;\n\n &:focus {\n border-color: \\${({ $hasError }) => ($hasError ? '#ef4444' : '#2563eb')};\n box-shadow: 0 0 0 3px \\${({ $hasError }) =>\n $hasError ? 'rgba(239, 68, 68, 0.1)' : 'rgba(37, 99, 235, 0.1)'};\n }\n\\`;\n\nconst ErrorText = styled.span\\`\n font-size: 12px;\n color: #ef4444;\n\\`;\n\nexport function Input({ label, error, ...props }: InputProps) {\n return (\n <Wrapper>\n {label && <Label>{label}</Label>}\n <StyledInput $hasError={!!error} {...props} />\n {error && <ErrorText>{error}</ErrorText>}\n </Wrapper>\n );\n}\n`;\n }\n\n if (config.styling === 'css-modules') {\n return `import React from 'react';\nimport styles from './input.module.css';\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n label?: string;\n error?: string;\n}\n\nexport function Input({ label, error, className, ...props }: InputProps) {\n return (\n <div className={styles.wrapper}>\n {label && <label className={styles.label}>{label}</label>}\n <input\n className={\\`\\${styles.input} \\${error ? styles.error : ''} \\${className ?? ''}\\`}\n {...props}\n />\n {error && <span className={styles.errorText}>{error}</span>}\n </div>\n );\n}\n`;\n }\n\n return `import React from 'react';\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n label?: string;\n error?: string;\n}\n\nexport function Input({ label, error, className = '', ...props }: InputProps) {\n return (\n <div className=\"flex flex-col gap-1\">\n {label && (\n <label className=\"text-sm font-medium text-gray-700\">{label}</label>\n )}\n <input\n className={\\`w-full rounded-lg border px-3 py-2 text-base outline-none transition-colors focus:ring-2 \\${\n error\n ? 'border-red-500 focus:border-red-500 focus:ring-red-100'\n : 'border-gray-300 focus:border-blue-600 focus:ring-blue-100'\n } \\${className}\\`}\n {...props}\n />\n {error && <span className=\"text-xs text-red-500\">{error}</span>}\n </div>\n );\n}\n`;\n}\n\n/** packages/ui/src/components/button.module.css (CSS Modules only) */\nexport function uiButtonCss(): string {\n return `.button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: 8px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.2s ease;\n border: 1px solid transparent;\n}\n\n.button:hover { opacity: 0.9; transform: translateY(-1px); }\n.button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }\n\n.primary { background: #2563eb; color: white; }\n.secondary { background: #64748b; color: white; }\n.outline { background: transparent; color: #2563eb; border-color: #2563eb; }\n.ghost { background: transparent; color: #374151; }\n\n.sm { padding: 6px 12px; font-size: 14px; }\n.md { padding: 8px 16px; font-size: 16px; }\n.lg { padding: 12px 24px; font-size: 18px; }\n`;\n}\n\n/** packages/ui/src/components/card.module.css (CSS Modules only) */\nexport function uiCardCss(): string {\n return `.card {\n background: white;\n border: 1px solid #e2e8f0;\n border-radius: 12px;\n padding: 24px;\n transition: box-shadow 0.2s ease;\n}\n\n.card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); }\n\n.title {\n font-size: 18px;\n font-weight: 600;\n color: #1e293b;\n margin: 0 0 8px 0;\n}\n\n.description {\n font-size: 14px;\n color: #64748b;\n margin: 0 0 16px 0;\n}\n`;\n}\n\n/** packages/ui/src/components/input.module.css (CSS Modules only) */\nexport function uiInputCss(): string {\n return `.wrapper {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.label {\n font-size: 14px;\n font-weight: 500;\n color: #374151;\n}\n\n.input {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid #d1d5db;\n border-radius: 8px;\n font-size: 16px;\n outline: none;\n transition: border-color 0.2s;\n}\n\n.input:focus {\n border-color: #2563eb;\n box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);\n}\n\n.error { border-color: #ef4444; }\n.error:focus {\n border-color: #ef4444;\n box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);\n}\n\n.errorText {\n font-size: 12px;\n color: #ef4444;\n}\n`;\n}\n\n/** packages/ui/src/hooks/index.ts — hooks barrel */\nexport function uiHooksIndex(): string {\n return `export { useMediaQuery } from './use-media-query.js';\nexport { useDebounce } from './use-debounce.js';\n`;\n}\n\n/** packages/ui/src/hooks/use-media-query.ts */\nexport function uiUseMediaQuery(): string {\n return `import { useState, useEffect } from 'react';\n\n/**\n * Hook that tracks a CSS media query match state.\n *\n * @param query - CSS media query string (e.g. '(min-width: 768px)')\n * @returns Whether the media query currently matches\n */\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState(false);\n\n useEffect(() => {\n const mediaQuery = window.matchMedia(query);\n setMatches(mediaQuery.matches);\n\n const handler = (event: MediaQueryListEvent) => setMatches(event.matches);\n mediaQuery.addEventListener('change', handler);\n return () => mediaQuery.removeEventListener('change', handler);\n }, [query]);\n\n return matches;\n}\n`;\n}\n\n/** packages/ui/src/hooks/use-debounce.ts */\nexport function uiUseDebounce(): string {\n return `import { useState, useEffect } from 'react';\n\n/**\n * Hook that debounces a rapidly changing value.\n *\n * @param value - The value to debounce\n * @param delay - Debounce delay in milliseconds (default 300)\n * @returns The debounced value\n */\nexport function useDebounce<T>(value: T, delay = 300): T {\n const [debouncedValue, setDebouncedValue] = useState(value);\n\n useEffect(() => {\n const timer = setTimeout(() => setDebouncedValue(value), delay);\n return () => clearTimeout(timer);\n }, [value, delay]);\n\n return debouncedValue;\n}\n`;\n}\n","/**\n * Next.js 15 App Router templates — layout, pages, config, and app-specific files.\n */\n\nimport type { ProjectConfig } from '../project-config.js';\n\n/** apps/web/package.json */\nexport function webPackageJson(config: ProjectConfig): string {\n const deps: Record<string, string> = {\n next: config.versions['next'] ?? '^15.3.1',\n react: config.versions['react'] ?? '^19.1.0',\n 'react-dom': config.versions['react-dom'] ?? '^19.1.0',\n [`@${config.name}/ui`]: 'workspace:*',\n [`@${config.name}/lib`]: 'workspace:*',\n };\n\n // State management dependency\n if (config.state === 'zustand') deps['zustand'] = config.versions['zustand'] ?? '^5.0.3';\n if (config.state === 'jotai') deps['jotai'] = config.versions['jotai'] ?? '^2.12.3';\n if (config.state === 'redux') {\n deps['@reduxjs/toolkit'] = config.versions['@reduxjs/toolkit'] ?? '^2.7.0';\n deps['react-redux'] = config.versions['react-redux'] ?? '^9.2.0';\n }\n if (config.state === 'tanstack-query')\n deps['@tanstack/react-query'] = config.versions['@tanstack/react-query'] ?? '^5.74.4';\n\n // Auth dependency\n if (config.auth === 'next-auth') deps['next-auth'] = config.versions['next-auth'] ?? '^5.0.0-beta.25';\n\n // Styled components\n if (config.styling === 'styled-components')\n deps['styled-components'] = config.versions['styled-components'] ?? '^6.1.18';\n\n const devDeps: Record<string, string> = {\n '@types/react': config.versions['@types/react'] ?? '^19.1.2',\n '@types/react-dom': config.versions['@types/react-dom'] ?? '^19.1.2',\n '@types/node': config.versions['@types/node'] ?? '^22.15.3',\n typescript: config.versions['typescript'] ?? '^5.8.3',\n [`@${config.name}/config`]: 'workspace:*',\n };\n\n if (config.usesTailwind) {\n devDeps['tailwindcss'] = config.versions['tailwindcss'] ?? '^4.1.4';\n devDeps['@tailwindcss/postcss'] = config.versions['@tailwindcss/postcss'] ?? '^4.1.4';\n devDeps['postcss'] = config.versions['postcss'] ?? '^8.5.3';\n devDeps['autoprefixer'] = config.versions['autoprefixer'] ?? '^10.4.21';\n }\n\n return `{\n \"name\": \"@${config.name}/web\",\n \"version\": \"0.0.0\",\n \"private\": true,\n \"scripts\": {\n \"dev\": \"next dev --turbopack\",\n \"build\": \"next build\",\n \"start\": \"next start\",\n \"lint\": \"next lint\",\n \"test\": \"${config.testing === 'vitest' ? 'vitest run' : 'jest'}\"\n },\n \"dependencies\": ${JSON.stringify(deps, null, 4)},\n \"devDependencies\": ${JSON.stringify(devDeps, null, 4)}\n}\n`;\n}\n\n/** apps/web/tsconfig.json */\nexport function webTsConfig(config: ProjectConfig): string {\n return `{\n \"extends\": \"@${config.name}/config/typescript/nextjs\",\n \"compilerOptions\": {\n \"paths\": {\n \"@/*\": [\"./*\"]\n }\n },\n \"include\": [\"next-env.d.ts\", \"**/*.ts\", \"**/*.tsx\", \".next/types/**/*.ts\"],\n \"exclude\": [\"node_modules\"]\n}\n`;\n}\n\n/** apps/web/next.config.ts */\nexport function nextConfig(config: ProjectConfig): string {\n return `import type { NextConfig } from 'next';\n\nconst nextConfig: NextConfig = {\n transpilePackages: ['@${config.name}/ui', '@${config.name}/lib'],\n reactStrictMode: true,\n};\n\nexport default nextConfig;\n`;\n}\n\n/** apps/web/postcss.config.mjs (Tailwind only) */\nexport function postcssConfig(): string {\n return `/** @type {import('postcss-load-config').Config} */\nconst config = {\n plugins: {\n '@tailwindcss/postcss': {},\n },\n};\n\nexport default config;\n`;\n}\n\n/** apps/web/app/globals.css */\nexport function globalsCss(config: ProjectConfig): string {\n if (config.usesTailwind) {\n return `@import \"tailwindcss\";\n\n:root {\n --foreground: #171717;\n --background: #ffffff;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --foreground: #ededed;\n --background: #0a0a0a;\n }\n}\n\nbody {\n color: var(--foreground);\n background: var(--background);\n font-family: Inter, system-ui, -apple-system, sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n`;\n }\n\n return `*,\n*::before,\n*::after {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n}\n\n:root {\n --foreground: #171717;\n --background: #ffffff;\n --brand-500: #3b82f6;\n --brand-600: #2563eb;\n --brand-700: #1d4ed8;\n --gray-100: #f3f4f6;\n --gray-200: #e5e7eb;\n --gray-500: #6b7280;\n --gray-700: #374151;\n --gray-900: #111827;\n --radius: 8px;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --foreground: #ededed;\n --background: #0a0a0a;\n }\n}\n\nbody {\n color: var(--foreground);\n background: var(--background);\n font-family: Inter, system-ui, -apple-system, sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\na {\n color: var(--brand-600);\n text-decoration: none;\n}\n\na:hover {\n text-decoration: underline;\n}\n`;\n}\n\n/** apps/web/app/layout.tsx */\nexport function rootLayout(config: ProjectConfig): string {\n const imports: string[] = [];\n let providers = '{children}';\n\n imports.push(`import type { Metadata } from 'next';`);\n imports.push(`import './globals.css';`);\n\n // State management providers\n if (config.state === 'redux') {\n imports.push(`import { StoreProvider } from '@/lib/store/provider';`);\n providers = `<StoreProvider>{children}</StoreProvider>`;\n }\n if (config.state === 'tanstack-query') {\n imports.push(`import { QueryProvider } from '@/lib/query/provider';`);\n providers = `<QueryProvider>{children}</QueryProvider>`;\n }\n\n return `${imports.join('\\n')}\n\nexport const metadata: Metadata = {\n title: '${config.pascalCase}',\n description: 'Built with Next.js 15, Turborepo, and ${config.backend === 'nestjs' ? 'NestJS' : 'Express'}',\n};\n\nexport default function RootLayout({\n children,\n}: {\n children: React.ReactNode;\n}) {\n return (\n <html lang=\"en\">\n <body>\n ${providers}\n </body>\n </html>\n );\n}\n`;\n}\n\n/** apps/web/app/page.tsx */\nexport function homePage(config: ProjectConfig): string {\n const buttonImport = `import { Button, Card } from '@${config.name}/ui';`;\n\n if (config.usesTailwind) {\n return `${buttonImport}\n\nexport default function HomePage() {\n return (\n <main className=\"min-h-screen flex flex-col items-center justify-center p-8\">\n <div className=\"max-w-2xl text-center space-y-8\">\n <h1 className=\"text-5xl font-bold text-slate-900\">\n ${config.pascalCase}\n </h1>\n <p className=\"text-xl text-slate-500\">\n Production-ready monorepo with Next.js 15, ${config.backend === 'nestjs' ? 'NestJS' : 'Express'}, and Turborepo.\n </p>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-8\">\n <Card\n title=\"Frontend\"\n description=\"Next.js 15 with App Router and ${config.styling === 'tailwind' ? 'Tailwind CSS' : config.styling === 'css-modules' ? 'CSS Modules' : 'Styled Components'}\"\n />\n <Card\n title=\"Backend\"\n description=\"${config.backend === 'nestjs' ? 'NestJS' : 'Express'} REST API${config.hasDatabase ? ' with ' + (config.orm === 'prisma' ? 'Prisma' : 'Drizzle') : ''}\"\n />\n </div>\n\n <div className=\"flex gap-4 justify-center mt-8\">\n <Button variant=\"primary\" size=\"lg\">\n Get Started\n </Button>\n <Button variant=\"outline\" size=\"lg\">\n Documentation\n </Button>\n </div>\n </div>\n </main>\n );\n}\n`;\n }\n\n // CSS Modules / Styled Components / plain CSS\n return `${buttonImport}\n\nexport default function HomePage() {\n return (\n <main style={{\n minHeight: '100vh',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '2rem',\n }}>\n <div style={{ maxWidth: '42rem', textAlign: 'center' }}>\n <h1 style={{ fontSize: '3rem', fontWeight: 'bold', color: '#0f172a', marginBottom: '1rem' }}>\n ${config.pascalCase}\n </h1>\n <p style={{ fontSize: '1.25rem', color: '#64748b', marginBottom: '2rem' }}>\n Production-ready monorepo with Next.js 15, ${config.backend === 'nestjs' ? 'NestJS' : 'Express'}, and Turborepo.\n </p>\n\n <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: '1rem', marginBottom: '2rem' }}>\n <Card\n title=\"Frontend\"\n description=\"Next.js 15 with App Router and ${config.styling === 'css-modules' ? 'CSS Modules' : 'Styled Components'}\"\n />\n <Card\n title=\"Backend\"\n description=\"${config.backend === 'nestjs' ? 'NestJS' : 'Express'} REST API${config.hasDatabase ? ' with ' + (config.orm === 'prisma' ? 'Prisma' : 'Drizzle') : ''}\"\n />\n </div>\n\n <div style={{ display: 'flex', gap: '1rem', justifyContent: 'center' }}>\n <Button variant=\"primary\" size=\"lg\">\n Get Started\n </Button>\n <Button variant=\"outline\" size=\"lg\">\n Documentation\n </Button>\n </div>\n </div>\n </main>\n );\n}\n`;\n}\n\n/** apps/web/app/not-found.tsx */\nexport function notFoundPage(config: ProjectConfig): string {\n if (config.usesTailwind) {\n return `import Link from 'next/link';\n\nexport default function NotFound() {\n return (\n <main className=\"min-h-screen flex flex-col items-center justify-center p-8\">\n <h1 className=\"text-6xl font-bold text-slate-900 mb-4\">404</h1>\n <p className=\"text-xl text-slate-500 mb-8\">Page not found</p>\n <Link\n href=\"/\"\n className=\"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors\"\n >\n Go Home\n </Link>\n </main>\n );\n}\n`;\n }\n\n return `import Link from 'next/link';\n\nexport default function NotFound() {\n return (\n <main style={{\n minHeight: '100vh',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '2rem',\n }}>\n <h1 style={{ fontSize: '4rem', fontWeight: 'bold', color: '#0f172a', marginBottom: '1rem' }}>404</h1>\n <p style={{ fontSize: '1.25rem', color: '#64748b', marginBottom: '2rem' }}>Page not found</p>\n <Link href=\"/\" style={{\n padding: '12px 24px',\n background: '#2563eb',\n color: 'white',\n borderRadius: '8px',\n textDecoration: 'none',\n }}>\n Go Home\n </Link>\n </main>\n );\n}\n`;\n}\n\n/** apps/web/app/error.tsx */\nexport function errorPage(): string {\n return `'use client';\n\nimport { useEffect } from 'react';\n\nexport default function Error({\n error,\n reset,\n}: {\n error: Error & { digest?: string };\n reset: () => void;\n}) {\n useEffect(() => {\n console.error(error);\n }, [error]);\n\n return (\n <main style={{\n minHeight: '100vh',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '2rem',\n }}>\n <h1 style={{ fontSize: '2rem', fontWeight: 'bold', marginBottom: '1rem' }}>\n Something went wrong\n </h1>\n <button\n onClick={reset}\n style={{\n padding: '12px 24px',\n background: '#2563eb',\n color: 'white',\n border: 'none',\n borderRadius: '8px',\n cursor: 'pointer',\n fontSize: '1rem',\n }}\n >\n Try again\n </button>\n </main>\n );\n}\n`;\n}\n\n/** apps/web/app/loading.tsx */\nexport function loadingPage(): string {\n return `export default function Loading() {\n return (\n <main style={{\n minHeight: '100vh',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n }}>\n <div style={{\n width: '40px',\n height: '40px',\n border: '4px solid #e2e8f0',\n borderTop: '4px solid #2563eb',\n borderRadius: '50%',\n animation: 'spin 0.8s linear infinite',\n }} />\n <style>{\\`@keyframes spin { to { transform: rotate(360deg); } }\\`}</style>\n </main>\n );\n}\n`;\n}\n","/**\n * License templates — text for all 11 supported license types.\n */\n\nimport type { ProjectConfig } from '../project-config.js';\n\n/** Generate the full license text for the configured license type */\nexport function licenseText(config: ProjectConfig): string {\n const year = new Date().getFullYear();\n const holder = config.pascalCase;\n\n switch (config.license) {\n case 'MIT':\n return `MIT License\n\nCopyright (c) ${year} ${holder}\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n`;\n\n case 'Apache-2.0':\n return ` Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n Copyright ${year} ${holder}\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n`;\n\n case 'BSD-2-Clause':\n return `BSD 2-Clause License\n\nCopyright (c) ${year}, ${holder}\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n`;\n\n case 'BSD-3-Clause':\n return `BSD 3-Clause License\n\nCopyright (c) ${year}, ${holder}\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n`;\n\n case 'GPL-2.0':\n return `Copyright (c) ${year} ${holder}\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along\nwith this program; if not, write to the Free Software Foundation, Inc.,\n51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n`;\n\n case 'GPL-3.0':\n return `Copyright (c) ${year} ${holder}\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see <https://www.gnu.org/licenses/>.\n`;\n\n case 'LGPL-2.1':\n return `Copyright (c) ${year} ${holder}\n\nThis library is free software; you can redistribute it and/or modify\nit under the terms of the GNU Lesser General Public License as published\nby the Free Software Foundation; either version 2.1 of the License, or\n(at your option) any later version.\n\nThis library is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU Lesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License\nalong with this library; if not, write to the Free Software Foundation,\nInc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n`;\n\n case 'MPL-2.0':\n return `Copyright (c) ${year} ${holder}\n\nThis Source Code Form is subject to the terms of the Mozilla Public\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\nfile, You can obtain one at https://mozilla.org/MPL/2.0/.\n`;\n\n case 'ISC':\n return `ISC License\n\nCopyright (c) ${year} ${holder}\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n`;\n\n case 'Unlicense':\n return `This is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to <https://unlicense.org>\n`;\n\n case 'proprietary':\n return `Copyright (c) ${year} ${holder}. All rights reserved.\n\nThis software and associated documentation files (the \"Software\") are\nproprietary and confidential. Unauthorized copying, distribution, modification,\nor use of this Software, in whole or in part, is strictly prohibited.\n\nThe Software is provided \"as is\" without warranty of any kind, express or\nimplied. In no event shall the authors or copyright holders be liable for any\nclaim, damages, or other liability arising from the use of the Software.\n`;\n }\n}\n","/**\n * AI Skills templates — .claude/settings.json + 4 SKILL.md files\n * for Claude Code integration in generated monorepos.\n */\n\nimport type { ProjectConfig } from '../project-config.js';\nimport {\n backendDisplayName,\n stylingDisplayName,\n ormDisplayName,\n stateDisplayName,\n} from '../project-config.js';\n\n/** .claude/settings.json — pre-approved tools and commands */\nexport function claudeSettings(config: ProjectConfig): string {\n const allowList = [\n 'Read',\n 'Glob',\n 'Grep',\n `Bash(${config.packageManager} install)`,\n `Bash(${config.runCommand} build)`,\n `Bash(${config.runCommand} dev)`,\n `Bash(${config.runCommand} lint)`,\n `Bash(${config.runCommand} test)`,\n `Bash(${config.runCommand} format)`,\n 'Bash(npx turbo *)',\n ];\n\n if (config.orm === 'prisma') {\n allowList.push('Bash(npx prisma *)');\n }\n if (config.orm === 'drizzle') {\n allowList.push('Bash(npx drizzle-kit *)');\n }\n\n return JSON.stringify({ permissions: { allow: allowList } }, null, 2) + '\\n';\n}\n\n/** .claude/skills/component-design/SKILL.md */\nexport function componentDesignSkill(config: ProjectConfig): string {\n let stylingGuide = '';\n switch (config.styling) {\n case 'tailwind':\n stylingGuide = `Use Tailwind utility classes for all styling. Define variant/size style maps as const objects.\nExample: \\`const variantStyles = { primary: 'bg-blue-600 text-white', secondary: 'bg-slate-600 text-white' } as const;\\``;\n break;\n case 'css-modules':\n stylingGuide = `Create a CSS Module alongside the component (\\`<name>.module.css\\`).\nImport as \\`import styles from './<name>.module.css'\\` and apply with \\`className={styles.root}\\`.`;\n break;\n case 'styled-components':\n stylingGuide = `Use styled-components for all styling. Create styled wrappers with transient props (\\`$variant\\`).\nExample: \\`const StyledButton = styled.button<{ $variant: string }>\\\\\\`...\\\\\\`;\\``;\n break;\n }\n\n return `---\ndescription: Build a reusable React component in the shared UI package\ntriggers:\n - \"Build a component\"\n - \"Create a reusable UI element\"\n - \"Convert this design to a component\"\n---\n\n# Component Design Workflow\n\nBuild reusable React components in \\`packages/ui/src/components/\\` that can be shared across the monorepo.\n\n## When to Use\n- Building a reusable UI element (Button, Card, Modal, Form, etc.)\n- Converting a design/mockup into a component\n- Extracting a repeated pattern into a shared component\n\n## File Placement\n\n| What | Where |\n|------|-------|\n| Component | \\`packages/ui/src/components/<name>.tsx\\` |\n| Types | Exported from the component file |\n| Barrel | \\`packages/ui/src/components/index.ts\\` |\n| Tests | \\`packages/ui/src/components/__tests__/<name>.test.tsx\\` |\n\n## Component Rules\n\n1. **Props interface** — Define a clear TypeScript interface with JSDoc comments\n2. **Variants** — Support variant/size props with sensible defaults\n3. **Composition** — Extend native HTML element props (\\`React.ButtonHTMLAttributes<HTMLButtonElement>\\`)\n4. **No hardcoded text** — Accept all text via props or children\n5. **Accessible** — Include proper ARIA attributes and keyboard handling\n6. **Responsive** — Works across all screen sizes\n\n## Styling\n\n${stylingGuide}\n\n## Steps\n\n1. **Define the props interface** with variants, sizes, and children\n2. **Implement the component** as a named function export\n3. **Add styling** following the ${stylingDisplayName[config.styling]} patterns above\n4. **Export from barrel** in \\`packages/ui/src/components/index.ts\\`\n5. **Write tests** covering all variants, sizes, and edge cases\n6. **Use in app** — import from \\`@${config.name}/ui\\`\n\n## Checklist\n\n- [ ] Props interface is well-typed with JSDoc\n- [ ] All variants and sizes render correctly\n- [ ] Component is accessible (ARIA, keyboard nav)\n- [ ] Responsive across breakpoints\n- [ ] Exported from barrel file\n- [ ] Tests written and passing\n\n## Verification\n\n\\`\\`\\`bash\n${config.runCommand} lint\n${config.runCommand} test\n\\`\\`\\`\n`;\n}\n\n/** .claude/skills/page-design/SKILL.md */\nexport function pageDesignSkill(config: ProjectConfig): string {\n let stateGuide = '';\n switch (config.state) {\n case 'zustand':\n stateGuide = `### Zustand Store\nCreate a store in \\`apps/web/lib/store/<feature>-store.ts\\`:\n\\`\\`\\`typescript\nimport { create } from 'zustand';\n\ninterface FeatureState {\n items: Item[];\n isLoading: boolean;\n fetchItems: () => Promise<void>;\n}\n\nexport const useFeatureStore = create<FeatureState>()((set) => ({\n items: [],\n isLoading: false,\n fetchItems: async () => {\n set({ isLoading: true });\n const res = await fetch(\\\\\\`\\\\\\${process.env.NEXT_PUBLIC_API_URL}/api/items\\\\\\`);\n const data = await res.json();\n set({ items: data.data, isLoading: false });\n },\n}));\n\\`\\`\\``;\n break;\n case 'jotai':\n stateGuide = `### Jotai Atoms\nCreate atoms in \\`apps/web/lib/store/<feature>-atom.ts\\`:\n\\`\\`\\`typescript\nimport { atom } from 'jotai';\n\nexport const itemsAtom = atom<Item[]>([]);\nexport const isLoadingAtom = atom(false);\n\\`\\`\\`\nUse with \\`const [items, setItems] = useAtom(itemsAtom)\\` in your page.`;\n break;\n case 'redux':\n stateGuide = `### Redux Toolkit Slice\nCreate a slice in \\`apps/web/lib/store/<feature>-slice.ts\\`:\n\\`\\`\\`typescript\nimport { createSlice, createAsyncThunk } from '@reduxjs/toolkit';\n\nexport const fetchItems = createAsyncThunk('feature/fetchItems', async () => {\n const res = await fetch(\\\\\\`\\\\\\${process.env.NEXT_PUBLIC_API_URL}/api/items\\\\\\`);\n return res.json();\n});\n\nconst featureSlice = createSlice({\n name: 'feature',\n initialState: { items: [], isLoading: false },\n reducers: {},\n extraReducers: (builder) => {\n builder.addCase(fetchItems.fulfilled, (state, action) => { state.items = action.payload; });\n },\n});\n\\`\\`\\`\nRegister the reducer in \\`apps/web/lib/store/store.ts\\`.`;\n break;\n case 'tanstack-query':\n stateGuide = `### TanStack Query Hook\nCreate a query hook in \\`apps/web/hooks/use-<feature>.ts\\`:\n\\`\\`\\`typescript\nimport { useQuery } from '@tanstack/react-query';\n\nexport function useItems() {\n return useQuery({\n queryKey: ['items'],\n queryFn: async () => {\n const res = await fetch(\\\\\\`\\\\\\${process.env.NEXT_PUBLIC_API_URL}/api/items\\\\\\`);\n return res.json();\n },\n });\n}\n\\`\\`\\``;\n break;\n default:\n stateGuide = `### No State Management\nUse React Server Components for data fetching, or \\`useState\\`/\\`useEffect\\` for client-side state.`;\n break;\n }\n\n return `---\ndescription: Build a Next.js page with state management and API integration\ntriggers:\n - \"Build a page\"\n - \"Create a route\"\n - \"Add a screen\"\n---\n\n# Page/Route Design Workflow\n\nBuild Next.js App Router pages in \\`apps/web/app/\\` with ${config.hasState ? stateDisplayName[config.state] : 'React'} state management.\n\n## When to Use\n- Adding a new page or route to the frontend\n- Building a data-driven view that fetches from the API\n- Creating a form page with client-side state\n\n## File Placement\n\n| What | Where |\n|------|-------|\n| Page | \\`apps/web/app/<route>/page.tsx\\` |\n| Loading | \\`apps/web/app/<route>/loading.tsx\\` |\n| Error | \\`apps/web/app/<route>/error.tsx\\` |\n| Layout | \\`apps/web/app/<route>/layout.tsx\\` (optional) |\n${config.hasState ? `| State | \\`apps/web/lib/${config.state === 'tanstack-query' ? 'query' : 'store'}/<feature>.ts\\` |` : ''}\n| Tests | \\`apps/web/app/<route>/__tests__/page.test.tsx\\` |\n\n## Steps\n\n1. **Create the page** in \\`apps/web/app/<route>/page.tsx\\`\n2. **Add loading and error states** (\\`loading.tsx\\`, \\`error.tsx\\`) in the same directory\n3. **Wire state management** (see pattern below)\n4. **Connect to API** using \\`NEXT_PUBLIC_API_URL\\` env var\n5. **Import shared components** from \\`@${config.name}/ui\\`\n6. **Write tests** for the page component\n\n## State Management Pattern\n\n${stateGuide}\n\n## Checklist\n\n- [ ] Page component created in \\`app/<route>/page.tsx\\`\n- [ ] Loading and error states handled\n- [ ] State management wired (if applicable)\n- [ ] API integration working\n- [ ] Shared UI components used from \\`@${config.name}/ui\\`\n- [ ] Responsive design verified\n- [ ] Tests written and passing\n\n## Verification\n\n\\`\\`\\`bash\n${config.runCommand} lint\n${config.runCommand} test\n\\`\\`\\`\n`;\n}\n\n/** .claude/skills/api-feature/SKILL.md */\nexport function apiFeatureSkill(config: ProjectConfig): string {\n let endpointGuide = '';\n if (config.backend === 'nestjs') {\n endpointGuide = `### NestJS Module Pattern\nCreate a feature module with controller and service:\n\n\\`\\`\\`\napps/api/src/<feature>/\n├── <feature>.module.ts\n├── <feature>.controller.ts\n├── <feature>.service.ts\n└── dto/\n └── create-<feature>.dto.ts\n\\`\\`\\`\n\nRegister the module in \\`apps/api/src/app.module.ts\\` imports array.`;\n } else {\n endpointGuide = `### Express Route Pattern\nCreate route and service files:\n\n\\`\\`\\`\napps/api/src/\n├── routes/<feature>.ts\n└── services/<feature>.service.ts\n\\`\\`\\`\n\nRegister the route in \\`apps/api/src/app.ts\\` with \\`app.use('/api', <feature>Router)\\`.`;\n }\n\n let schemaGuide = '';\n if (config.orm === 'prisma') {\n schemaGuide = `### Prisma Schema\nAdd a model to \\`packages/database/prisma/schema.prisma\\`, then run:\n\\`\\`\\`bash\ncd packages/database && npx prisma migrate dev --name add-<feature>\n\\`\\`\\``;\n } else if (config.orm === 'drizzle') {\n schemaGuide = `### Drizzle Schema\nCreate \\`packages/database/src/schema/<feature>.ts\\`, export from \\`index.ts\\`, then run:\n\\`\\`\\`bash\ncd packages/database && npx drizzle-kit push\n\\`\\`\\``;\n } else {\n schemaGuide = `### No ORM\nNo database ORM is configured. Use raw queries or add an ORM.`;\n }\n\n return `---\ndescription: Build a backend API endpoint with validation and database access\ntriggers:\n - \"Add an API endpoint\"\n - \"Create a backend feature\"\n - \"Build a CRUD resource\"\n---\n\n# API Feature Design Workflow\n\nBuild ${backendDisplayName[config.backend]} API endpoints with Zod validation${config.hasDatabase ? ' and ' + ormDisplayName[config.orm] + ' database access' : ''}.\n\n## When to Use\n- Adding a new REST endpoint to the backend\n- Building CRUD operations for a resource\n- Creating a service with business logic\n\n## Steps\n\n### 1. Define Types and Validators\nCreate shared types and Zod schemas in \\`packages/lib/\\`:\n\n\\`\\`\\`\npackages/lib/src/\n├── types/<feature>.ts # TypeScript interfaces\n└── validators/<feature>.ts # Zod schemas\n\\`\\`\\`\n\n### 2. Database Schema\n${schemaGuide}\n\n### 3. Build the API Endpoint\n${endpointGuide}\n\n### 4. Add Validation\nUse Zod validators from \\`@${config.name}/lib/validators\\` for request body validation.\n${config.backend === 'nestjs' ? 'Use the `ZodValidationPipe` in `apps/api/src/common/pipes/`.' : 'Use the `validate()` middleware in `apps/api/src/common/pipes/`.'}\n\n### 5. Connect from Frontend\nCall the API from your Next.js page:\n\\`\\`\\`typescript\nimport type { CreateItemInput } from '@${config.name}/lib/validators';\nconst apiUrl = process.env.NEXT_PUBLIC_API_URL;\n\\`\\`\\`\n\n### 6. Write Tests\n${config.backend === 'nestjs' ? 'File: `apps/api/test/<feature>.e2e-spec.ts`' : 'File: `apps/api/test/<feature>.test.ts`'}\n\n## Checklist\n\n- [ ] Types defined in \\`packages/lib/src/types/\\`\n- [ ] Zod validators defined in \\`packages/lib/src/validators/\\`\n${config.hasDatabase ? '- [ ] Database schema defined and migrated\\n' : ''}- [ ] API endpoint created and tested\n- [ ] Request validation in place\n- [ ] Error handling for edge cases\n- [ ] Frontend integration working\n- [ ] Tests written and passing\n\n## Verification\n\n\\`\\`\\`bash\n${config.runCommand} lint\n${config.runCommand} test\n\\`\\`\\`\n`;\n}\n\n/** .claude/skills/monorepo-doctor/SKILL.md */\nexport function monrepoDoctorSkill(): string {\n return `---\ndescription: Check monorepo structure integrity and fix missing items\ntriggers:\n - \"Check structure\"\n - \"What is missing\"\n - \"Run doctor\"\n - \"Validate the project\"\n---\n\n# Monorepo Doctor\n\nValidate the monorepo's directory and file structure, and auto-fix any missing items.\n\n## When to Use\n- After pulling changes or merging branches\n- When something seems broken or files are missing\n- To verify the project structure is complete\n- After manually deleting or moving files\n\n## How to Run\n\n### Check structure (report only)\n\\`\\`\\`bash\nnpx @msishamim/create-next-monorepo doctor\n\\`\\`\\`\n\n### Auto-fix missing items\n\\`\\`\\`bash\nnpx @msishamim/create-next-monorepo doctor --fix\n\\`\\`\\`\n\n## What It Checks\n\n### Directories\n- App directories: \\`apps/web/\\`, \\`apps/api/\\`\n- Package directories: \\`packages/ui/\\`, \\`packages/lib/\\`, \\`packages/config/\\`, \\`packages/database/\\`\n- Source subdirectories: components, hooks, types, utils, validators\n- Backend-specific: controllers/routes, services, filters, guards, interceptors, pipes\n- AI skills: \\`.claude/skills/\\`\n\n### Files\n- Root configs: \\`package.json\\`, \\`turbo.json\\`, \\`.gitignore\\`, \\`.prettierrc\\`, \\`README.md\\`, \\`LICENSE\\`\n- Package configs: \\`package.json\\`, \\`tsconfig.json\\` for each package\n- Source files: barrel exports, components, hooks, utilities\n- Backend files: entry point, controllers/routes, services, middleware\n- Database files: schema, client, seed (if ORM configured)\n\n### Restorable Files\nFiles marked as \"restorable\" can be fully regenerated from templates with \\`--fix\\`:\n- README.md, LICENSE, CONTRIBUTING.md\n- Config files (ESLint, TypeScript, Tailwind)\n- Shared utilities, validators, constants\n- UI hooks (useMediaQuery, useDebounce)\n- AI skill files\n\nNon-restorable files (containing user code) are created as empty placeholders.\n`;\n}\n","/**\n * GitHub community templates — CI workflow, issue/PR templates,\n * code of conduct, and funding configuration.\n */\n\nimport type { ProjectConfig } from '../project-config.js';\n\n/** CODE_OF_CONDUCT.md — Contributor Covenant v2.1 */\nexport function codeOfConduct(): string {\n return `# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participation in our\ncommunity a harassment-free experience for everyone, regardless of age, body\nsize, visible or invisible disability, ethnicity, sex characteristics, gender\nidentity and expression, level of experience, education, socio-economic status,\nnationality, personal appearance, race, religion, or sexual identity\nand orientation.\n\nWe pledge to act and interact in ways that contribute to an open, welcoming,\ndiverse, inclusive, and healthy community.\n\n## Our Standards\n\nExamples of behavior that contributes to a positive environment:\n\n* Using welcoming and inclusive language\n* Being respectful of differing viewpoints and experiences\n* Gracefully accepting constructive criticism\n* Focusing on what is best for the community\n* Showing empathy towards other community members\n\nExamples of unacceptable behavior:\n\n* The use of sexualized language or imagery, and sexual attention or advances\n* Trolling, insulting or derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information without explicit permission\n* Other conduct which could reasonably be considered inappropriate\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be\nreported to the community leaders responsible for enforcement. All complaints\nwill be reviewed and investigated promptly and fairly.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),\nversion 2.1, available at\n[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).\n`;\n}\n\n/** .github/FUNDING.yml — sponsorship placeholder */\nexport function fundingYml(): string {\n return `# These are supported funding model platforms\n# Uncomment and fill in the ones that apply to your project\n\n# github: [your-username]\n# patreon: # Replace with a single Patreon username\n# open_collective: # Replace with a single Open Collective username\n# ko_fi: # Replace with a single Ko-fi username\n# custom: [\"https://example.com/donate\"]\n`;\n}\n\n/** .github/ISSUE_TEMPLATE/bug_report.md */\nexport function bugReport(): string {\n return `---\nname: Bug Report\nabout: Create a report to help us improve\ntitle: \"[Bug]: \"\nlabels: bug\nassignees: \"\"\n---\n\n## Describe the Bug\nA clear and concise description of what the bug is.\n\n## Steps to Reproduce\n1. Go to '...'\n2. Click on '...'\n3. Scroll down to '...'\n4. See error\n\n## Expected Behavior\nA clear and concise description of what you expected to happen.\n\n## Actual Behavior\nA clear and concise description of what actually happened.\n\n## Screenshots\nIf applicable, add screenshots to help explain your problem.\n\n## Environment\n- **OS:** [e.g. macOS 15, Windows 11, Ubuntu 24.04]\n- **Node.js:** [e.g. 20.x, 22.x]\n- **Browser:** [e.g. Chrome 130, Safari 18]\n- **Package Manager:** [e.g. pnpm 10.x]\n\n## Additional Context\nAdd any other context about the problem here.\n`;\n}\n\n/** .github/ISSUE_TEMPLATE/feature_request.md */\nexport function featureRequest(): string {\n return `---\nname: Feature Request\nabout: Suggest an idea for this project\ntitle: \"[Feature]: \"\nlabels: enhancement\nassignees: \"\"\n---\n\n## Problem Statement\nA clear and concise description of what the problem is.\nEx. I'm always frustrated when...\n\n## Proposed Solution\nA clear and concise description of what you want to happen.\n\n## Alternatives Considered\nA clear and concise description of any alternative solutions or features you've considered.\n\n## Additional Context\nAdd any other context, mockups, or screenshots about the feature request here.\n`;\n}\n\n/** .github/pull_request_template.md */\nexport function pullRequestTemplate(): string {\n return `## Summary\n\n<!-- Briefly describe what this PR does -->\n\n## Changes\n\n- [ ] Change 1\n- [ ] Change 2\n\n## Type of Change\n\n- [ ] Bug fix (non-breaking change that fixes an issue)\n- [ ] New feature (non-breaking change that adds functionality)\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\n- [ ] Refactor (code change that neither fixes a bug nor adds a feature)\n- [ ] Documentation (changes to documentation only)\n\n## Testing\n\n- [ ] Tests added for new functionality\n- [ ] All existing tests pass\n- [ ] Linting passes\n- [ ] Manual testing performed\n\n## Checklist\n\n- [ ] Code follows the project's style guidelines\n- [ ] Self-review of code completed\n- [ ] Documentation updated (if applicable)\n- [ ] No new warnings introduced\n- [ ] Changes respect package boundaries (shared code in packages/, app code in apps/)\n`;\n}\n\n/** .github/workflows/ci.yml — Turborepo-aware GitHub Actions CI */\nexport function ciWorkflow(config: ProjectConfig): string {\n let setupPm = '';\n let installCmd = '';\n\n switch (config.packageManager) {\n case 'pnpm':\n setupPm = `\n - name: Setup pnpm\n uses: pnpm/action-setup@v4\n with:\n version: 10`;\n installCmd = 'pnpm install --frozen-lockfile';\n break;\n case 'yarn':\n setupPm = '';\n installCmd = 'yarn install --frozen-lockfile';\n break;\n case 'bun':\n setupPm = `\n - name: Setup Bun\n uses: oven-sh/setup-bun@v2`;\n installCmd = 'bun install --frozen-lockfile';\n break;\n default:\n setupPm = '';\n installCmd = 'npm ci';\n break;\n }\n\n return `name: CI\n\non:\n push:\n branches: [main, master, develop]\n pull_request:\n branches: [main, master, develop]\n\njobs:\n ci:\n name: Lint, Type-check & Build\n runs-on: ubuntu-latest\n\n steps:\n - name: Checkout\n uses: actions/checkout@v4\n${setupPm}\n - name: Setup Node.js\n uses: actions/setup-node@v4\n with:\n node-version: 20\n ${config.packageManager === 'pnpm' ? \"cache: 'pnpm'\" : config.packageManager === 'yarn' ? \"cache: 'yarn'\" : config.packageManager === 'npm' ? \"cache: 'npm'\" : ''}\n\n - name: Install dependencies\n run: ${installCmd}\n\n - name: Lint\n run: ${config.runCommand} lint\n\n - name: Build\n run: ${config.runCommand} build\n`;\n}\n","/**\n * NestJS backend strategy — generates NestJS-specific backend files.\n */\n\nimport type { ProjectConfig } from '../../project-config.js';\nimport type { BackendStrategy } from './backend-strategy.js';\n\nexport class NestjsTemplateStrategy implements BackendStrategy {\n packageJson(config: ProjectConfig): string {\n return `{\n \"name\": \"@${config.name}/api\",\n \"version\": \"0.0.0\",\n \"private\": true,\n \"scripts\": {\n \"build\": \"nest build\",\n \"dev\": \"nest start --watch\",\n \"start\": \"nest start\",\n \"start:prod\": \"node dist/main\",\n \"lint\": \"eslint src --ext .ts\",\n \"test\": \"${config.testing === 'vitest' ? 'vitest run' : 'jest'}\"\n },\n \"dependencies\": {\n \"@nestjs/common\": \"${config.versions['@nestjs/common'] ?? '^11.0.20'}\",\n \"@nestjs/core\": \"${config.versions['@nestjs/core'] ?? '^11.0.20'}\",\n \"@nestjs/platform-express\": \"${config.versions['@nestjs/platform-express'] ?? '^11.0.20'}\",\n \"reflect-metadata\": \"${config.versions['reflect-metadata'] ?? '^0.2.2'}\",\n \"rxjs\": \"${config.versions['rxjs'] ?? '^7.8.2'}\",\n \"@${config.name}/lib\": \"workspace:*\"${config.hasDatabase ? `,\\n \"@${config.name}/database\": \"workspace:*\"` : ''}\n },\n \"devDependencies\": {\n \"@nestjs/cli\": \"${config.versions['@nestjs/cli'] ?? '^11.0.5'}\",\n \"@nestjs/testing\": \"${config.versions['@nestjs/testing'] ?? '^11.0.20'}\",\n \"@types/node\": \"${config.versions['@types/node'] ?? '^22.15.3'}\",\n \"typescript\": \"${config.versions['typescript'] ?? '^5.8.3'}\"\n }\n}\n`;\n }\n\n tsConfig(config: ProjectConfig): string {\n return `{\n \"extends\": \"@${config.name}/config/typescript/node\",\n \"compilerOptions\": {\n \"outDir\": \"./dist\",\n \"rootDir\": \"./src\"\n },\n \"include\": [\"src/**/*\"],\n \"exclude\": [\"node_modules\", \"dist\", \"test\"]\n}\n`;\n }\n\n mainEntry(config: ProjectConfig): string {\n return `import { NestFactory } from '@nestjs/core';\nimport { ValidationPipe } from '@nestjs/common';\nimport { AppModule } from './app.module.js';\nimport { HttpExceptionFilter } from './common/filters/http-exception.filter.js';\nimport { LoggingInterceptor } from './common/interceptors/logging.interceptor.js';\n\nasync function bootstrap() {\n const app = await NestFactory.create(AppModule);\n\n app.enableCors({\n origin: process.env.CORS_ORIGIN ?? 'http://localhost:3000',\n credentials: true,\n });\n\n app.setGlobalPrefix('api');\n app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));\n app.useGlobalFilters(new HttpExceptionFilter());\n app.useGlobalInterceptors(new LoggingInterceptor());\n\n const port = process.env.PORT ?? 3001;\n await app.listen(port);\n console.log(\\`🚀 ${config.pascalCase} API running on http://localhost:\\${port}/api\\`);\n}\n\nbootstrap();\n`;\n }\n\n appSetup(_config: ProjectConfig): string {\n return `import { Module } from '@nestjs/common';\nimport { AppController } from './app.controller.js';\nimport { AppService } from './app.service.js';\n\n@Module({\n imports: [],\n controllers: [AppController],\n providers: [AppService],\n})\nexport class AppModule {}\n`;\n }\n\n appController(_config: ProjectConfig): string {\n return `import { Controller, Get } from '@nestjs/common';\nimport { AppService } from './app.service.js';\n\n@Controller()\nexport class AppController {\n constructor(private readonly appService: AppService) {}\n\n @Get('health')\n getHealth() {\n return this.appService.getHealth();\n }\n\n @Get()\n getInfo() {\n return this.appService.getInfo();\n }\n}\n`;\n }\n\n appService(config: ProjectConfig): string {\n return `import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class AppService {\n getHealth() {\n return {\n status: 'ok',\n timestamp: new Date().toISOString(),\n uptime: process.uptime(),\n };\n }\n\n getInfo() {\n return {\n name: '${config.name}',\n version: '1.0.0',\n environment: process.env.NODE_ENV ?? 'development',\n };\n }\n}\n`;\n }\n\n exceptionFilter(): string {\n return `import {\n ExceptionFilter,\n Catch,\n ArgumentsHost,\n HttpException,\n HttpStatus,\n} from '@nestjs/common';\nimport type { Response } from 'express';\n\n@Catch()\nexport class HttpExceptionFilter implements ExceptionFilter {\n catch(exception: unknown, host: ArgumentsHost) {\n const ctx = host.switchToHttp();\n const response = ctx.getResponse<Response>();\n\n const status =\n exception instanceof HttpException\n ? exception.getStatus()\n : HttpStatus.INTERNAL_SERVER_ERROR;\n\n const message =\n exception instanceof HttpException\n ? exception.message\n : 'Internal server error';\n\n response.status(status).json({\n success: false,\n error: {\n code: HttpStatus[status] ?? 'UNKNOWN_ERROR',\n message,\n },\n timestamp: new Date().toISOString(),\n });\n }\n}\n`;\n }\n\n loggingInterceptor(): string {\n return `import {\n Injectable,\n NestInterceptor,\n ExecutionContext,\n CallHandler,\n} from '@nestjs/common';\nimport { Observable, tap } from 'rxjs';\n\n@Injectable()\nexport class LoggingInterceptor implements NestInterceptor {\n intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {\n const request = context.switchToHttp().getRequest();\n const method = request.method;\n const url = request.url;\n const startTime = Date.now();\n\n return next.handle().pipe(\n tap(() => {\n const duration = Date.now() - startTime;\n console.log(\\`\\${method} \\${url} — \\${duration}ms\\`);\n }),\n );\n }\n}\n`;\n }\n\n authGuard(): string {\n return `import {\n Injectable,\n CanActivate,\n ExecutionContext,\n UnauthorizedException,\n} from '@nestjs/common';\n\n@Injectable()\nexport class AuthGuard implements CanActivate {\n canActivate(context: ExecutionContext): boolean {\n const request = context.switchToHttp().getRequest();\n const authHeader = request.headers.authorization;\n\n if (!authHeader?.startsWith('Bearer ')) {\n throw new UnauthorizedException('Missing or invalid authorization header');\n }\n\n // TODO: Validate the token\n return true;\n }\n}\n`;\n }\n\n validationPipe(): string {\n return `import {\n PipeTransform,\n Injectable,\n ArgumentMetadata,\n BadRequestException,\n} from '@nestjs/common';\nimport { ZodSchema, ZodError } from 'zod';\n\n@Injectable()\nexport class ZodValidationPipe implements PipeTransform {\n constructor(private schema: ZodSchema) {}\n\n transform(value: unknown, _metadata: ArgumentMetadata) {\n try {\n return this.schema.parse(value);\n } catch (error) {\n if (error instanceof ZodError) {\n const details: Record<string, string[]> = {};\n for (const issue of error.issues) {\n const path = issue.path.join('.');\n if (!details[path]) details[path] = [];\n details[path].push(issue.message);\n }\n throw new BadRequestException({\n message: 'Validation failed',\n details,\n });\n }\n throw new BadRequestException('Validation failed');\n }\n }\n}\n`;\n }\n}\n","/**\n * Express backend strategy — generates Express.js-specific backend files.\n */\n\nimport type { ProjectConfig } from '../../project-config.js';\nimport type { BackendStrategy } from './backend-strategy.js';\n\nexport class ExpressTemplateStrategy implements BackendStrategy {\n packageJson(config: ProjectConfig): string {\n return `{\n \"name\": \"@${config.name}/api\",\n \"version\": \"0.0.0\",\n \"private\": true,\n \"type\": \"module\",\n \"scripts\": {\n \"build\": \"tsc\",\n \"dev\": \"tsx watch src/main.ts\",\n \"start\": \"node dist/main.js\",\n \"lint\": \"eslint src --ext .ts\",\n \"test\": \"${config.testing === 'vitest' ? 'vitest run' : 'jest'}\"\n },\n \"dependencies\": {\n \"express\": \"${config.versions['express'] ?? '^5.1.0'}\",\n \"cors\": \"${config.versions['cors'] ?? '^2.8.5'}\",\n \"@${config.name}/lib\": \"workspace:*\"${config.hasDatabase ? `,\\n \"@${config.name}/database\": \"workspace:*\"` : ''}\n },\n \"devDependencies\": {\n \"@types/express\": \"${config.versions['@types/express'] ?? '^5.0.2'}\",\n \"@types/cors\": \"${config.versions['@types/cors'] ?? '^2.8.17'}\",\n \"@types/node\": \"${config.versions['@types/node'] ?? '^22.15.3'}\",\n \"tsx\": \"^4.19.4\",\n \"typescript\": \"${config.versions['typescript'] ?? '^5.8.3'}\"\n }\n}\n`;\n }\n\n tsConfig(config: ProjectConfig): string {\n return `{\n \"extends\": \"@${config.name}/config/typescript/base\",\n \"compilerOptions\": {\n \"outDir\": \"./dist\",\n \"rootDir\": \"./src\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"verbatimModuleSyntax\": false\n },\n \"include\": [\"src/**/*\"],\n \"exclude\": [\"node_modules\", \"dist\", \"test\"]\n}\n`;\n }\n\n mainEntry(config: ProjectConfig): string {\n return `import { createApp } from './app.js';\n\nconst port = process.env.PORT ?? 3001;\n\nconst app = createApp();\n\napp.listen(port, () => {\n console.log(\\`🚀 ${config.pascalCase} API running on http://localhost:\\${port}/api\\`);\n});\n`;\n }\n\n appSetup(_config: ProjectConfig): string {\n return `import express from 'express';\nimport cors from 'cors';\nimport { healthRouter } from './routes/health.js';\nimport { errorHandler } from './common/filters/error-handler.js';\nimport { requestLogger } from './common/interceptors/request-logger.js';\n\nexport function createApp() {\n const app = express();\n\n // Middleware\n app.use(cors({\n origin: process.env.CORS_ORIGIN ?? 'http://localhost:3000',\n credentials: true,\n }));\n app.use(express.json());\n app.use(express.urlencoded({ extended: true }));\n app.use(requestLogger);\n\n // Routes\n app.use('/api', healthRouter);\n\n // Error handling (must be last)\n app.use(errorHandler);\n\n return app;\n}\n`;\n }\n\n appController(config: ProjectConfig): string {\n return `import { Router } from 'express';\nimport { AppService } from '../services/app.service.js';\n\nexport const healthRouter = Router();\nconst appService = new AppService('${config.name}');\n\nhealthRouter.get('/health', (_req, res) => {\n res.json(appService.getHealth());\n});\n\nhealthRouter.get('/', (_req, res) => {\n res.json(appService.getInfo());\n});\n`;\n }\n\n appService(_config: ProjectConfig): string {\n return `export class AppService {\n constructor(private readonly appName: string) {}\n\n getHealth() {\n return {\n status: 'ok',\n timestamp: new Date().toISOString(),\n uptime: process.uptime(),\n };\n }\n\n getInfo() {\n return {\n name: this.appName,\n version: '1.0.0',\n environment: process.env.NODE_ENV ?? 'development',\n };\n }\n}\n`;\n }\n\n exceptionFilter(): string {\n return `import type { Request, Response, NextFunction } from 'express';\n\nexport class AppError extends Error {\n constructor(\n public statusCode: number,\n message: string,\n public code?: string,\n ) {\n super(message);\n this.name = 'AppError';\n }\n}\n\nexport function errorHandler(\n err: Error,\n _req: Request,\n res: Response,\n _next: NextFunction,\n) {\n const statusCode = err instanceof AppError ? err.statusCode : 500;\n const code = err instanceof AppError ? err.code : 'INTERNAL_SERVER_ERROR';\n\n res.status(statusCode).json({\n success: false,\n error: {\n code,\n message: err.message || 'Internal server error',\n },\n timestamp: new Date().toISOString(),\n });\n}\n`;\n }\n\n loggingInterceptor(): string {\n return `import type { Request, Response, NextFunction } from 'express';\n\nexport function requestLogger(req: Request, res: Response, next: NextFunction) {\n const startTime = Date.now();\n\n res.on('finish', () => {\n const duration = Date.now() - startTime;\n console.log(\\`\\${req.method} \\${req.originalUrl} \\${res.statusCode} — \\${duration}ms\\`);\n });\n\n next();\n}\n`;\n }\n\n authGuard(): string {\n return `import type { Request, Response, NextFunction } from 'express';\nimport { AppError } from '../filters/error-handler.js';\n\nexport function authGuard(req: Request, _res: Response, next: NextFunction) {\n const authHeader = req.headers.authorization;\n\n if (!authHeader?.startsWith('Bearer ')) {\n return next(new AppError(401, 'Missing or invalid authorization header', 'UNAUTHORIZED'));\n }\n\n // TODO: Validate the token\n next();\n}\n`;\n }\n\n validationPipe(): string {\n return `import type { Request, Response, NextFunction } from 'express';\nimport type { ZodSchema } from 'zod';\nimport { AppError } from '../filters/error-handler.js';\n\n/**\n * Creates Express middleware that validates the request body against a Zod schema.\n */\nexport function validate(schema: ZodSchema) {\n return (req: Request, _res: Response, next: NextFunction) => {\n const result = schema.safeParse(req.body);\n\n if (!result.success) {\n const details: Record<string, string[]> = {};\n for (const issue of result.error.issues) {\n const path = issue.path.join('.');\n if (!details[path]) details[path] = [];\n details[path].push(issue.message);\n }\n return next(new AppError(422, 'Validation failed', 'VALIDATION_ERROR'));\n }\n\n req.body = result.data;\n next();\n };\n}\n`;\n }\n}\n","/**\n * BackendFactory — Creates the appropriate BackendStrategy based on config.\n */\n\nimport type { Backend } from '../../project-config.js';\nimport type { BackendStrategy } from './backend-strategy.js';\nimport { NestjsTemplateStrategy } from './nestjs-templates.js';\nimport { ExpressTemplateStrategy } from './express-templates.js';\n\nexport function createBackendStrategy(backend: Backend): BackendStrategy {\n switch (backend) {\n case 'nestjs':\n return new NestjsTemplateStrategy();\n case 'express':\n return new ExpressTemplateStrategy();\n }\n}\n","/**\n * Prisma ORM strategy — generates Prisma-specific database files.\n */\n\nimport type { ProjectConfig } from '../../project-config.js';\nimport type { ORMStrategy } from './orm-strategy.js';\n\nexport class PrismaTemplateStrategy implements ORMStrategy {\n packageJson(config: ProjectConfig): string {\n return `{\n \"name\": \"@${config.name}/database\",\n \"version\": \"0.0.0\",\n \"private\": true,\n \"type\": \"module\",\n \"main\": \"./src/index.ts\",\n \"types\": \"./src/index.ts\",\n \"exports\": {\n \".\": \"./src/index.ts\",\n \"./client\": \"./src/client.ts\"\n },\n \"scripts\": {\n \"db:generate\": \"prisma generate\",\n \"db:migrate\": \"prisma migrate dev\",\n \"db:push\": \"prisma db push\",\n \"db:seed\": \"tsx src/seed.ts\",\n \"db:studio\": \"prisma studio\"\n },\n \"dependencies\": {\n \"@prisma/client\": \"${config.versions['@prisma/client'] ?? '^6.6.0'}\"\n },\n \"devDependencies\": {\n \"prisma\": \"${config.versions['prisma'] ?? '^6.6.0'}\",\n \"tsx\": \"^4.19.4\",\n \"typescript\": \"${config.versions['typescript'] ?? '^5.8.3'}\"\n }\n}\n`;\n }\n\n tsConfig(config: ProjectConfig): string {\n return `{\n \"extends\": \"@${config.name}/config/typescript/base\",\n \"compilerOptions\": {\n \"outDir\": \"./dist\",\n \"rootDir\": \"./src\",\n \"verbatimModuleSyntax\": false\n },\n \"include\": [\"src/**/*\"]\n}\n`;\n }\n\n index(): string {\n return `export { db } from './client.js';\n`;\n }\n\n schemaFile(config: ProjectConfig): string {\n let datasource = '';\n switch (config.db) {\n case 'postgres':\n datasource = `datasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_URL\")\n}`;\n break;\n case 'mysql':\n datasource = `datasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}`;\n break;\n case 'sqlite':\n datasource = `datasource db {\n provider = \"sqlite\"\n url = env(\"DATABASE_URL\")\n}`;\n break;\n case 'mongodb':\n datasource = `datasource db {\n provider = \"mongodb\"\n url = env(\"DATABASE_URL\")\n}`;\n break;\n }\n\n const idField = config.db === 'mongodb'\n ? `id String @id @default(auto()) @map(\"_id\") @db.ObjectId`\n : `id String @id @default(cuid())`;\n\n return `generator client {\n provider = \"prisma-client-js\"\n}\n\n${datasource}\n\nmodel User {\n ${idField}\n email String @unique\n name String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@map(\"users\")\n}\n`;\n }\n\n clientFile(): string {\n return `import { PrismaClient } from '@prisma/client';\n\nconst globalForPrisma = globalThis as unknown as {\n prisma: PrismaClient | undefined;\n};\n\nexport const db = globalForPrisma.prisma ?? new PrismaClient({\n log: process.env.NODE_ENV === 'development' ? ['query', 'warn', 'error'] : ['error'],\n});\n\nif (process.env.NODE_ENV !== 'production') {\n globalForPrisma.prisma = db;\n}\n`;\n }\n\n seedFile(): string {\n return `import { db } from './client.js';\n\nasync function main() {\n console.log('🌱 Seeding database...');\n\n const user = await db.user.upsert({\n where: { email: 'admin@example.com' },\n update: {},\n create: {\n email: 'admin@example.com',\n name: 'Admin User',\n },\n });\n\n console.log('Created user:', user.email);\n console.log('✅ Seed complete');\n}\n\nmain()\n .catch((error) => {\n console.error('❌ Seed failed:', error);\n process.exit(1);\n })\n .finally(async () => {\n await db.$disconnect();\n });\n`;\n }\n\n envVars(config: ProjectConfig): string {\n switch (config.db) {\n case 'postgres':\n return `DATABASE_URL=\"postgresql://postgres:password@localhost:5432/${config.name}?schema=public\"`;\n case 'mysql':\n return `DATABASE_URL=\"mysql://root:password@localhost:3306/${config.name}\"`;\n case 'sqlite':\n return `DATABASE_URL=\"file:./dev.db\"`;\n case 'mongodb':\n return `DATABASE_URL=\"mongodb://localhost:27017/${config.name}\"`;\n }\n }\n}\n","/**\n * Drizzle ORM strategy — generates Drizzle-specific database files.\n */\n\nimport type { ProjectConfig } from '../../project-config.js';\nimport type { ORMStrategy } from './orm-strategy.js';\n\nexport class DrizzleTemplateStrategy implements ORMStrategy {\n packageJson(config: ProjectConfig): string {\n const dbDriverDeps: Record<string, string> = {};\n\n switch (config.db) {\n case 'postgres':\n dbDriverDeps['pg'] = config.versions['pg'] ?? '^8.14.1';\n break;\n case 'mysql':\n dbDriverDeps['mysql2'] = config.versions['mysql2'] ?? '^3.14.0';\n break;\n case 'sqlite':\n dbDriverDeps['better-sqlite3'] = config.versions['better-sqlite3'] ?? '^11.9.1';\n break;\n }\n\n const driverDepsStr = Object.entries(dbDriverDeps)\n .map(([key, val]) => ` \"${key}\": \"${val}\"`)\n .join(',\\n');\n\n const devDriverDeps = config.db === 'postgres' ? `\\n \"@types/pg\": \"${config.versions['@types/pg'] ?? '^8.11.13'}\",` : '';\n\n return `{\n \"name\": \"@${config.name}/database\",\n \"version\": \"0.0.0\",\n \"private\": true,\n \"type\": \"module\",\n \"main\": \"./src/index.ts\",\n \"types\": \"./src/index.ts\",\n \"exports\": {\n \".\": \"./src/index.ts\",\n \"./client\": \"./src/client.ts\",\n \"./schema\": \"./src/schema/index.ts\"\n },\n \"scripts\": {\n \"db:generate\": \"drizzle-kit generate\",\n \"db:migrate\": \"drizzle-kit migrate\",\n \"db:push\": \"drizzle-kit push\",\n \"db:seed\": \"tsx src/seed.ts\",\n \"db:studio\": \"drizzle-kit studio\"\n },\n \"dependencies\": {\n \"drizzle-orm\": \"${config.versions['drizzle-orm'] ?? '^0.43.1'}\",\n${driverDepsStr}\n },\n \"devDependencies\": {${devDriverDeps}\n \"drizzle-kit\": \"${config.versions['drizzle-kit'] ?? '^0.31.1'}\",\n \"tsx\": \"^4.19.4\",\n \"typescript\": \"${config.versions['typescript'] ?? '^5.8.3'}\"\n }\n}\n`;\n }\n\n tsConfig(config: ProjectConfig): string {\n return `{\n \"extends\": \"@${config.name}/config/typescript/base\",\n \"compilerOptions\": {\n \"outDir\": \"./dist\",\n \"rootDir\": \"./src\",\n \"verbatimModuleSyntax\": false\n },\n \"include\": [\"src/**/*\"]\n}\n`;\n }\n\n index(): string {\n return `export { db } from './client.js';\nexport * from './schema/index.js';\n`;\n }\n\n schemaFile(config: ProjectConfig): string {\n switch (config.db) {\n case 'postgres':\n return `import { pgTable, text, timestamp, varchar } from 'drizzle-orm/pg-core';\n\nexport const users = pgTable('users', {\n id: text('id').primaryKey().$defaultFn(() => crypto.randomUUID()),\n email: varchar('email', { length: 255 }).notNull().unique(),\n name: varchar('name', { length: 255 }),\n createdAt: timestamp('created_at').defaultNow().notNull(),\n updatedAt: timestamp('updated_at').defaultNow().notNull(),\n});\n\nexport type User = typeof users.$inferSelect;\nexport type NewUser = typeof users.$inferInsert;\n`;\n\n case 'mysql':\n return `import { mysqlTable, varchar, timestamp } from 'drizzle-orm/mysql-core';\n\nexport const users = mysqlTable('users', {\n id: varchar('id', { length: 36 }).primaryKey().$defaultFn(() => crypto.randomUUID()),\n email: varchar('email', { length: 255 }).notNull().unique(),\n name: varchar('name', { length: 255 }),\n createdAt: timestamp('created_at').defaultNow().notNull(),\n updatedAt: timestamp('updated_at').defaultNow().notNull(),\n});\n\nexport type User = typeof users.$inferSelect;\nexport type NewUser = typeof users.$inferInsert;\n`;\n\n case 'sqlite':\n return `import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';\n\nexport const users = sqliteTable('users', {\n id: text('id').primaryKey().$defaultFn(() => crypto.randomUUID()),\n email: text('email').notNull().unique(),\n name: text('name'),\n createdAt: integer('created_at', { mode: 'timestamp' }).$defaultFn(() => new Date()),\n updatedAt: integer('updated_at', { mode: 'timestamp' }).$defaultFn(() => new Date()),\n});\n\nexport type User = typeof users.$inferSelect;\nexport type NewUser = typeof users.$inferInsert;\n`;\n\n case 'mongodb':\n // Drizzle doesn't support MongoDB — fall back to Postgres-like schema with a note\n return `// Note: Drizzle ORM does not natively support MongoDB.\n// Consider using Prisma with MongoDB, or use a Postgres/MySQL/SQLite database.\nimport { pgTable, text, timestamp, varchar } from 'drizzle-orm/pg-core';\n\nexport const users = pgTable('users', {\n id: text('id').primaryKey().$defaultFn(() => crypto.randomUUID()),\n email: varchar('email', { length: 255 }).notNull().unique(),\n name: varchar('name', { length: 255 }),\n createdAt: timestamp('created_at').defaultNow().notNull(),\n updatedAt: timestamp('updated_at').defaultNow().notNull(),\n});\n\nexport type User = typeof users.$inferSelect;\nexport type NewUser = typeof users.$inferInsert;\n`;\n }\n }\n\n clientFile(config: ProjectConfig): string {\n switch (config.db) {\n case 'postgres':\n return `import { drizzle } from 'drizzle-orm/node-postgres';\nimport pg from 'pg';\nimport * as schema from './schema/index.js';\n\nconst pool = new pg.Pool({\n connectionString: process.env.DATABASE_URL,\n});\n\nexport const db = drizzle(pool, { schema });\n`;\n\n case 'mysql':\n return `import { drizzle } from 'drizzle-orm/mysql2';\nimport mysql from 'mysql2/promise';\nimport * as schema from './schema/index.js';\n\nconst connection = await mysql.createConnection({\n uri: process.env.DATABASE_URL,\n});\n\nexport const db = drizzle(connection, { schema, mode: 'default' });\n`;\n\n case 'sqlite':\n return `import { drizzle } from 'drizzle-orm/better-sqlite3';\nimport Database from 'better-sqlite3';\nimport * as schema from './schema/index.js';\n\nconst sqlite = new Database(process.env.DATABASE_URL?.replace('file:', '') ?? 'dev.db');\nexport const db = drizzle(sqlite, { schema });\n`;\n\n default:\n return `import { drizzle } from 'drizzle-orm/node-postgres';\nimport pg from 'pg';\nimport * as schema from './schema/index.js';\n\nconst pool = new pg.Pool({\n connectionString: process.env.DATABASE_URL,\n});\n\nexport const db = drizzle(pool, { schema });\n`;\n }\n }\n\n seedFile(): string {\n return `import { db } from './client.js';\nimport { users } from './schema/index.js';\n\nasync function main() {\n console.log('🌱 Seeding database...');\n\n await db.insert(users).values({\n email: 'admin@example.com',\n name: 'Admin User',\n }).onConflictDoNothing();\n\n console.log('✅ Seed complete');\n}\n\nmain().catch((error) => {\n console.error('❌ Seed failed:', error);\n process.exit(1);\n});\n`;\n }\n\n envVars(config: ProjectConfig): string {\n switch (config.db) {\n case 'postgres':\n return `DATABASE_URL=\"postgresql://postgres:password@localhost:5432/${config.name}?schema=public\"`;\n case 'mysql':\n return `DATABASE_URL=\"mysql://root:password@localhost:3306/${config.name}\"`;\n case 'sqlite':\n return `DATABASE_URL=\"file:./dev.db\"`;\n case 'mongodb':\n return `DATABASE_URL=\"mongodb://localhost:27017/${config.name}\"`;\n }\n }\n}\n","/**\n * ORMFactory — Creates the appropriate ORMStrategy based on config.\n */\n\nimport type { ORM } from '../../project-config.js';\nimport type { ORMStrategy } from './orm-strategy.js';\nimport { PrismaTemplateStrategy } from './prisma-templates.js';\nimport { DrizzleTemplateStrategy } from './drizzle-templates.js';\n\nexport function createOrmStrategy(orm: ORM): ORMStrategy | null {\n switch (orm) {\n case 'prisma':\n return new PrismaTemplateStrategy();\n case 'drizzle':\n return new DrizzleTemplateStrategy();\n case 'none':\n return null;\n }\n}\n","/**\n * NextAuth.js strategy — generates NextAuth v5 configuration files.\n */\n\nimport type { ProjectConfig } from '../../project-config.js';\nimport type { AuthStrategy } from './auth-strategy.js';\n\nexport class NextAuthTemplateStrategy implements AuthStrategy {\n apiRoute(): string {\n return `import { handlers } from '@/lib/auth';\n\nexport const { GET, POST } = handlers;\n`;\n }\n\n authConfig(config: ProjectConfig): string {\n let adapterImport = '';\n let adapterConfig = '';\n\n if (config.orm === 'prisma') {\n adapterImport = `import { PrismaAdapter } from '@auth/prisma-adapter';\\nimport { db } from '@${config.name}/database';`;\n adapterConfig = `\\n adapter: PrismaAdapter(db),`;\n } else if (config.orm === 'drizzle') {\n adapterImport = `import { DrizzleAdapter } from '@auth/drizzle-adapter';\\nimport { db } from '@${config.name}/database';`;\n adapterConfig = `\\n adapter: DrizzleAdapter(db),`;\n }\n\n return `import NextAuth from 'next-auth';\nimport type { NextAuthConfig } from 'next-auth';\n${adapterImport}\n\nexport const authConfig: NextAuthConfig = {${adapterConfig}\n providers: [\n // Add your providers here, e.g.:\n // GitHub({ clientId: process.env.AUTH_GITHUB_ID, clientSecret: process.env.AUTH_GITHUB_SECRET }),\n // Google({ clientId: process.env.AUTH_GOOGLE_ID, clientSecret: process.env.AUTH_GOOGLE_SECRET }),\n ],\n session: {\n strategy: '${config.orm !== 'none' ? 'database' : 'jwt'}',\n },\n pages: {\n signIn: '/auth/signin',\n // signOut: '/auth/signout',\n // error: '/auth/error',\n },\n callbacks: {\n authorized({ auth, request: { nextUrl } }) {\n const isLoggedIn = !!auth?.user;\n const isProtected = nextUrl.pathname.startsWith('/dashboard');\n\n if (isProtected && !isLoggedIn) {\n return false;\n }\n\n return true;\n },\n },\n};\n\nexport const { handlers, auth, signIn, signOut } = NextAuth(authConfig);\n`;\n }\n\n middleware(): string {\n return `export { auth as middleware } from '@/lib/auth';\n\nexport const config = {\n matcher: [\n /*\n * Match all request paths except:\n * - _next/static (static files)\n * - _next/image (image optimization)\n * - favicon.ico (browser icon)\n * - public files (public folder)\n * - api/auth (auth endpoints)\n */\n '/((?!_next/static|_next/image|favicon.ico|public|api/auth).*)',\n ],\n};\n`;\n }\n\n types(): string {\n return `import type { DefaultSession } from 'next-auth';\n\ndeclare module 'next-auth' {\n interface Session {\n user: {\n id: string;\n } & DefaultSession['user'];\n }\n}\n`;\n }\n}\n","/**\n * Custom JWT auth strategy — generates custom authentication files.\n */\n\nimport type { AuthStrategy } from './auth-strategy.js';\n\nexport class CustomAuthTemplateStrategy implements AuthStrategy {\n apiRoute(): string {\n return `import { NextResponse } from 'next/server';\nimport type { NextRequest } from 'next/server';\n\nexport async function POST(request: NextRequest) {\n try {\n const body = await request.json();\n const { email, password } = body;\n\n if (!email || !password) {\n return NextResponse.json(\n { success: false, error: { code: 'INVALID_INPUT', message: 'Email and password are required' } },\n { status: 400 },\n );\n }\n\n // TODO: Validate credentials against your database\n // const user = await db.user.findUnique({ where: { email } });\n // if (!user || !await bcrypt.compare(password, user.passwordHash)) { ... }\n\n const apiUrl = process.env.NEXT_PUBLIC_API_URL ?? 'http://localhost:3001';\n const response = await fetch(\\`\\${apiUrl}/api/auth/login\\`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ email, password }),\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n return NextResponse.json(data, { status: response.status });\n }\n\n return NextResponse.json(data);\n } catch {\n return NextResponse.json(\n { success: false, error: { code: 'AUTH_ERROR', message: 'Authentication failed' } },\n { status: 500 },\n );\n }\n}\n`;\n }\n\n authConfig(): string {\n return `/**\n * Custom auth configuration.\n * Handles JWT token creation, validation, and refresh.\n */\n\nconst JWT_SECRET = process.env.JWT_SECRET ?? 'dev-secret-change-in-production';\nconst JWT_EXPIRES_IN = process.env.JWT_EXPIRES_IN ?? '7d';\n\nexport const authConfig = {\n secret: JWT_SECRET,\n expiresIn: JWT_EXPIRES_IN,\n cookieName: 'auth-token',\n secureCookies: process.env.NODE_ENV === 'production',\n} as const;\n\n/** Parse the authorization header to extract the Bearer token */\nexport function extractBearerToken(authHeader: string | null): string | null {\n if (!authHeader?.startsWith('Bearer ')) return null;\n return authHeader.slice(7);\n}\n`;\n }\n\n middleware(): string {\n return `import { NextResponse } from 'next/server';\nimport type { NextRequest } from 'next/server';\n\nconst protectedPaths = ['/dashboard'];\nconst authPaths = ['/auth/signin', '/auth/signup'];\n\nexport function middleware(request: NextRequest) {\n const token = request.cookies.get('auth-token')?.value;\n const { pathname } = request.nextUrl;\n\n const isProtected = protectedPaths.some((path) => pathname.startsWith(path));\n const isAuthPage = authPaths.some((path) => pathname.startsWith(path));\n\n if (isProtected && !token) {\n const signinUrl = new URL('/auth/signin', request.url);\n signinUrl.searchParams.set('callbackUrl', pathname);\n return NextResponse.redirect(signinUrl);\n }\n\n if (isAuthPage && token) {\n return NextResponse.redirect(new URL('/dashboard', request.url));\n }\n\n return NextResponse.next();\n}\n\nexport const config = {\n matcher: [\n '/((?!_next/static|_next/image|favicon.ico|public|api).*)',\n ],\n};\n`;\n }\n\n types(): string {\n return `/** JWT payload structure */\nexport interface JwtPayload {\n sub: string;\n email: string;\n name?: string;\n iat: number;\n exp: number;\n}\n\n/** Authenticated user from token */\nexport interface AuthUser {\n id: string;\n email: string;\n name?: string;\n}\n\n/** Auth session state for the frontend */\nexport interface AuthSession {\n user: AuthUser | null;\n isAuthenticated: boolean;\n isLoading: boolean;\n}\n`;\n }\n}\n","/**\n * AuthFactory — Creates the appropriate AuthStrategy based on config.\n */\n\nimport type { Auth } from '../../project-config.js';\nimport type { AuthStrategy } from './auth-strategy.js';\nimport { NextAuthTemplateStrategy } from './next-auth-templates.js';\nimport { CustomAuthTemplateStrategy } from './custom-auth-templates.js';\n\nexport function createAuthStrategy(auth: Auth): AuthStrategy | null {\n switch (auth) {\n case 'next-auth':\n return new NextAuthTemplateStrategy();\n case 'custom':\n return new CustomAuthTemplateStrategy();\n case 'none':\n return null;\n }\n}\n","/**\n * Zustand state management strategy.\n */\n\nimport type { StateStrategy } from './state-strategy.js';\n\nexport class ZustandTemplateStrategy implements StateStrategy {\n storeSetup(): string {\n return `/**\n * Zustand store utilities.\n * Zustand requires no provider — stores are used directly via hooks.\n */\n\nexport { useThemeStore } from './theme-store.js';\n`;\n }\n\n exampleStore(): string {\n return `import { create } from 'zustand';\nimport { persist } from 'zustand/middleware';\n\ninterface ThemeState {\n theme: 'light' | 'dark' | 'system';\n setTheme: (theme: 'light' | 'dark' | 'system') => void;\n toggleTheme: () => void;\n}\n\nexport const useThemeStore = create<ThemeState>()(\n persist(\n (set, get) => ({\n theme: 'system',\n setTheme: (theme) => set({ theme }),\n toggleTheme: () => {\n const current = get().theme;\n set({ theme: current === 'dark' ? 'light' : 'dark' });\n },\n }),\n { name: 'theme-storage' },\n ),\n);\n`;\n }\n\n /** Zustand needs no provider */\n providerWrapper(): string {\n return '';\n }\n}\n","/**\n * Jotai state management strategy.\n */\n\nimport type { StateStrategy } from './state-strategy.js';\n\nexport class JotaiTemplateStrategy implements StateStrategy {\n storeSetup(): string {\n return `/**\n * Jotai atom exports.\n * Jotai is atomic — no provider needed (uses default store).\n */\n\nexport { themeAtom } from './theme-atom.js';\n`;\n }\n\n exampleStore(): string {\n return `import { atom, useAtom } from 'jotai';\nimport { atomWithStorage } from 'jotai/utils';\n\ntype Theme = 'light' | 'dark' | 'system';\n\n/** Persisted theme atom */\nexport const themeAtom = atomWithStorage<Theme>('theme', 'system');\n\n/** Derived atom that resolves 'system' to actual theme */\nexport const resolvedThemeAtom = atom((get) => {\n const theme = get(themeAtom);\n if (theme !== 'system') return theme;\n\n if (typeof window === 'undefined') return 'light';\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n});\n\n/** Convenience hook for theme management */\nexport function useTheme() {\n const [theme, setTheme] = useAtom(themeAtom);\n return { theme, setTheme };\n}\n`;\n }\n\n /** Jotai works without a provider (uses default store) */\n providerWrapper(): string {\n return '';\n }\n}\n","/**\n * Redux Toolkit state management strategy.\n */\n\nimport type { StateStrategy } from './state-strategy.js';\n\nexport class ReduxTemplateStrategy implements StateStrategy {\n storeSetup(): string {\n return `import { configureStore } from '@reduxjs/toolkit';\nimport { useDispatch, useSelector } from 'react-redux';\nimport type { TypedUseSelectorHook } from 'react-redux';\nimport { themeReducer } from './theme-slice.js';\n\nexport const store = configureStore({\n reducer: {\n theme: themeReducer,\n },\n});\n\nexport type RootState = ReturnType<typeof store.getState>;\nexport type AppDispatch = typeof store.dispatch;\n\n/** Typed dispatch hook */\nexport const useAppDispatch: () => AppDispatch = useDispatch;\n\n/** Typed selector hook */\nexport const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;\n`;\n }\n\n exampleStore(): string {\n return `import { createSlice } from '@reduxjs/toolkit';\nimport type { PayloadAction } from '@reduxjs/toolkit';\n\ntype Theme = 'light' | 'dark' | 'system';\n\ninterface ThemeState {\n theme: Theme;\n}\n\nconst initialState: ThemeState = {\n theme: 'system',\n};\n\nconst themeSlice = createSlice({\n name: 'theme',\n initialState,\n reducers: {\n setTheme(state, action: PayloadAction<Theme>) {\n state.theme = action.payload;\n },\n toggleTheme(state) {\n state.theme = state.theme === 'dark' ? 'light' : 'dark';\n },\n },\n});\n\nexport const { setTheme, toggleTheme } = themeSlice.actions;\nexport const themeReducer = themeSlice.reducer;\n`;\n }\n\n providerWrapper(): string {\n return `'use client';\n\nimport { Provider } from 'react-redux';\nimport { store } from './store';\n\nexport function StoreProvider({ children }: { children: React.ReactNode }) {\n return <Provider store={store}>{children}</Provider>;\n}\n`;\n }\n}\n","/**\n * TanStack Query state management strategy.\n */\n\nimport type { ProjectConfig } from '../../project-config.js';\nimport type { StateStrategy } from './state-strategy.js';\n\nexport class TanstackQueryTemplateStrategy implements StateStrategy {\n storeSetup(): string {\n return `/**\n * TanStack Query setup and utilities.\n */\n\nexport { queryClient } from './query-client.js';\nexport { QueryProvider } from './provider.js';\n`;\n }\n\n exampleStore(_config: ProjectConfig): string {\n return `import { QueryClient } from '@tanstack/react-query';\n\nexport const queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n retry: 1,\n refetchOnWindowFocus: false,\n },\n mutations: {\n retry: 0,\n },\n },\n});\n\n/**\n * Example query hook — fetches health status from the API.\n */\nexport function useHealthQuery() {\n const apiUrl = process.env.NEXT_PUBLIC_API_URL ?? 'http://localhost:3001';\n\n return {\n queryKey: ['health'],\n queryFn: async () => {\n const response = await fetch(\\`\\${apiUrl}/api/health\\`);\n if (!response.ok) throw new Error('API health check failed');\n return response.json();\n },\n };\n}\n`;\n }\n\n providerWrapper(): string {\n return `'use client';\n\nimport { QueryClientProvider } from '@tanstack/react-query';\nimport { queryClient } from './query-client';\n\nexport function QueryProvider({ children }: { children: React.ReactNode }) {\n return (\n <QueryClientProvider client={queryClient}>\n {children}\n </QueryClientProvider>\n );\n}\n`;\n }\n}\n","/**\n * StateFactory — Creates the appropriate StateStrategy based on config.\n */\n\nimport type { StateManagement } from '../../project-config.js';\nimport type { StateStrategy } from './state-strategy.js';\nimport { ZustandTemplateStrategy } from './zustand-templates.js';\nimport { JotaiTemplateStrategy } from './jotai-templates.js';\nimport { ReduxTemplateStrategy } from './redux-templates.js';\nimport { TanstackQueryTemplateStrategy } from './tanstack-query-templates.js';\n\nexport function createStateStrategy(state: StateManagement): StateStrategy | null {\n switch (state) {\n case 'zustand':\n return new ZustandTemplateStrategy();\n case 'jotai':\n return new JotaiTemplateStrategy();\n case 'redux':\n return new ReduxTemplateStrategy();\n case 'tanstack-query':\n return new TanstackQueryTemplateStrategy();\n case 'none':\n return null;\n }\n}\n","/**\n * Doctor — Validates monorepo structure integrity and auto-fixes missing items.\n * Mirrors flutter_monorepo's Doctor class.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport type { ProjectConfig } from './project-config.js';\nimport { detectProjectConfig } from './config-detector.js';\nimport { getExpectedDirectories, getExpectedFiles } from './expected-paths.js';\nimport { logger } from './logger.js';\n\n// Template imports for restorable files\nimport * as root from './templates/root-templates.js';\nimport * as configTmpl from './templates/config-templates.js';\nimport * as lib from './templates/lib-templates.js';\nimport * as ui from './templates/ui-templates.js';\nimport * as licenseTmpl from './templates/license-templates.js';\nimport * as skillsTmpl from './templates/skills-templates.js';\nimport * as githubTmpl from './templates/github-templates.js';\n\nexport class Doctor {\n private rootPath: string;\n\n constructor(rootPath: string) {\n this.rootPath = rootPath;\n }\n\n /** Run the doctor validation */\n async run(fix: boolean): Promise<void> {\n logger.header('Checking monorepo structure...');\n logger.newline();\n\n // 1. Detect config\n const config = detectProjectConfig(this.rootPath);\n if (!config) {\n logger.error('Not a create-next-monorepo project (missing package.json or turbo.json)');\n return;\n }\n\n logger.info(`Detected project: ${config.pascalCase}`);\n logger.info(`Backend: ${config.backend} | Styling: ${config.styling} | ORM: ${config.orm}`);\n logger.info(`Auth: ${config.auth} | State: ${config.state} | PM: ${config.packageManager}`);\n logger.newline();\n\n // 2. Build restorable files map\n const restorableFiles = this.buildRestorableFiles(config);\n\n // 3. Check directories\n const expectedDirs = getExpectedDirectories(config);\n let dirsPassed = 0;\n let dirsMissing = 0;\n\n logger.header('Directories');\n for (const dir of expectedDirs) {\n const fullPath = path.join(this.rootPath, dir);\n if (fs.existsSync(fullPath)) {\n logger.success(dir);\n dirsPassed++;\n } else {\n logger.error(dir);\n dirsMissing++;\n if (fix) {\n fs.mkdirSync(fullPath, { recursive: true });\n logger.dim(' Created directory');\n }\n }\n }\n\n // 4. Check files\n const expectedFiles = getExpectedFiles(config);\n let filesPassed = 0;\n let filesMissing = 0;\n\n logger.newline();\n logger.header('Files');\n for (const file of expectedFiles) {\n const fullPath = path.join(this.rootPath, file);\n if (fs.existsSync(fullPath)) {\n logger.success(file);\n filesPassed++;\n } else {\n logger.error(file);\n filesMissing++;\n if (fix) {\n const dir = path.dirname(fullPath);\n fs.mkdirSync(dir, { recursive: true });\n\n if (restorableFiles[file]) {\n fs.writeFileSync(fullPath, restorableFiles[file], 'utf-8');\n logger.dim(' Restored from template');\n } else {\n fs.writeFileSync(fullPath, `// TODO: Populate this file\\n`, 'utf-8');\n logger.dim(' Created empty (populate manually)');\n }\n }\n }\n }\n\n // 5. Summary\n const totalPassed = dirsPassed + filesPassed;\n const totalMissing = dirsMissing + filesMissing;\n const totalChecks = totalPassed + totalMissing;\n\n logger.newline();\n if (totalMissing === 0) {\n logger.summary([\n `All ${totalChecks} checks passed!`,\n '',\n `${dirsPassed} directories | ${filesPassed} files`,\n ]);\n } else {\n logger.summary([\n `${totalPassed} passed, ${totalMissing} missing (${totalChecks} total)`,\n '',\n `${dirsPassed}/${expectedDirs.length} directories | ${filesPassed}/${expectedFiles.length} files`,\n '',\n fix\n ? 'Missing items have been restored.'\n : 'Run with --fix to auto-restore missing items.',\n ]);\n }\n }\n\n /** Build the restorable files map using templates */\n private buildRestorableFiles(config: ProjectConfig): Record<string, string> {\n const files: Record<string, string> = {\n // Root files\n 'README.md': root.readmeMd(config),\n 'LICENSE': licenseTmpl.licenseText(config),\n 'CONTRIBUTING.md': root.contributingMd(config),\n '.gitignore': root.gitignore(),\n '.prettierrc': root.prettierrc(),\n '.env.example': root.envExample(config),\n 'turbo.json': root.turboJson(config),\n\n // Config package\n 'packages/config/package.json': configTmpl.configPackageJson(config),\n 'packages/config/eslint/base.js': configTmpl.eslintBase(config),\n 'packages/config/typescript/base.json': configTmpl.tsConfigBase(),\n 'packages/config/typescript/nextjs.json': configTmpl.tsConfigNextjs(),\n 'packages/config/typescript/node.json': configTmpl.tsConfigNode(),\n\n // Lib package (framework-agnostic)\n 'packages/lib/src/types/index.ts': lib.libTypes(),\n 'packages/lib/src/utils/index.ts': lib.libUtils(),\n 'packages/lib/src/constants/index.ts': lib.libConstants(),\n 'packages/lib/src/validators/index.ts': lib.libValidators(),\n 'packages/lib/src/index.ts': lib.libIndex(),\n\n // UI hooks (framework-agnostic)\n 'packages/ui/src/hooks/use-media-query.ts': ui.uiUseMediaQuery(),\n 'packages/ui/src/hooks/use-debounce.ts': ui.uiUseDebounce(),\n 'packages/ui/src/hooks/index.ts': ui.uiHooksIndex(),\n 'packages/ui/src/index.ts': ui.uiIndex(),\n 'packages/ui/src/components/index.ts': ui.uiComponentsIndex(),\n };\n\n // Tailwind config\n if (config.usesTailwind) {\n const tailwindContent = configTmpl.tailwindBase(config);\n if (tailwindContent) {\n files['packages/config/tailwind/base.js'] = tailwindContent;\n }\n }\n\n // CSS module stylesheets\n if (config.styling === 'css-modules') {\n files['packages/ui/src/components/button.module.css'] = ui.uiButtonCss();\n files['packages/ui/src/components/card.module.css'] = ui.uiCardCss();\n files['packages/ui/src/components/input.module.css'] = ui.uiInputCss();\n }\n\n // AI Skills (always restorable)\n files['.claude/settings.json'] = skillsTmpl.claudeSettings(config);\n files['.claude/skills/component-design/SKILL.md'] = skillsTmpl.componentDesignSkill(config);\n files['.claude/skills/page-design/SKILL.md'] = skillsTmpl.pageDesignSkill(config);\n files['.claude/skills/api-feature/SKILL.md'] = skillsTmpl.apiFeatureSkill(config);\n files['.claude/skills/monorepo-doctor/SKILL.md'] = skillsTmpl.monrepoDoctorSkill();\n\n // GitHub files (only if .github/ exists)\n if (config.githubFiles) {\n files['CODE_OF_CONDUCT.md'] = githubTmpl.codeOfConduct();\n files['.github/FUNDING.yml'] = githubTmpl.fundingYml();\n files['.github/ISSUE_TEMPLATE/bug_report.md'] = githubTmpl.bugReport();\n files['.github/ISSUE_TEMPLATE/feature_request.md'] = githubTmpl.featureRequest();\n files['.github/pull_request_template.md'] = githubTmpl.pullRequestTemplate();\n files['.github/workflows/ci.yml'] = githubTmpl.ciWorkflow(config);\n }\n\n return files;\n }\n}\n","/**\n * ConfigDetector — Reverse-engineers a ProjectConfig from an existing\n * generated monorepo by reading files on disk.\n * Mirrors flutter_monorepo's config_detector.dart.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { ProjectConfig } from './project-config.js';\nimport type { Backend, Styling, ORM, Database, Auth, StateManagement, PackageManager, LicenseType } from './project-config.js';\n\n/** Attempt to detect project configuration from existing files */\nexport function detectProjectConfig(rootPath: string): ProjectConfig | null {\n const rootPkgPath = path.join(rootPath, 'package.json');\n if (!fs.existsSync(rootPkgPath)) return null;\n\n const rootPkg = readJson(rootPkgPath);\n if (!rootPkg?.name) return null;\n\n // Verify this is a monorepo (has turbo.json or apps/ dir)\n if (!fs.existsSync(path.join(rootPath, 'turbo.json'))) return null;\n\n const name = rootPkg.name as string;\n const backend = detectBackend(rootPath, name);\n const styling = detectStyling(rootPath, name);\n const orm = detectOrm(rootPath, name);\n const db = detectDatabase(rootPath, name, orm);\n const auth = detectAuth(rootPath, name);\n const state = detectState(rootPath, name);\n const packageManager = detectPackageManager(rootPkg);\n const githubFiles = fs.existsSync(path.join(rootPath, '.github'));\n const license = detectLicense(rootPath);\n\n return new ProjectConfig({\n name,\n backend,\n styling,\n orm,\n db,\n auth,\n state,\n packageManager,\n gitInit: false,\n githubFiles,\n license,\n });\n}\n\n/** Detect backend framework from apps/api/package.json dependencies */\nfunction detectBackend(rootPath: string, _name: string): Backend {\n const apiPkg = readJson(path.join(rootPath, 'apps/api/package.json'));\n if (!apiPkg) return 'nestjs';\n\n const deps = {\n ...(apiPkg.dependencies as Record<string, string> | undefined),\n ...(apiPkg.devDependencies as Record<string, string> | undefined),\n };\n\n if (deps['@nestjs/core'] || deps['@nestjs/common']) return 'nestjs';\n if (deps['express']) return 'express';\n\n return 'nestjs';\n}\n\n/** Detect styling approach from apps/web/package.json */\nfunction detectStyling(rootPath: string, _name: string): Styling {\n const webPkg = readJson(path.join(rootPath, 'apps/web/package.json'));\n if (!webPkg) return 'tailwind';\n\n const allDeps = {\n ...(webPkg.dependencies as Record<string, string> | undefined),\n ...(webPkg.devDependencies as Record<string, string> | undefined),\n };\n\n if (allDeps['tailwindcss']) return 'tailwind';\n if (allDeps['styled-components']) return 'styled-components';\n\n // Check for CSS module files\n const componentsDir = path.join(rootPath, 'packages/ui/src/components');\n if (fs.existsSync(componentsDir)) {\n try {\n const files = fs.readdirSync(componentsDir);\n if (files.some((f) => f.endsWith('.module.css'))) return 'css-modules';\n } catch {\n // ignore\n }\n }\n\n return 'tailwind';\n}\n\n/** Detect ORM from packages/database/package.json */\nfunction detectOrm(rootPath: string, _name: string): ORM {\n const dbPkg = readJson(path.join(rootPath, 'packages/database/package.json'));\n if (!dbPkg) return 'none';\n\n const allDeps = {\n ...(dbPkg.dependencies as Record<string, string> | undefined),\n ...(dbPkg.devDependencies as Record<string, string> | undefined),\n };\n\n if (allDeps['@prisma/client'] || allDeps['prisma']) return 'prisma';\n if (allDeps['drizzle-orm'] || allDeps['drizzle-kit']) return 'drizzle';\n\n return 'none';\n}\n\n/** Detect database type from schema or .env.example */\nfunction detectDatabase(rootPath: string, _name: string, orm: ORM): Database {\n if (orm === 'none') return 'postgres';\n\n if (orm === 'prisma') {\n const schemaPath = path.join(rootPath, 'packages/database/prisma/schema.prisma');\n const content = readFile(schemaPath);\n if (content) {\n if (content.includes('provider = \"postgresql\"')) return 'postgres';\n if (content.includes('provider = \"mysql\"')) return 'mysql';\n if (content.includes('provider = \"sqlite\"')) return 'sqlite';\n if (content.includes('provider = \"mongodb\"')) return 'mongodb';\n }\n }\n\n if (orm === 'drizzle') {\n const schemaPath = path.join(rootPath, 'packages/database/src/schema/index.ts');\n const content = readFile(schemaPath);\n if (content) {\n if (content.includes('drizzle-orm/pg-core')) return 'postgres';\n if (content.includes('drizzle-orm/mysql-core')) return 'mysql';\n if (content.includes('drizzle-orm/sqlite-core')) return 'sqlite';\n }\n }\n\n // Fall back to .env.example\n const envContent = readFile(path.join(rootPath, '.env.example'));\n if (envContent) {\n if (envContent.includes('postgresql://')) return 'postgres';\n if (envContent.includes('mysql://')) return 'mysql';\n if (envContent.includes('file:./')) return 'sqlite';\n if (envContent.includes('mongodb://')) return 'mongodb';\n }\n\n return 'postgres';\n}\n\n/** Detect auth from apps/web/package.json and file existence */\nfunction detectAuth(rootPath: string, _name: string): Auth {\n const webPkg = readJson(path.join(rootPath, 'apps/web/package.json'));\n if (webPkg) {\n const deps = webPkg.dependencies as Record<string, string> | undefined;\n if (deps?.['next-auth']) return 'next-auth';\n }\n\n // Check for custom auth files\n if (fs.existsSync(path.join(rootPath, 'apps/web/lib/auth.ts'))) {\n return 'custom';\n }\n\n return 'none';\n}\n\n/** Detect state management from apps/web/package.json */\nfunction detectState(rootPath: string, _name: string): StateManagement {\n const webPkg = readJson(path.join(rootPath, 'apps/web/package.json'));\n if (!webPkg) return 'none';\n\n const deps = webPkg.dependencies as Record<string, string> | undefined;\n if (!deps) return 'none';\n\n if (deps['zustand']) return 'zustand';\n if (deps['jotai']) return 'jotai';\n if (deps['@reduxjs/toolkit']) return 'redux';\n if (deps['@tanstack/react-query']) return 'tanstack-query';\n\n return 'none';\n}\n\n/** Detect package manager from root package.json packageManager field */\nfunction detectPackageManager(rootPkg: Record<string, unknown>): PackageManager {\n const pm = rootPkg.packageManager as string | undefined;\n if (!pm) return 'pnpm';\n\n if (pm.startsWith('pnpm')) return 'pnpm';\n if (pm.startsWith('yarn')) return 'yarn';\n if (pm.startsWith('bun')) return 'bun';\n if (pm.startsWith('npm')) return 'npm';\n\n return 'pnpm';\n}\n\n/** Detect license type from LICENSE file content */\nfunction detectLicense(rootPath: string): LicenseType {\n const content = readFile(path.join(rootPath, 'LICENSE'));\n if (!content) return 'MIT';\n\n if (content.includes('MIT License')) return 'MIT';\n if (content.includes('Apache License')) return 'Apache-2.0';\n if (content.includes('BSD 2-Clause')) return 'BSD-2-Clause';\n if (content.includes('BSD 3-Clause')) return 'BSD-3-Clause';\n if (content.includes('GNU General Public License') && content.includes('version 3')) return 'GPL-3.0';\n if (content.includes('GNU General Public License') && content.includes('version 2')) return 'GPL-2.0';\n if (content.includes('GNU Lesser General Public')) return 'LGPL-2.1';\n if (content.includes('Mozilla Public License')) return 'MPL-2.0';\n if (content.includes('ISC License')) return 'ISC';\n if (content.includes('public domain') || content.includes('Unlicense')) return 'Unlicense';\n if (content.includes('proprietary') || content.includes('All rights reserved')) return 'proprietary';\n\n return 'MIT';\n}\n\n// ── Helpers ───────────────────────────────────────────────────────\n\nfunction readJson(filePath: string): Record<string, unknown> | null {\n try {\n const content = fs.readFileSync(filePath, 'utf-8');\n return JSON.parse(content) as Record<string, unknown>;\n } catch {\n return null;\n }\n}\n\nfunction readFile(filePath: string): string | null {\n try {\n return fs.readFileSync(filePath, 'utf-8');\n } catch {\n return null;\n }\n}\n","/**\n * Workflow — Step-by-step development guides for building features.\n * Three flows: A (Component), B (Page/Route), C (API Feature).\n * Adapts output based on detected project configuration.\n * Mirrors flutter_monorepo's Workflow class.\n */\n\nimport type { ProjectConfig } from './project-config.js';\nimport {\n backendDisplayName,\n stylingDisplayName,\n ormDisplayName,\n} from './project-config.js';\nimport { detectProjectConfig } from './config-detector.js';\nimport { logger } from './logger.js';\nimport chalk from 'chalk';\n\nexport class Workflow {\n constructor(private rootPath: string) {}\n\n /** Run the specified workflow (or show overview) */\n run(flow?: string): void {\n const config = detectProjectConfig(this.rootPath);\n\n if (!flow) {\n this.printOverview(config);\n return;\n }\n\n switch (flow.toLowerCase()) {\n case 'a':\n this.printComponentFlow(config);\n break;\n case 'b':\n this.printPageFlow(config);\n break;\n case 'c':\n this.printApiFlow(config);\n break;\n default:\n logger.error(`Unknown workflow \"${flow}\". Use: a, b, or c`);\n logger.log(' a — Component Design');\n logger.log(' b — Page/Route Design');\n logger.log(' c — API Feature Design');\n }\n }\n\n // ── Overview ─────────────────────────────────────────────────────\n\n private printOverview(config: ProjectConfig | null): void {\n logger.header('Development Workflows');\n logger.newline();\n\n if (config) {\n logger.info(`Project: ${config.pascalCase}`);\n logger.info(`Backend: ${backendDisplayName[config.backend]} | Styling: ${stylingDisplayName[config.styling]} | ORM: ${ormDisplayName[config.orm]}`);\n logger.newline();\n }\n\n console.log(chalk.bold(' Workflow A — Component Design'));\n console.log(' Build a reusable UI component in packages/ui/');\n console.log(chalk.dim(' Run: create-next-monorepo workflow a'));\n logger.newline();\n\n console.log(chalk.bold(' Workflow B — Page/Route Design'));\n console.log(' Build a Next.js page with state and API integration');\n console.log(chalk.dim(' Run: create-next-monorepo workflow b'));\n logger.newline();\n\n console.log(chalk.bold(' Workflow C — API Feature Design'));\n console.log(' Build a backend endpoint with validation and DB access');\n console.log(chalk.dim(' Run: create-next-monorepo workflow c'));\n logger.newline();\n\n if (config) {\n logger.header('Quick Reference');\n logger.newline();\n\n console.log(` ${chalk.cyan('Frontend app')} apps/web/`);\n console.log(` ${chalk.cyan('Backend app')} apps/api/`);\n console.log(` ${chalk.cyan('UI components')} packages/ui/src/components/`);\n console.log(` ${chalk.cyan('Shared types')} packages/lib/src/types/`);\n console.log(` ${chalk.cyan('Shared utils')} packages/lib/src/utils/`);\n console.log(` ${chalk.cyan('Validators')} packages/lib/src/validators/`);\n\n if (config.hasState) {\n const stateDir = config.state === 'tanstack-query' ? 'apps/web/lib/query/' : 'apps/web/lib/store/';\n console.log(` ${chalk.cyan('State mgmt')} ${stateDir}`);\n }\n if (config.hasDatabase) {\n console.log(` ${chalk.cyan('Database')} packages/database/`);\n }\n\n logger.newline();\n }\n }\n\n // ── Workflow A: Component Design ─────────────────────────────────\n\n private printComponentFlow(config: ProjectConfig | null): void {\n const styling = config?.styling ?? 'tailwind';\n\n logger.header('Workflow A — Component Design');\n logger.newline();\n console.log(chalk.dim(' Build a reusable UI component in the shared packages/ui/ package.'));\n logger.newline();\n\n // Step 1\n console.log(chalk.bold.cyan(' Step 1: Define the Component Interface'));\n console.log(' Start by defining the props interface and variants.');\n console.log();\n console.log(chalk.dim(' File: packages/ui/src/components/<name>.tsx'));\n console.log();\n console.log(chalk.gray(` export interface MyComponentProps {\n variant?: 'primary' | 'secondary';\n size?: 'sm' | 'md' | 'lg';\n children: React.ReactNode;\n }`));\n logger.newline();\n\n // Step 2\n console.log(chalk.bold.cyan(' Step 2: Implement the Component'));\n\n if (styling === 'tailwind') {\n console.log(' Use Tailwind utility classes for styling.');\n console.log();\n console.log(chalk.gray(` export function MyComponent({ variant = 'primary', size = 'md', children }: MyComponentProps) {\n return (\n <div className={\\`rounded-lg \\${variantStyles[variant]} \\${sizeStyles[size]}\\`}>\n {children}\n </div>\n );\n }`));\n } else if (styling === 'css-modules') {\n console.log(' Create a CSS Module alongside the component.');\n console.log();\n console.log(chalk.dim(' Files:'));\n console.log(chalk.dim(' packages/ui/src/components/<name>.tsx'));\n console.log(chalk.dim(' packages/ui/src/components/<name>.module.css'));\n console.log();\n console.log(chalk.gray(` import styles from './<name>.module.css';\n\n export function MyComponent({ variant, children }: MyComponentProps) {\n return <div className={\\`\\${styles.root} \\${styles[variant]}\\`}>{children}</div>;\n }`));\n } else {\n console.log(' Use styled-components for styling.');\n console.log();\n console.log(chalk.gray(` import styled from 'styled-components';\n\n const StyledWrapper = styled.div<{ $variant: string }>\\`\n border-radius: 8px;\n /* variant-specific styles */\n \\`;\n\n export function MyComponent({ variant, children }: MyComponentProps) {\n return <StyledWrapper $variant={variant}>{children}</StyledWrapper>;\n }`));\n }\n logger.newline();\n\n // Step 3\n console.log(chalk.bold.cyan(' Step 3: Export from Barrel'));\n console.log(' Add the export to the components barrel file.');\n console.log();\n console.log(chalk.dim(' File: packages/ui/src/components/index.ts'));\n console.log();\n console.log(chalk.gray(` export { MyComponent } from './my-component.js';\n export type { MyComponentProps } from './my-component.js';`));\n logger.newline();\n\n // Step 4\n console.log(chalk.bold.cyan(' Step 4: Write Tests'));\n console.log(' Create a test file for your component.');\n console.log();\n console.log(chalk.dim(' File: packages/ui/src/components/__tests__/my-component.test.tsx'));\n logger.newline();\n\n // Step 5\n console.log(chalk.bold.cyan(' Step 5: Use in App'));\n console.log(' Import from the UI package in your Next.js app.');\n console.log();\n const pkgName = config?.name ?? 'my-app';\n console.log(chalk.gray(` import { MyComponent } from '@${pkgName}/ui';`));\n logger.newline();\n\n // Checklist\n console.log(chalk.bold(' Checklist'));\n console.log(' [ ] Props interface defined with clear types');\n console.log(' [ ] Component handles all variant/size combinations');\n console.log(' [ ] Exported from barrel file');\n console.log(' [ ] Works in both light and dark modes');\n console.log(' [ ] Tests written and passing');\n logger.newline();\n }\n\n // ── Workflow B: Page/Route Design ────────────────────────────────\n\n private printPageFlow(config: ProjectConfig | null): void {\n const state = config?.state ?? 'none';\n\n logger.header('Workflow B — Page/Route Design');\n logger.newline();\n console.log(chalk.dim(' Build a Next.js page with state management and API integration.'));\n logger.newline();\n\n // Step 1\n console.log(chalk.bold.cyan(' Step 1: Create the Page'));\n console.log(' Create a new page in the App Router.');\n console.log();\n console.log(chalk.dim(' File: apps/web/app/<route>/page.tsx'));\n console.log();\n console.log(chalk.gray(` export default function MyPage() {\n return (\n <main>\n <h1>My Page</h1>\n </main>\n );\n }`));\n logger.newline();\n\n // Step 2\n console.log(chalk.bold.cyan(' Step 2: Add Loading and Error States'));\n console.log(' Create loading.tsx and error.tsx in the same route directory.');\n console.log();\n console.log(chalk.dim(' Files:'));\n console.log(chalk.dim(' apps/web/app/<route>/loading.tsx'));\n console.log(chalk.dim(' apps/web/app/<route>/error.tsx'));\n logger.newline();\n\n // Step 3 — State management (adapts to detected framework)\n console.log(chalk.bold.cyan(' Step 3: Wire State Management'));\n\n if (state === 'zustand') {\n console.log(' Create a Zustand store for this page\\'s state.');\n console.log();\n console.log(chalk.dim(' File: apps/web/lib/store/<feature>-store.ts'));\n console.log();\n console.log(chalk.gray(` import { create } from 'zustand';\n\n interface FeatureState {\n items: Item[];\n isLoading: boolean;\n fetchItems: () => Promise<void>;\n }\n\n export const useFeatureStore = create<FeatureState>()((set) => ({\n items: [],\n isLoading: false,\n fetchItems: async () => {\n set({ isLoading: true });\n const res = await fetch('/api/items');\n const data = await res.json();\n set({ items: data, isLoading: false });\n },\n }));`));\n } else if (state === 'jotai') {\n console.log(' Create Jotai atoms for this page\\'s state.');\n console.log();\n console.log(chalk.dim(' File: apps/web/lib/store/<feature>-atom.ts'));\n console.log();\n console.log(chalk.gray(` import { atom } from 'jotai';\n import { atomWithQuery } from 'jotai-tanstack-query';\n\n export const itemsAtom = atom<Item[]>([]);\n export const isLoadingAtom = atom(false);`));\n } else if (state === 'redux') {\n console.log(' Create a Redux Toolkit slice for this feature.');\n console.log();\n console.log(chalk.dim(' File: apps/web/lib/store/<feature>-slice.ts'));\n console.log();\n console.log(chalk.gray(` import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';\n\n export const fetchItems = createAsyncThunk('feature/fetchItems', async () => {\n const res = await fetch('/api/items');\n return res.json();\n });\n\n const featureSlice = createSlice({ name: 'feature', initialState: { items: [] }, ... });`));\n console.log();\n console.log(chalk.dim(' Don\\'t forget to add the reducer to apps/web/lib/store/store.ts'));\n } else if (state === 'tanstack-query') {\n console.log(' Create query hooks for data fetching.');\n console.log();\n console.log(chalk.dim(' File: apps/web/hooks/use-<feature>.ts'));\n console.log();\n console.log(chalk.gray(` import { useQuery, useMutation } from '@tanstack/react-query';\n\n export function useItems() {\n return useQuery({\n queryKey: ['items'],\n queryFn: () => fetch('/api/items').then(r => r.json()),\n });\n }`));\n } else {\n console.log(' No state management configured. Use React state or fetch directly.');\n console.log();\n console.log(chalk.gray(` // Use React Server Components for data fetching:\n export default async function MyPage() {\n const res = await fetch('http://localhost:3001/api/items');\n const items = await res.json();\n return <ItemList items={items} />;\n }`));\n }\n logger.newline();\n\n // Step 4\n console.log(chalk.bold.cyan(' Step 4: Connect to API'));\n console.log(' Fetch data from your backend API endpoint.');\n console.log();\n console.log(chalk.dim(' Use NEXT_PUBLIC_API_URL from .env for the API base URL.'));\n logger.newline();\n\n // Step 5\n console.log(chalk.bold.cyan(' Step 5: Write Tests'));\n console.log(' Test the page component and any hooks/stores.');\n console.log();\n console.log(chalk.dim(' File: apps/web/app/<route>/__tests__/page.test.tsx'));\n logger.newline();\n\n // Checklist\n console.log(chalk.bold(' Checklist'));\n console.log(' [ ] Page component created in app/<route>/page.tsx');\n console.log(' [ ] Loading and error states handled');\n console.log(' [ ] State management wired (if applicable)');\n console.log(' [ ] API integration working');\n console.log(' [ ] Responsive design verified');\n console.log(' [ ] Tests written and passing');\n logger.newline();\n }\n\n // ── Workflow C: API Feature Design ───────────────────────────────\n\n private printApiFlow(config: ProjectConfig | null): void {\n const backend = config?.backend ?? 'nestjs';\n const orm = config?.orm ?? 'none';\n\n logger.header('Workflow C — API Feature Design');\n logger.newline();\n console.log(chalk.dim(' Build a backend API endpoint with validation, database access, and error handling.'));\n logger.newline();\n\n // Step 1\n console.log(chalk.bold.cyan(' Step 1: Define Types and Validators'));\n console.log(' Add shared types and Zod validators to the lib package.');\n console.log();\n console.log(chalk.dim(' Files:'));\n console.log(chalk.dim(' packages/lib/src/types/<feature>.ts'));\n console.log(chalk.dim(' packages/lib/src/validators/<feature>.ts'));\n console.log();\n console.log(chalk.gray(` // packages/lib/src/validators/item.ts\n import { z } from 'zod';\n\n export const createItemSchema = z.object({\n name: z.string().min(1).max(100),\n description: z.string().optional(),\n });\n\n export type CreateItemInput = z.infer<typeof createItemSchema>;`));\n logger.newline();\n\n // Step 2 — Database schema (adapts to ORM)\n console.log(chalk.bold.cyan(' Step 2: Define Database Schema'));\n\n if (orm === 'prisma') {\n console.log(' Add a model to the Prisma schema.');\n console.log();\n console.log(chalk.dim(' File: packages/database/prisma/schema.prisma'));\n console.log();\n console.log(chalk.gray(` model Item {\n id String @id @default(cuid())\n name String\n description String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@map(\"items\")\n }`));\n console.log();\n console.log(chalk.dim(' Then run: cd packages/database && npx prisma migrate dev'));\n } else if (orm === 'drizzle') {\n console.log(' Add a table definition to the Drizzle schema.');\n console.log();\n console.log(chalk.dim(' File: packages/database/src/schema/items.ts'));\n console.log();\n console.log(chalk.gray(` import { pgTable, text, timestamp, varchar } from 'drizzle-orm/pg-core';\n\n export const items = pgTable('items', {\n id: text('id').primaryKey().$defaultFn(() => crypto.randomUUID()),\n name: varchar('name', { length: 100 }).notNull(),\n description: text('description'),\n createdAt: timestamp('created_at').defaultNow().notNull(),\n updatedAt: timestamp('updated_at').defaultNow().notNull(),\n });`));\n console.log();\n console.log(chalk.dim(' Then run: cd packages/database && npx drizzle-kit push'));\n } else {\n console.log(' No ORM configured. Use raw queries or add an ORM.');\n }\n logger.newline();\n\n // Step 3 — Backend endpoint (adapts to backend framework)\n console.log(chalk.bold.cyan(' Step 3: Build the API Endpoint'));\n\n if (backend === 'nestjs') {\n console.log(' Create a NestJS module with controller and service.');\n console.log();\n console.log(chalk.dim(' Files:'));\n console.log(chalk.dim(' apps/api/src/items/items.module.ts'));\n console.log(chalk.dim(' apps/api/src/items/items.controller.ts'));\n console.log(chalk.dim(' apps/api/src/items/items.service.ts'));\n console.log(chalk.dim(' apps/api/src/items/dto/create-item.dto.ts'));\n console.log();\n console.log(chalk.gray(` // items.controller.ts\n @Controller('items')\n export class ItemsController {\n constructor(private readonly itemsService: ItemsService) {}\n\n @Get()\n findAll() { return this.itemsService.findAll(); }\n\n @Post()\n create(@Body() dto: CreateItemDto) { return this.itemsService.create(dto); }\n }`));\n console.log();\n console.log(chalk.dim(' Register in apps/api/src/app.module.ts imports array.'));\n } else {\n console.log(' Create Express route and service files.');\n console.log();\n console.log(chalk.dim(' Files:'));\n console.log(chalk.dim(' apps/api/src/routes/items.ts'));\n console.log(chalk.dim(' apps/api/src/services/items.service.ts'));\n console.log();\n console.log(chalk.gray(` // routes/items.ts\n import { Router } from 'express';\n import { ItemsService } from '../services/items.service.js';\n import { validate } from '../common/pipes/validate.js';\n import { createItemSchema } from '@my-app/lib/validators';\n\n export const itemsRouter = Router();\n const service = new ItemsService();\n\n itemsRouter.get('/items', async (_req, res) => {\n res.json(await service.findAll());\n });\n\n itemsRouter.post('/items', validate(createItemSchema), async (req, res) => {\n res.status(201).json(await service.create(req.body));\n });`));\n console.log();\n console.log(chalk.dim(' Register in apps/api/src/app.ts with app.use(\\'/api\\', itemsRouter)'));\n }\n logger.newline();\n\n // Step 4\n console.log(chalk.bold.cyan(' Step 4: Add Validation and Error Handling'));\n console.log(' Use Zod validators from packages/lib/ for request validation.');\n if (backend === 'nestjs') {\n console.log(' Use the ZodValidationPipe in apps/api/src/common/pipes/.');\n } else {\n console.log(' Use the validate() middleware in apps/api/src/common/pipes/.');\n }\n logger.newline();\n\n // Step 5\n console.log(chalk.bold.cyan(' Step 5: Connect from Frontend'));\n const pkgName = config?.name ?? 'my-app';\n console.log(' Call the API from your Next.js page.');\n console.log();\n console.log(chalk.gray(` import type { CreateItemInput } from '@${pkgName}/lib/validators';\n\n const apiUrl = process.env.NEXT_PUBLIC_API_URL;\n\n async function createItem(data: CreateItemInput) {\n const res = await fetch(\\`\\${apiUrl}/api/items\\`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(data),\n });\n return res.json();\n }`));\n logger.newline();\n\n // Step 6\n console.log(chalk.bold.cyan(' Step 6: Write Tests'));\n if (backend === 'nestjs') {\n console.log(chalk.dim(' File: apps/api/test/items.e2e-spec.ts'));\n } else {\n console.log(chalk.dim(' File: apps/api/test/items.test.ts'));\n }\n logger.newline();\n\n // Checklist\n console.log(chalk.bold(' Checklist'));\n console.log(' [ ] Types defined in packages/lib/src/types/');\n console.log(' [ ] Zod validators defined in packages/lib/src/validators/');\n if (orm !== 'none') {\n console.log(' [ ] Database schema defined and migrated');\n }\n console.log(' [ ] API endpoint created and tested');\n console.log(' [ ] Request validation in place');\n console.log(' [ ] Error handling for edge cases');\n console.log(' [ ] Frontend integration working');\n console.log(' [ ] Tests written and passing');\n logger.newline();\n }\n}\n"],"mappings":";AAQO,IAAM,UAAU,EAAE,QAAQ,UAAU,SAAS,UAAU;AAGvD,IAAM,UAAU;AAAA,EACrB,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,kBAAkB;AACpB;AAGO,IAAM,MAAM,EAAE,QAAQ,UAAU,SAAS,WAAW,MAAM,OAAO;AAGjE,IAAM,WAAW;AAAA,EACtB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AACX;AAGO,IAAM,OAAO;AAAA,EAClB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,MAAM;AACR;AAGO,IAAM,kBAAkB;AAAA,EAC7B,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,eAAe;AAAA,EACf,MAAM;AACR;AAGO,IAAM,gBAAgB,EAAE,QAAQ,UAAU,MAAM,OAAO;AAGvD,IAAM,iBAAiB;AAAA,EAC5B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AACP;AAGO,IAAM,cAAc;AAAA,EACzB,KAAK;AAAA,EACL,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,KAAK;AAAA,EACL,WAAW;AAAA,EACX,aAAa;AACf;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