spoonfeeder 0.1.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.
- package/LICENSE +21 -0
- package/README.md +249 -0
- package/dist/generator/ai-context-assembler.d.ts +4 -0
- package/dist/generator/ai-context-assembler.js +52 -0
- package/dist/generator/ai-context-assembler.js.map +1 -0
- package/dist/generator/env-merger.d.ts +3 -0
- package/dist/generator/env-merger.js +16 -0
- package/dist/generator/env-merger.js.map +1 -0
- package/dist/generator/generator.d.ts +3 -0
- package/dist/generator/generator.js +253 -0
- package/dist/generator/generator.js.map +1 -0
- package/dist/generator/package-json-merger.d.ts +6 -0
- package/dist/generator/package-json-merger.js +29 -0
- package/dist/generator/package-json-merger.js.map +1 -0
- package/dist/generator/post-generate.d.ts +1 -0
- package/dist/generator/post-generate.js +28 -0
- package/dist/generator/post-generate.js.map +1 -0
- package/dist/generator/template-engine.d.ts +4 -0
- package/dist/generator/template-engine.js +20 -0
- package/dist/generator/template-engine.js.map +1 -0
- package/dist/generators/add-recipe/generator.d.ts +3 -0
- package/dist/generators/add-recipe/generator.js +153 -0
- package/dist/generators/add-recipe/generator.js.map +1 -0
- package/dist/generators/list-recipes/generator.d.ts +3 -0
- package/dist/generators/list-recipes/generator.js +58 -0
- package/dist/generators/list-recipes/generator.js.map +1 -0
- package/dist/generators/migrate-recipe/generator.d.ts +9 -0
- package/dist/generators/migrate-recipe/generator.js +90 -0
- package/dist/generators/migrate-recipe/generator.js.map +1 -0
- package/dist/generators/migrate-recipe/migration-guidance.d.ts +1 -0
- package/dist/generators/migrate-recipe/migration-guidance.js +159 -0
- package/dist/generators/migrate-recipe/migration-guidance.js.map +1 -0
- package/dist/generators/remove-recipe/generator.d.ts +3 -0
- package/dist/generators/remove-recipe/generator.js +176 -0
- package/dist/generators/remove-recipe/generator.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/add-ons.d.ts +3 -0
- package/dist/prompts/add-ons.js +29 -0
- package/dist/prompts/add-ons.js.map +1 -0
- package/dist/prompts/ci-cd.d.ts +2 -0
- package/dist/prompts/ci-cd.js +19 -0
- package/dist/prompts/ci-cd.js.map +1 -0
- package/dist/prompts/cloud-provider.d.ts +2 -0
- package/dist/prompts/cloud-provider.js +18 -0
- package/dist/prompts/cloud-provider.js.map +1 -0
- package/dist/prompts/confirmation.d.ts +2 -0
- package/dist/prompts/confirmation.js +29 -0
- package/dist/prompts/confirmation.js.map +1 -0
- package/dist/prompts/deployment.d.ts +2 -0
- package/dist/prompts/deployment.js +20 -0
- package/dist/prompts/deployment.js.map +1 -0
- package/dist/prompts/frontend.d.ts +2 -0
- package/dist/prompts/frontend.js +18 -0
- package/dist/prompts/frontend.js.map +1 -0
- package/dist/prompts/project-name.d.ts +5 -0
- package/dist/prompts/project-name.js +34 -0
- package/dist/prompts/project-name.js.map +1 -0
- package/dist/prompts/project-type.d.ts +2 -0
- package/dist/prompts/project-type.js +22 -0
- package/dist/prompts/project-type.js.map +1 -0
- package/dist/prompts/run-all.d.ts +3 -0
- package/dist/prompts/run-all.js +83 -0
- package/dist/prompts/run-all.js.map +1 -0
- package/dist/prompts/transport.d.ts +2 -0
- package/dist/prompts/transport.js +22 -0
- package/dist/prompts/transport.js.map +1 -0
- package/dist/recipes/definitions.d.ts +2 -0
- package/dist/recipes/definitions.js +3647 -0
- package/dist/recipes/definitions.js.map +1 -0
- package/dist/recipes/recipe.interface.d.ts +8 -0
- package/dist/recipes/recipe.interface.js +2 -0
- package/dist/recipes/recipe.interface.js.map +1 -0
- package/dist/recipes/registry.d.ts +9 -0
- package/dist/recipes/registry.js +23 -0
- package/dist/recipes/registry.js.map +1 -0
- package/dist/types.d.ts +70 -0
- package/dist/types.js +152 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/ai-context-updater.d.ts +6 -0
- package/dist/utils/ai-context-updater.js +50 -0
- package/dist/utils/ai-context-updater.js.map +1 -0
- package/dist/utils/dependency-checker.d.ts +14 -0
- package/dist/utils/dependency-checker.js +27 -0
- package/dist/utils/dependency-checker.js.map +1 -0
- package/dist/utils/env-updater.d.ts +7 -0
- package/dist/utils/env-updater.js +35 -0
- package/dist/utils/env-updater.js.map +1 -0
- package/dist/utils/main-ts-updater.d.ts +37 -0
- package/dist/utils/main-ts-updater.js +144 -0
- package/dist/utils/main-ts-updater.js.map +1 -0
- package/dist/utils/module-updater.d.ts +26 -0
- package/dist/utils/module-updater.js +167 -0
- package/dist/utils/module-updater.js.map +1 -0
- package/dist/utils/recipe-manifest.d.ts +24 -0
- package/dist/utils/recipe-manifest.js +45 -0
- package/dist/utils/recipe-manifest.js.map +1 -0
- package/dist/validation/config-validator.d.ts +13 -0
- package/dist/validation/config-validator.js +50 -0
- package/dist/validation/config-validator.js.map +1 -0
- package/dist/validation/conflict-detector.d.ts +7 -0
- package/dist/validation/conflict-detector.js +37 -0
- package/dist/validation/conflict-detector.js.map +1 -0
- package/generators.json +24 -0
- package/package.json +78 -0
- package/src/generators/add-recipe/schema.json +21 -0
- package/src/generators/list-recipes/schema.json +18 -0
- package/src/generators/migrate-recipe/schema.json +20 -0
- package/src/generators/remove-recipe/schema.json +21 -0
- package/templates/base/.env.example.ejs +3 -0
- package/templates/base/README.md.ejs +20 -0
- package/templates/base/SECURITY.md +36 -0
- package/templates/base/commitlint.config.js +15 -0
- package/templates/base/docs/adr/000-template.md +45 -0
- package/templates/base/docs/adr/001-framework-selection.md +54 -0
- package/templates/base/docs/adr/002-error-handling-strategy.md +36 -0
- package/templates/base/docs/adr/003-database-strategy.md +40 -0
- package/templates/base/docs/adr/004-authentication-architecture.md +44 -0
- package/templates/base/docs/adr/005-deployment-strategy.md +40 -0
- package/templates/base/docs/adr/006-testing-strategy.md +41 -0
- package/templates/base/docs/adr/007-scaffolder-architecture.md +64 -0
- package/templates/base/docs/adr/008-recipe-system.md +47 -0
- package/templates/base/docs/adr/009-standards-compliance.md +54 -0
- package/templates/base/docs/adr/010-ai-context-generation.md +44 -0
- package/templates/base/docs/adr/011-package-versioning.md +44 -0
- package/templates/base/docs/adr/012-monorepo-strategy.md +54 -0
- package/templates/base/docs/adr/013-http-adapter.md +63 -0
- package/templates/base/docs/adr/014-build-toolchain.md +61 -0
- package/templates/base/docs/adr/015-cloud-provider-strategy.md +49 -0
- package/templates/base/docs/adr/016-ci-cd-pipeline-strategy.md +52 -0
- package/templates/base/docs/adr/017-logging-strategy.md +63 -0
- package/templates/base/docs/adr/018-security-architecture.md +61 -0
- package/templates/base/docs/adr/019-project-type-design.md +61 -0
- package/templates/base/docs/adr/020-frontend-framework-support.md +57 -0
- package/templates/base/docs/adr/021-observability-strategy.md +68 -0
- package/templates/base/docs/adr/022-api-design-patterns.md +64 -0
- package/templates/base/docs/adr/023-error-hierarchy.md +54 -0
- package/templates/base/docs/adr/024-request-context-pattern.md +57 -0
- package/templates/base/docs/adr/025-data-patterns.md +58 -0
- package/templates/base/docs/adr/026-migration-strategy.md +57 -0
- package/templates/base/docs/adr/027-dependency-management.md +60 -0
- package/templates/base/docs/adr/028-code-quality-toolchain.md +60 -0
- package/templates/base/docs/adr/029-admin-panel.md +53 -0
- package/templates/base/docs/adr/030-performance-patterns.md +60 -0
- package/templates/base/docs/adr/031-nx-generators-roadmap.md +73 -0
- package/templates/base/docs/runbooks/000-template.md +78 -0
- package/templates/base/docs/sla-slo.md +36 -0
- package/templates/base/dot-editorconfig +12 -0
- package/templates/base/dot-github/ISSUE_TEMPLATE/bug_report.md +33 -0
- package/templates/base/dot-github/ISSUE_TEMPLATE/feature_request.md +21 -0
- package/templates/base/dot-github/pull_request_template.md +32 -0
- package/templates/base/dot-gitignore +28 -0
- package/templates/base/dot-husky/commit-msg +1 -0
- package/templates/base/dot-husky/pre-commit +1 -0
- package/templates/base/dot-husky/pre-push +2 -0
- package/templates/base/dot-npmrc +1 -0
- package/templates/base/dot-nvmrc +1 -0
- package/templates/base/dot-prettierrc +8 -0
- package/templates/base/eslint.config.mjs +35 -0
- package/templates/base/jest.config.ts +56 -0
- package/templates/base/nest-cli.json.ejs +10 -0
- package/templates/base/nx.json +3 -0
- package/templates/base/package.json.ejs +78 -0
- package/templates/base/src/app/modules/.gitkeep +0 -0
- package/templates/base/src/config/.gitkeep +0 -0
- package/templates/base/src/infrastructure/database/entities/.gitkeep +0 -0
- package/templates/base/src/infrastructure/database/migrations/.gitkeep +0 -0
- package/templates/base/src/infrastructure/database/repositories/.gitkeep +0 -0
- package/templates/base/src/infrastructure/http/.gitkeep +0 -0
- package/templates/base/src/infrastructure/notifications/.gitkeep +0 -0
- package/templates/base/src/infrastructure/queue/.gitkeep +0 -0
- package/templates/base/src/infrastructure/storage/.gitkeep +0 -0
- package/templates/base/src/shared/constants/error-codes.constant.ts +30 -0
- package/templates/base/src/shared/constants/http.constant.ts +134 -0
- package/templates/base/src/shared/constants/index.ts +2 -0
- package/templates/base/src/shared/decorators/.gitkeep +0 -0
- package/templates/base/src/shared/decorators/api-paginated-response.decorator.ts +10 -0
- package/templates/base/src/shared/errors/application.error.ts +21 -0
- package/templates/base/src/shared/errors/forbidden.error.ts +7 -0
- package/templates/base/src/shared/errors/index.ts +6 -0
- package/templates/base/src/shared/errors/invalid-request.error.ts +7 -0
- package/templates/base/src/shared/errors/not-found.error.ts +7 -0
- package/templates/base/src/shared/errors/requester.error.ts +7 -0
- package/templates/base/src/shared/errors/validation.error.ts +7 -0
- package/templates/base/src/shared/filters/http-exception.filter.ts +139 -0
- package/templates/base/src/shared/guards/.gitkeep +0 -0
- package/templates/base/src/shared/interceptors/interfaces/.gitkeep +0 -0
- package/templates/base/src/shared/interceptors/response.interceptor.ts +22 -0
- package/templates/base/src/shared/middleware/request-timeout.middleware.ts +32 -0
- package/templates/base/src/shared/pipes/parse-uuid.pipe.ts +13 -0
- package/templates/base/src/shared/utils/index.ts +2 -0
- package/templates/base/src/shared/utils/retry.util.ts +32 -0
- package/templates/base/src/shared/utils/sleep.util.ts +3 -0
- package/templates/base/tests/e2e/app.e2e-spec.ts.ejs +25 -0
- package/templates/base/tests/factories/.gitkeep +0 -0
- package/templates/base/tests/helpers/.gitkeep +0 -0
- package/templates/base/tests/integration/.gitkeep +0 -0
- package/templates/base/tests/unit/app.module.spec.ts +11 -0
- package/templates/base/tests/unit/shared/errors/error-hierarchy.spec.ts +69 -0
- package/templates/base/tests/unit/shared/filters/http-exception.filter.spec.ts +188 -0
- package/templates/base/tests/unit/shared/interceptors/response.interceptor.spec.ts +54 -0
- package/templates/base/tests/unit/shared/pipes/parse-uuid.pipe.spec.ts +14 -0
- package/templates/base/tsconfig.build.json +4 -0
- package/templates/base/tsconfig.json.ejs +26 -0
- package/templates/project-types/aws-lambda/package-fragment.json +8 -0
- package/templates/project-types/aws-lambda/src/app.module.ts.ejs +9 -0
- package/templates/project-types/aws-lambda/src/main.ts.ejs +32 -0
- package/templates/project-types/aws-lambda/tests/unit/handler.spec.ts +7 -0
- package/templates/project-types/cli-app/package-fragment.json +8 -0
- package/templates/project-types/cli-app/src/app.module.ts.ejs +11 -0
- package/templates/project-types/cli-app/src/commands/hello.command.ts.ejs +8 -0
- package/templates/project-types/cli-app/src/main.ts.ejs +8 -0
- package/templates/project-types/cli-app/tests/unit/commands/hello.command.spec.ts +17 -0
- package/templates/project-types/full-stack/apps/api/src/app.module.ts.ejs +9 -0
- package/templates/project-types/full-stack/apps/api/src/main.ts.ejs +32 -0
- package/templates/project-types/full-stack/frontend/nextjs/.cursor/rules/nextjs.mdc +12 -0
- package/templates/project-types/full-stack/frontend/nextjs/.github/copilot-instructions.md +23 -0
- package/templates/project-types/full-stack/frontend/nextjs/CLAUDE.md +25 -0
- package/templates/project-types/full-stack/frontend/nextjs/next.config.ts +9 -0
- package/templates/project-types/full-stack/frontend/nextjs/package.json +21 -0
- package/templates/project-types/full-stack/frontend/nextjs/src/app/layout.tsx +9 -0
- package/templates/project-types/full-stack/frontend/nextjs/src/app/page.tsx +8 -0
- package/templates/project-types/full-stack/frontend/nextjs/tsconfig.json +21 -0
- package/templates/project-types/full-stack/frontend/nuxt/.cursor/rules/nuxt.mdc +14 -0
- package/templates/project-types/full-stack/frontend/nuxt/.github/copilot-instructions.md +25 -0
- package/templates/project-types/full-stack/frontend/nuxt/CLAUDE.md +25 -0
- package/templates/project-types/full-stack/frontend/nuxt/app.vue +5 -0
- package/templates/project-types/full-stack/frontend/nuxt/nuxt.config.ts +6 -0
- package/templates/project-types/full-stack/frontend/nuxt/package.json +17 -0
- package/templates/project-types/full-stack/frontend/nuxt/pages/index.vue +3 -0
- package/templates/project-types/full-stack/frontend/nuxt/tsconfig.json +1 -0
- package/templates/project-types/full-stack/frontend/sveltekit/.cursor/rules/sveltekit.mdc +13 -0
- package/templates/project-types/full-stack/frontend/sveltekit/.github/copilot-instructions.md +24 -0
- package/templates/project-types/full-stack/frontend/sveltekit/CLAUDE.md +25 -0
- package/templates/project-types/full-stack/frontend/sveltekit/package.json +17 -0
- package/templates/project-types/full-stack/frontend/sveltekit/src/app.html +5 -0
- package/templates/project-types/full-stack/frontend/sveltekit/src/routes/+page.svelte +1 -0
- package/templates/project-types/full-stack/frontend/sveltekit/svelte.config.js +5 -0
- package/templates/project-types/full-stack/frontend/sveltekit/vite.config.ts +9 -0
- package/templates/project-types/full-stack/frontend/vite-react/.cursor/rules/react.mdc +12 -0
- package/templates/project-types/full-stack/frontend/vite-react/.github/copilot-instructions.md +23 -0
- package/templates/project-types/full-stack/frontend/vite-react/CLAUDE.md +24 -0
- package/templates/project-types/full-stack/frontend/vite-react/index.html +5 -0
- package/templates/project-types/full-stack/frontend/vite-react/package.json +22 -0
- package/templates/project-types/full-stack/frontend/vite-react/src/App.tsx +8 -0
- package/templates/project-types/full-stack/frontend/vite-react/src/main.tsx +9 -0
- package/templates/project-types/full-stack/frontend/vite-react/tsconfig.json +21 -0
- package/templates/project-types/full-stack/frontend/vite-react/vite.config.ts +9 -0
- package/templates/project-types/full-stack/libs/shared-types/package.json.ejs +6 -0
- package/templates/project-types/full-stack/libs/shared-types/src/index.ts.ejs +15 -0
- package/templates/project-types/full-stack/nx.json.ejs +20 -0
- package/templates/project-types/full-stack/package-fragment.json +14 -0
- package/templates/project-types/full-stack/pnpm-workspace.yaml +3 -0
- package/templates/project-types/full-stack/tsconfig.json.ejs +27 -0
- package/templates/project-types/http-api/src/app.module.ts.ejs +9 -0
- package/templates/project-types/http-api/src/main.ts.ejs +30 -0
- package/templates/project-types/http-api/tests/e2e/health.e2e-spec.ts +23 -0
- package/templates/project-types/microservice/package-fragment.json +5 -0
- package/templates/project-types/microservice/src/app.module.ts.ejs +9 -0
- package/templates/project-types/microservice/src/main.ts.ejs +15 -0
- package/templates/project-types/microservice/tests/unit/app.module.spec.ts +9 -0
- package/templates/project-types/monorepo/README.md.ejs +33 -0
- package/templates/project-types/monorepo/apps/api/src/app.module.ts.ejs +9 -0
- package/templates/project-types/monorepo/apps/api/src/main.ts.ejs +30 -0
- package/templates/project-types/monorepo/libs/common/package.json.ejs +6 -0
- package/templates/project-types/monorepo/libs/common/src/index.ts.ejs +17 -0
- package/templates/project-types/monorepo/nx.json.ejs +20 -0
- package/templates/project-types/monorepo/package-fragment.json +13 -0
- package/templates/project-types/monorepo/pnpm-workspace.yaml +3 -0
- package/templates/project-types/monorepo/tsconfig.json.ejs +27 -0
- package/templates/project-types/scheduled-worker/package-fragment.json +5 -0
- package/templates/project-types/scheduled-worker/src/app.module.ts.ejs +13 -0
- package/templates/project-types/scheduled-worker/src/jobs/example.job.ts.ejs +12 -0
- package/templates/project-types/scheduled-worker/src/main.ts.ejs +10 -0
- package/templates/project-types/scheduled-worker/tests/unit/jobs/example.job.spec.ts +17 -0
- package/templates/recipes/adminjs/README.md +145 -0
- package/templates/recipes/adminjs/src/app/modules/admin/admin.module.ts +59 -0
- package/templates/recipes/adminjs/tests/unit/app/modules/admin/admin.module.spec.ts +22 -0
- package/templates/recipes/ai-context/README.md +11 -0
- package/templates/recipes/ai-context/claude/base.md +73 -0
- package/templates/recipes/ai-context/claude/commands/add-command.md +48 -0
- package/templates/recipes/ai-context/claude/commands/add-consumer.md +58 -0
- package/templates/recipes/ai-context/claude/commands/add-endpoint.md +69 -0
- package/templates/recipes/ai-context/claude/commands/add-job.md +42 -0
- package/templates/recipes/ai-context/claude/commands/migrate.md +69 -0
- package/templates/recipes/ai-context/copilot/base.md +71 -0
- package/templates/recipes/ai-context/cursor/auth.mdc +44 -0
- package/templates/recipes/ai-context/cursor/base.mdc +44 -0
- package/templates/recipes/ai-context/cursor/prisma.mdc +43 -0
- package/templates/recipes/ai-context/cursor/swagger.mdc +48 -0
- package/templates/recipes/ai-context/cursor/testing.mdc +58 -0
- package/templates/recipes/ai-context/cursor/typeorm.mdc +49 -0
- package/templates/recipes/api-keys/README.md +44 -0
- package/templates/recipes/api-keys/src/shared/guards/api-key.guard.ts +32 -0
- package/templates/recipes/api-keys/tests/unit/shared/guards/api-key.guard.spec.ts +40 -0
- package/templates/recipes/api-versioning/README.md +63 -0
- package/templates/recipes/audit-trail/README.md +75 -0
- package/templates/recipes/audit-trail/src/shared/decorators/auditable.decorator.ts +4 -0
- package/templates/recipes/audit-trail/src/shared/interceptors/audit.interceptor.ts +46 -0
- package/templates/recipes/audit-trail/tests/unit/shared/interceptors/audit.interceptor.spec.ts +82 -0
- package/templates/recipes/auth-flows/README.md +91 -0
- package/templates/recipes/auth-flows/src/app/modules/auth/auth.controller.ts +44 -0
- package/templates/recipes/auth-flows/src/app/modules/auth/auth.module.ts +11 -0
- package/templates/recipes/auth-flows/src/app/modules/auth/auth.service.ts +194 -0
- package/templates/recipes/auth-flows/src/app/modules/auth/dto/forgot-password.dto.ts +6 -0
- package/templates/recipes/auth-flows/src/app/modules/auth/dto/login.dto.ts +9 -0
- package/templates/recipes/auth-flows/src/app/modules/auth/dto/reset-password.dto.ts +11 -0
- package/templates/recipes/auth-flows/src/app/modules/auth/dto/signup.dto.ts +16 -0
- package/templates/recipes/auth-flows/tests/unit/app/modules/auth/auth.service.spec.ts +13 -0
- package/templates/recipes/bullmq/README.md +54 -0
- package/templates/recipes/bullmq/src/infrastructure/queue/example.processor.ts +25 -0
- package/templates/recipes/bullmq/src/infrastructure/queue/queue.module.ts +26 -0
- package/templates/recipes/bullmq/tests/unit/infrastructure/queue/example.processor.spec.ts +17 -0
- package/templates/recipes/changelog/.changelogrc.json +18 -0
- package/templates/recipes/changelog/README.md +44 -0
- package/templates/recipes/ci-cd/README.md +14 -0
- package/templates/recipes/ci-cd/aws-codepipeline/README.md +30 -0
- package/templates/recipes/ci-cd/aws-codepipeline/buildspec.yml +41 -0
- package/templates/recipes/ci-cd/azure-devops/README.md +32 -0
- package/templates/recipes/ci-cd/azure-devops/azure-pipelines.yml +79 -0
- package/templates/recipes/ci-cd/gcp-cloudbuild/README.md +64 -0
- package/templates/recipes/ci-cd/gcp-cloudbuild/cloudbuild.yaml +53 -0
- package/templates/recipes/ci-cd/github-actions/.github/workflows/cd.yml +35 -0
- package/templates/recipes/ci-cd/github-actions/.github/workflows/ci.yml +62 -0
- package/templates/recipes/ci-cd/github-actions/README.md +29 -0
- package/templates/recipes/circuit-breaker/README.md +45 -0
- package/templates/recipes/circuit-breaker/src/shared/utils/circuit-breaker.ts +100 -0
- package/templates/recipes/circuit-breaker/tests/unit/shared/utils/circuit-breaker.spec.ts +28 -0
- package/templates/recipes/cloud-aws/README.md +20 -0
- package/templates/recipes/cloud-aws/cloudfront/README.md +50 -0
- package/templates/recipes/cloud-aws/cloudfront/src/infrastructure/aws/cloudfront.module.ts +8 -0
- package/templates/recipes/cloud-aws/cloudfront/src/infrastructure/aws/cloudfront.service.ts +29 -0
- package/templates/recipes/cloud-aws/cloudwatch/README.md +40 -0
- package/templates/recipes/cloud-aws/cloudwatch/src/infrastructure/aws/cloudwatch.module.ts +8 -0
- package/templates/recipes/cloud-aws/cloudwatch/src/infrastructure/aws/cloudwatch.service.ts +40 -0
- package/templates/recipes/cloud-aws/cognito/README.md +39 -0
- package/templates/recipes/cloud-aws/cognito/src/infrastructure/aws/cognito.module.ts +8 -0
- package/templates/recipes/cloud-aws/cognito/src/infrastructure/aws/cognito.service.ts +47 -0
- package/templates/recipes/cloud-aws/dynamodb/README.md +48 -0
- package/templates/recipes/cloud-aws/dynamodb/src/infrastructure/aws/dynamodb.module.ts +8 -0
- package/templates/recipes/cloud-aws/dynamodb/src/infrastructure/aws/dynamodb.service.ts +49 -0
- package/templates/recipes/cloud-aws/elasticache/README.md +45 -0
- package/templates/recipes/cloud-aws/elasticache/src/infrastructure/aws/redis.module.ts +8 -0
- package/templates/recipes/cloud-aws/elasticache/src/infrastructure/aws/redis.service.ts +47 -0
- package/templates/recipes/cloud-aws/eventbridge/README.md +46 -0
- package/templates/recipes/cloud-aws/eventbridge/src/infrastructure/aws/eventbridge.module.ts +8 -0
- package/templates/recipes/cloud-aws/eventbridge/src/infrastructure/aws/eventbridge.service.ts +48 -0
- package/templates/recipes/cloud-aws/rds/README.md +59 -0
- package/templates/recipes/cloud-aws/s3/README.md +44 -0
- package/templates/recipes/cloud-aws/s3/src/infrastructure/aws/s3.module.ts +8 -0
- package/templates/recipes/cloud-aws/s3/src/infrastructure/aws/s3.service.ts +42 -0
- package/templates/recipes/cloud-aws/secrets-manager/README.md +38 -0
- package/templates/recipes/cloud-aws/secrets-manager/src/infrastructure/aws/secrets.module.ts +8 -0
- package/templates/recipes/cloud-aws/secrets-manager/src/infrastructure/aws/secrets.service.ts +39 -0
- package/templates/recipes/cloud-aws/sns/README.md +43 -0
- package/templates/recipes/cloud-aws/sns/src/infrastructure/aws/sns.module.ts +8 -0
- package/templates/recipes/cloud-aws/sns/src/infrastructure/aws/sns.service.ts +48 -0
- package/templates/recipes/cloud-aws/sqs/README.md +47 -0
- package/templates/recipes/cloud-aws/sqs/src/infrastructure/aws/sqs.module.ts +8 -0
- package/templates/recipes/cloud-aws/sqs/src/infrastructure/aws/sqs.service.ts +58 -0
- package/templates/recipes/cloud-aws/ssm/README.md +41 -0
- package/templates/recipes/cloud-aws/ssm/src/infrastructure/aws/ssm.module.ts +8 -0
- package/templates/recipes/cloud-aws/ssm/src/infrastructure/aws/ssm.service.ts +54 -0
- package/templates/recipes/cloud-azure/README.md +18 -0
- package/templates/recipes/cloud-azure/app-insights/README.md +50 -0
- package/templates/recipes/cloud-azure/app-insights/src/infrastructure/azure/app-insights.module.ts +11 -0
- package/templates/recipes/cloud-azure/app-insights/src/infrastructure/azure/app-insights.service.ts +38 -0
- package/templates/recipes/cloud-azure/blob-storage/README.md +49 -0
- package/templates/recipes/cloud-azure/blob-storage/src/infrastructure/azure/blob-storage.module.ts +11 -0
- package/templates/recipes/cloud-azure/blob-storage/src/infrastructure/azure/blob-storage.service.ts +64 -0
- package/templates/recipes/cloud-azure/cache/README.md +47 -0
- package/templates/recipes/cloud-azure/cache/src/infrastructure/azure/redis.module.ts +11 -0
- package/templates/recipes/cloud-azure/cache/src/infrastructure/azure/redis.service.ts +41 -0
- package/templates/recipes/cloud-azure/cosmos-db/README.md +57 -0
- package/templates/recipes/cloud-azure/cosmos-db/src/infrastructure/azure/cosmos-db.module.ts +11 -0
- package/templates/recipes/cloud-azure/cosmos-db/src/infrastructure/azure/cosmos-db.service.ts +55 -0
- package/templates/recipes/cloud-azure/entra-id/README.md +42 -0
- package/templates/recipes/cloud-azure/entra-id/src/infrastructure/azure/entra-id.module.ts +11 -0
- package/templates/recipes/cloud-azure/entra-id/src/infrastructure/azure/entra-id.service.ts +55 -0
- package/templates/recipes/cloud-azure/front-door/README.md +48 -0
- package/templates/recipes/cloud-azure/functions/README.md +48 -0
- package/templates/recipes/cloud-azure/key-vault/README.md +42 -0
- package/templates/recipes/cloud-azure/key-vault/src/infrastructure/azure/key-vault.module.ts +11 -0
- package/templates/recipes/cloud-azure/key-vault/src/infrastructure/azure/key-vault.service.ts +27 -0
- package/templates/recipes/cloud-azure/service-bus/README.md +49 -0
- package/templates/recipes/cloud-azure/service-bus/src/infrastructure/azure/service-bus.module.ts +11 -0
- package/templates/recipes/cloud-azure/service-bus/src/infrastructure/azure/service-bus.service.ts +52 -0
- package/templates/recipes/cloud-azure/sql-database/README.md +54 -0
- package/templates/recipes/cloud-gcp/README.md +18 -0
- package/templates/recipes/cloud-gcp/cloud-cdn/README.md +40 -0
- package/templates/recipes/cloud-gcp/cloud-functions/README.md +42 -0
- package/templates/recipes/cloud-gcp/cloud-logging/README.md +42 -0
- package/templates/recipes/cloud-gcp/cloud-logging/src/infrastructure/gcp/logging.module.ts +10 -0
- package/templates/recipes/cloud-gcp/cloud-logging/src/infrastructure/gcp/logging.service.ts +50 -0
- package/templates/recipes/cloud-gcp/cloud-sql/README.md +53 -0
- package/templates/recipes/cloud-gcp/cloud-storage/README.md +43 -0
- package/templates/recipes/cloud-gcp/cloud-storage/src/infrastructure/gcp/storage.module.ts +10 -0
- package/templates/recipes/cloud-gcp/cloud-storage/src/infrastructure/gcp/storage.service.ts +51 -0
- package/templates/recipes/cloud-gcp/firebase-auth/README.md +38 -0
- package/templates/recipes/cloud-gcp/firebase-auth/src/infrastructure/gcp/firebase-auth.module.ts +10 -0
- package/templates/recipes/cloud-gcp/firebase-auth/src/infrastructure/gcp/firebase-auth.service.ts +41 -0
- package/templates/recipes/cloud-gcp/firestore/README.md +46 -0
- package/templates/recipes/cloud-gcp/firestore/src/infrastructure/gcp/firestore.module.ts +10 -0
- package/templates/recipes/cloud-gcp/firestore/src/infrastructure/gcp/firestore.service.ts +44 -0
- package/templates/recipes/cloud-gcp/memorystore/README.md +44 -0
- package/templates/recipes/cloud-gcp/memorystore/src/infrastructure/gcp/redis.module.ts +10 -0
- package/templates/recipes/cloud-gcp/memorystore/src/infrastructure/gcp/redis.service.ts +54 -0
- package/templates/recipes/cloud-gcp/pubsub/README.md +43 -0
- package/templates/recipes/cloud-gcp/pubsub/src/infrastructure/gcp/pubsub.module.ts +10 -0
- package/templates/recipes/cloud-gcp/pubsub/src/infrastructure/gcp/pubsub.service.ts +60 -0
- package/templates/recipes/cloud-gcp/secret-manager/README.md +40 -0
- package/templates/recipes/cloud-gcp/secret-manager/src/infrastructure/gcp/secrets.module.ts +10 -0
- package/templates/recipes/cloud-gcp/secret-manager/src/infrastructure/gcp/secrets.service.ts +41 -0
- package/templates/recipes/config-validation/README.md +61 -0
- package/templates/recipes/config-validation/src/config/env.validation.ts +28 -0
- package/templates/recipes/config-validation/tests/unit/config/env.validation.spec.ts +34 -0
- package/templates/recipes/content-digest/README.md +28 -0
- package/templates/recipes/content-digest/src/shared/guards/content-digest.guard.ts +30 -0
- package/templates/recipes/content-digest/src/shared/interceptors/content-digest.interceptor.ts +23 -0
- package/templates/recipes/content-digest/tests/unit/shared/guards/content-digest.guard.spec.ts +56 -0
- package/templates/recipes/content-digest/tests/unit/shared/interceptors/content-digest.interceptor.spec.ts +54 -0
- package/templates/recipes/correlation-id/README.md +44 -0
- package/templates/recipes/correlation-id/src/shared/middleware/correlation-id.middleware.ts +29 -0
- package/templates/recipes/correlation-id/tests/unit/shared/middleware/correlation-id.spec.ts +5 -0
- package/templates/recipes/cors/README.md +45 -0
- package/templates/recipes/cqrs/README.md +39 -0
- package/templates/recipes/cqrs/src/shared/cqrs/example.command.ts +29 -0
- package/templates/recipes/cqrs/tests/unit/shared/cqrs/example.command.spec.ts +38 -0
- package/templates/recipes/csrf/README.md +55 -0
- package/templates/recipes/data-masking/README.md +85 -0
- package/templates/recipes/data-masking/src/shared/decorators/sensitive.decorator.ts +12 -0
- package/templates/recipes/data-masking/src/shared/utils/mask.util.ts +26 -0
- package/templates/recipes/data-masking/tests/unit/shared/utils/mask.util.spec.ts +21 -0
- package/templates/recipes/database-factories/README.md +48 -0
- package/templates/recipes/database-factories/tests/factories/base.factory.ts +51 -0
- package/templates/recipes/database-seeding/README.md +40 -0
- package/templates/recipes/database-seeding/src/infrastructure/database/seed.ts +61 -0
- package/templates/recipes/database-seeding/tests/unit/infrastructure/database/seed.spec.ts +37 -0
- package/templates/recipes/dead-letter-queue/README.md +79 -0
- package/templates/recipes/dead-letter-queue/src/infrastructure/queue/dlq.service.ts +43 -0
- package/templates/recipes/dead-letter-queue/tests/unit/infrastructure/queue/dlq.service.spec.ts +46 -0
- package/templates/recipes/dependabot-renovate/.github/dependabot.yml +52 -0
- package/templates/recipes/dependabot-renovate/README.md +37 -0
- package/templates/recipes/dependabot-renovate/renovate.json +46 -0
- package/templates/recipes/deploy/README.md +13 -0
- package/templates/recipes/deploy/docker-compose/README.md +38 -0
- package/templates/recipes/deploy/docker-compose/docker-compose.yml +43 -0
- package/templates/recipes/deploy/dockerfile/Dockerfile +30 -0
- package/templates/recipes/deploy/dockerfile/README.md +30 -0
- package/templates/recipes/deploy/dockerfile/dot-dockerignore +9 -0
- package/templates/recipes/deploy/kubernetes/README.md +43 -0
- package/templates/recipes/deploy/kubernetes/k8s/configmap.yaml +7 -0
- package/templates/recipes/deploy/kubernetes/k8s/deployment.yaml +45 -0
- package/templates/recipes/deploy/kubernetes/k8s/hpa.yaml +18 -0
- package/templates/recipes/deploy/kubernetes/k8s/ingress.yaml +23 -0
- package/templates/recipes/deploy/kubernetes/k8s/service.yaml +12 -0
- package/templates/recipes/deploy/serverless-framework/README.md +39 -0
- package/templates/recipes/deploy/serverless-framework/serverless.yml.ejs +22 -0
- package/templates/recipes/deploy/terraform/README.md +99 -0
- package/templates/recipes/deploy/terraform/main.tf.ejs +13 -0
- package/templates/recipes/deploy/terraform/modules/app/alb.tf +34 -0
- package/templates/recipes/deploy/terraform/modules/app/iam.tf +30 -0
- package/templates/recipes/deploy/terraform/modules/app/main.tf +80 -0
- package/templates/recipes/deploy/terraform/modules/app/outputs.tf +11 -0
- package/templates/recipes/deploy/terraform/modules/app/security.tf +37 -0
- package/templates/recipes/deploy/terraform/modules/app/variables.tf +42 -0
- package/templates/recipes/deploy/terraform/outputs.tf +4 -0
- package/templates/recipes/deploy/terraform/variables.tf +11 -0
- package/templates/recipes/devcontainer/.devcontainer/Dockerfile +5 -0
- package/templates/recipes/devcontainer/.devcontainer/devcontainer.json +32 -0
- package/templates/recipes/devcontainer/.devcontainer/docker-compose.yml +62 -0
- package/templates/recipes/devcontainer/README.md +31 -0
- package/templates/recipes/distributed-tracing/README.md +45 -0
- package/templates/recipes/distributed-tracing/src/shared/middleware/trace-propagation.middleware.ts +68 -0
- package/templates/recipes/distributed-tracing/tests/unit/shared/middleware/trace-propagation.middleware.spec.ts +76 -0
- package/templates/recipes/docker-compose-dev/Dockerfile.dev +14 -0
- package/templates/recipes/docker-compose-dev/README.md +57 -0
- package/templates/recipes/docker-compose-dev/docker-compose.dev.yml.ejs +54 -0
- package/templates/recipes/docs-site/README.md +41 -0
- package/templates/recipes/docs-site/docs/.vitepress/config.ts.ejs +53 -0
- package/templates/recipes/dpop/README.md +37 -0
- package/templates/recipes/dpop/src/shared/guards/dpop.guard.ts +61 -0
- package/templates/recipes/dpop/tests/unit/shared/guards/dpop.guard.spec.ts +69 -0
- package/templates/recipes/drizzle-postgres/README.md +68 -0
- package/templates/recipes/drizzle-postgres/drizzle.config.ts +10 -0
- package/templates/recipes/drizzle-postgres/src/infrastructure/database/drizzle.module.ts +25 -0
- package/templates/recipes/drizzle-postgres/src/infrastructure/database/schema/example.ts +9 -0
- package/templates/recipes/drizzle-postgres/src/infrastructure/database/schema/index.ts +3 -0
- package/templates/recipes/drizzle-postgres/tests/unit/infrastructure/database/drizzle.module.spec.ts +35 -0
- package/templates/recipes/env-per-environment/.env.development +17 -0
- package/templates/recipes/env-per-environment/.env.production +20 -0
- package/templates/recipes/env-per-environment/.env.test +17 -0
- package/templates/recipes/env-per-environment/README.md +40 -0
- package/templates/recipes/feature-flags/README.md +45 -0
- package/templates/recipes/feature-flags/src/shared/services/feature-flag.service.ts +48 -0
- package/templates/recipes/feature-flags/tests/unit/shared/services/feature-flag.service.spec.ts +36 -0
- package/templates/recipes/file-upload/README.md +104 -0
- package/templates/recipes/file-upload/src/shared/interceptors/file-upload.interceptor.ts +33 -0
- package/templates/recipes/file-upload/src/shared/pipes/file-validation.pipe.ts +45 -0
- package/templates/recipes/file-upload/tests/unit/shared/pipes/file-validation.pipe.spec.ts +56 -0
- package/templates/recipes/filtering/README.md +43 -0
- package/templates/recipes/filtering/src/shared/dto/filter.dto.ts +49 -0
- package/templates/recipes/filtering/tests/unit/shared/dto/filter.dto.spec.ts +38 -0
- package/templates/recipes/graceful-shutdown/README.md +60 -0
- package/templates/recipes/graceful-shutdown/src/shared/lifecycle/shutdown.service.ts +52 -0
- package/templates/recipes/graceful-shutdown/tests/unit/shared/lifecycle/shutdown.service.spec.ts +52 -0
- package/templates/recipes/graphql-mercurius/README.md +37 -0
- package/templates/recipes/graphql-mercurius/src/infrastructure/graphql/graphql.module.ts +18 -0
- package/templates/recipes/graphql-mercurius/tests/unit/infrastructure/graphql/graphql.module.spec.ts +12 -0
- package/templates/recipes/health-checks/README.md +35 -0
- package/templates/recipes/health-checks/src/shared/health/health.controller.ts +26 -0
- package/templates/recipes/health-checks/src/shared/health/health.module.ts +9 -0
- package/templates/recipes/health-checks/tests/unit/shared/health/health.controller.spec.ts +8 -0
- package/templates/recipes/helmet/README.md +43 -0
- package/templates/recipes/http-caching/README.md +63 -0
- package/templates/recipes/http-caching/src/shared/decorators/cache-control.decorator.ts +18 -0
- package/templates/recipes/http-caching/src/shared/interceptors/cache-control.interceptor.ts +43 -0
- package/templates/recipes/http-caching/tests/unit/shared/interceptors/cache-control.interceptor.spec.ts +44 -0
- package/templates/recipes/i18n/README.md +45 -0
- package/templates/recipes/i18n/src/i18n/en/common.json +7 -0
- package/templates/recipes/i18n/src/i18n/nl/common.json +7 -0
- package/templates/recipes/i18n/src/shared/i18n/i18n.module.ts +17 -0
- package/templates/recipes/i18n/tests/unit/shared/i18n/i18n.module.spec.ts +18 -0
- package/templates/recipes/idempotency/README.md +63 -0
- package/templates/recipes/idempotency/src/shared/decorators/idempotent.decorator.ts +4 -0
- package/templates/recipes/idempotency/src/shared/middleware/idempotency.middleware.ts +63 -0
- package/templates/recipes/idempotency/tests/unit/shared/middleware/idempotency.middleware.spec.ts +56 -0
- package/templates/recipes/json-merge-patch/README.md +53 -0
- package/templates/recipes/json-merge-patch/src/shared/pipes/merge-patch.pipe.ts +11 -0
- package/templates/recipes/json-merge-patch/tests/unit/shared/pipes/merge-patch.pipe.spec.ts +30 -0
- package/templates/recipes/json-patch/README.md +54 -0
- package/templates/recipes/json-patch/src/shared/pipes/json-patch.pipe.ts +39 -0
- package/templates/recipes/json-patch/tests/unit/shared/pipes/json-patch.pipe.spec.ts +37 -0
- package/templates/recipes/jwt-auth/README.md +56 -0
- package/templates/recipes/jwt-auth/src/shared/decorators/current-user.decorator.ts +10 -0
- package/templates/recipes/jwt-auth/src/shared/decorators/public.decorator.ts +4 -0
- package/templates/recipes/jwt-auth/src/shared/guards/jwt-auth.guard.ts +24 -0
- package/templates/recipes/jwt-auth/tests/unit/shared/guards/jwt-auth.guard.spec.ts +9 -0
- package/templates/recipes/kysely/README.md +53 -0
- package/templates/recipes/kysely/src/infrastructure/database/database.module.ts +28 -0
- package/templates/recipes/kysely/src/infrastructure/database/types.ts +17 -0
- package/templates/recipes/kysely/tests/unit/infrastructure/database/database.module.spec.ts +35 -0
- package/templates/recipes/license/LICENSE.agpl3 +59 -0
- package/templates/recipes/license/LICENSE.apache +189 -0
- package/templates/recipes/license/LICENSE.bsd3 +28 -0
- package/templates/recipes/license/LICENSE.gpl3 +22 -0
- package/templates/recipes/license/LICENSE.isc +15 -0
- package/templates/recipes/license/LICENSE.mit +21 -0
- package/templates/recipes/license/LICENSE.mpl2 +24 -0
- package/templates/recipes/license/LICENSE.proprietary +76 -0
- package/templates/recipes/license/LICENSE.unlicensed +13 -0
- package/templates/recipes/license/README.md +53 -0
- package/templates/recipes/load-testing/README.md +77 -0
- package/templates/recipes/load-testing/k6/smoke.js +20 -0
- package/templates/recipes/load-testing/k6/stress.js +22 -0
- package/templates/recipes/mfa-totp/README.md +77 -0
- package/templates/recipes/mfa-totp/src/shared/auth/totp.service.ts +26 -0
- package/templates/recipes/mfa-totp/tests/unit/shared/auth/totp.service.spec.ts +65 -0
- package/templates/recipes/mikro-orm/README.md +22 -0
- package/templates/recipes/mikro-orm/src/infrastructure/database/database.module.ts +8 -0
- package/templates/recipes/mikro-orm/src/infrastructure/database/entities/.gitkeep +0 -0
- package/templates/recipes/mikro-orm/src/infrastructure/database/migrations/.gitkeep +0 -0
- package/templates/recipes/mikro-orm/src/infrastructure/database/mikro-orm.config.ts +20 -0
- package/templates/recipes/mikro-orm/tests/unit/infrastructure/database/mikro-orm.config.spec.ts +53 -0
- package/templates/recipes/mongoose/README.md +42 -0
- package/templates/recipes/mongoose/src/infrastructure/database/database.module.ts.ejs +17 -0
- package/templates/recipes/mongoose/tests/unit/infrastructure/database/database.module.spec.ts +25 -0
- package/templates/recipes/multi-tenancy/README.md +49 -0
- package/templates/recipes/multi-tenancy/src/shared/decorators/tenant.decorator.ts +14 -0
- package/templates/recipes/multi-tenancy/src/shared/middleware/tenant.middleware.ts +49 -0
- package/templates/recipes/multi-tenancy/tests/unit/shared/middleware/tenant.middleware.spec.ts +29 -0
- package/templates/recipes/nodemailer/README.md +55 -0
- package/templates/recipes/nodemailer/src/infrastructure/notifications/mail.module.ts +37 -0
- package/templates/recipes/nodemailer/tests/unit/infrastructure/notifications/mail.module.spec.ts +33 -0
- package/templates/recipes/oauth-apple/README.md +68 -0
- package/templates/recipes/oauth-apple/src/shared/auth/apple-auth.guard.ts +5 -0
- package/templates/recipes/oauth-apple/src/shared/auth/apple.strategy.ts +33 -0
- package/templates/recipes/oauth-apple/tests/unit/shared/auth/apple.strategy.spec.ts +65 -0
- package/templates/recipes/oauth-github/README.md +62 -0
- package/templates/recipes/oauth-github/src/shared/auth/github-auth.guard.ts +5 -0
- package/templates/recipes/oauth-github/src/shared/auth/github.strategy.ts +33 -0
- package/templates/recipes/oauth-github/tests/unit/shared/auth/github.strategy.spec.ts +72 -0
- package/templates/recipes/oauth-google/README.md +64 -0
- package/templates/recipes/oauth-google/src/shared/auth/google-auth.guard.ts +5 -0
- package/templates/recipes/oauth-google/src/shared/auth/google.strategy.ts +33 -0
- package/templates/recipes/oauth-google/tests/unit/shared/auth/google.strategy.spec.ts +72 -0
- package/templates/recipes/oauth2-introspection/README.md +62 -0
- package/templates/recipes/oauth2-introspection/src/shared/guards/token-introspection.guard.ts +77 -0
- package/templates/recipes/oauth2-introspection/tests/unit/shared/guards/token-introspection.guard.spec.ts +99 -0
- package/templates/recipes/opentelemetry/README.md +44 -0
- package/templates/recipes/opentelemetry/src/infrastructure/telemetry/tracing.ts +38 -0
- package/templates/recipes/opentelemetry/tests/unit/infrastructure/telemetry/tracing.spec.ts +23 -0
- package/templates/recipes/pagination/README.md +71 -0
- package/templates/recipes/pagination/src/shared/decorators/paginate.decorator.ts +25 -0
- package/templates/recipes/pagination/src/shared/dto/pagination.dto.ts +64 -0
- package/templates/recipes/pagination/src/shared/interceptors/pagination-link.interceptor.ts +31 -0
- package/templates/recipes/pagination/tests/unit/shared/dto/pagination.dto.spec.ts +56 -0
- package/templates/recipes/passport/README.md +41 -0
- package/templates/recipes/passport/src/shared/guards/local-auth.guard.ts +5 -0
- package/templates/recipes/passport/tests/unit/shared/guards/local-auth.guard.spec.ts +17 -0
- package/templates/recipes/pino/README.md +48 -0
- package/templates/recipes/pino/src/infrastructure/logging/logger.module.ts +39 -0
- package/templates/recipes/pino/tests/unit/infrastructure/logging/logger.module.spec.ts +6 -0
- package/templates/recipes/prefer-header/README.md +92 -0
- package/templates/recipes/prefer-header/src/shared/interceptors/prefer.interceptor.ts +60 -0
- package/templates/recipes/prefer-header/tests/unit/shared/interceptors/prefer.interceptor.spec.ts +44 -0
- package/templates/recipes/prisma/README.md +52 -0
- package/templates/recipes/prisma/prisma/schema.prisma.ejs +8 -0
- package/templates/recipes/prisma/src/infrastructure/database/prisma.service.ts +27 -0
- package/templates/recipes/prisma/tests/unit/infrastructure/database/prisma.service.spec.ts +21 -0
- package/templates/recipes/prometheus/README.md +54 -0
- package/templates/recipes/prometheus/src/infrastructure/metrics/metrics.controller.ts +15 -0
- package/templates/recipes/prometheus/src/infrastructure/metrics/metrics.module.ts +29 -0
- package/templates/recipes/prometheus/tests/unit/infrastructure/metrics/metrics.controller.spec.ts +22 -0
- package/templates/recipes/rabbitmq/README.md +53 -0
- package/templates/recipes/rabbitmq/src/infrastructure/queue/queue.module.ts.ejs +27 -0
- package/templates/recipes/rbac-casl/README.md +69 -0
- package/templates/recipes/rbac-casl/src/shared/auth/casl-ability.factory.ts +43 -0
- package/templates/recipes/rbac-casl/src/shared/decorators/roles.decorator.ts +5 -0
- package/templates/recipes/rbac-casl/src/shared/guards/policies.guard.ts +32 -0
- package/templates/recipes/rbac-casl/src/shared/guards/roles.guard.ts +21 -0
- package/templates/recipes/rbac-casl/tests/unit/shared/auth/casl-ability.factory.spec.ts +6 -0
- package/templates/recipes/redis-cache/README.md +55 -0
- package/templates/recipes/redis-cache/src/infrastructure/cache/cache.module.ts +26 -0
- package/templates/recipes/redis-cache/tests/unit/infrastructure/cache/cache.module.spec.ts +12 -0
- package/templates/recipes/request-context/README.md +57 -0
- package/templates/recipes/request-context/src/shared/context/request-context.module.ts +19 -0
- package/templates/recipes/request-context/tests/unit/shared/context/request-context.module.spec.ts +20 -0
- package/templates/recipes/request-logging/README.md +36 -0
- package/templates/recipes/request-logging/src/shared/middleware/request-logging.middleware.ts +40 -0
- package/templates/recipes/request-logging/tests/unit/shared/middleware/request-logging.middleware.spec.ts +64 -0
- package/templates/recipes/s3-minio/README.md +52 -0
- package/templates/recipes/s3-minio/src/infrastructure/storage/storage.module.ts +10 -0
- package/templates/recipes/s3-minio/src/infrastructure/storage/storage.service.ts +72 -0
- package/templates/recipes/s3-minio/tests/unit/infrastructure/storage/storage.service.spec.ts +23 -0
- package/templates/recipes/sdk-generation/README.md +40 -0
- package/templates/recipes/sdk-generation/openapitools.json +21 -0
- package/templates/recipes/sendgrid/README.md +45 -0
- package/templates/recipes/sendgrid/src/infrastructure/notifications/sendgrid.service.ts +60 -0
- package/templates/recipes/sendgrid/tests/unit/infrastructure/notifications/sendgrid.service.spec.ts +59 -0
- package/templates/recipes/sentry/README.md +49 -0
- package/templates/recipes/sentry/src/infrastructure/sentry/sentry.filter.ts +34 -0
- package/templates/recipes/sentry/src/infrastructure/sentry/sentry.module.ts +23 -0
- package/templates/recipes/sentry/tests/unit/infrastructure/sentry/sentry.filter.spec.ts +50 -0
- package/templates/recipes/seq2/README.md +41 -0
- package/templates/recipes/seq2/src/infrastructure/logging/seq.transport.ts +57 -0
- package/templates/recipes/seq2/tests/unit/infrastructure/logging/seq.transport.spec.ts +53 -0
- package/templates/recipes/serialization-groups/README.md +105 -0
- package/templates/recipes/serialization-groups/src/shared/interceptors/serialize.interceptor.ts +29 -0
- package/templates/recipes/serialization-groups/tests/unit/shared/interceptors/serialize.interceptor.spec.ts +48 -0
- package/templates/recipes/soft-delete/README.md +71 -0
- package/templates/recipes/soft-delete/src/shared/decorators/with-deleted.decorator.ts +4 -0
- package/templates/recipes/soft-delete/src/shared/entities/soft-deletable.entity.ts +20 -0
- package/templates/recipes/soft-delete/tests/unit/shared/entities/soft-deletable.entity.spec.ts +35 -0
- package/templates/recipes/sse/README.md +43 -0
- package/templates/recipes/sse/src/shared/gateways/events.sse.controller.ts +21 -0
- package/templates/recipes/sse/tests/unit/shared/gateways/events.sse.controller.spec.ts +32 -0
- package/templates/recipes/swagger/README.md +42 -0
- package/templates/recipes/swagger/src/main.swagger.ts.ejs +20 -0
- package/templates/recipes/swagger/tests/unit/main.swagger.spec.ts +5 -0
- package/templates/recipes/throttler/README.md +49 -0
- package/templates/recipes/throttler/src/shared/guards/throttle.config.ts +33 -0
- package/templates/recipes/throttler/tests/unit/shared/guards/throttle.spec.ts +5 -0
- package/templates/recipes/transactional-outbox/README.md +98 -0
- package/templates/recipes/transactional-outbox/src/infrastructure/outbox/outbox.entity.ts +30 -0
- package/templates/recipes/transactional-outbox/src/infrastructure/outbox/outbox.service.ts +21 -0
- package/templates/recipes/transactional-outbox/tests/unit/infrastructure/outbox/outbox.service.spec.ts +38 -0
- package/templates/recipes/typeorm-mysql/README.md +48 -0
- package/templates/recipes/typeorm-mysql/src/infrastructure/database/database.module.ts.ejs +24 -0
- package/templates/recipes/typeorm-postgres/README.md +101 -0
- package/templates/recipes/typeorm-postgres/src/infrastructure/database/data-source.ts.ejs +14 -0
- package/templates/recipes/typeorm-postgres/src/infrastructure/database/database.module.ts.ejs +24 -0
- package/templates/recipes/typeorm-postgres/src/infrastructure/database/entities/.gitkeep +0 -0
- package/templates/recipes/typeorm-postgres/src/infrastructure/database/entities/index.ts +7 -0
- package/templates/recipes/typeorm-postgres/src/infrastructure/database/migrations/.gitkeep +0 -0
- package/templates/recipes/typeorm-postgres/src/infrastructure/database/migrations/index.ts +10 -0
- package/templates/recipes/typeorm-postgres/tests/unit/infrastructure/database/database.module.spec.ts +11 -0
- package/templates/recipes/webhooks/README.md +76 -0
- package/templates/recipes/webhooks/src/infrastructure/webhooks/webhook.service.ts +53 -0
- package/templates/recipes/webhooks/tests/unit/infrastructure/webhooks/webhook.service.spec.ts +31 -0
- package/templates/recipes/websockets/README.md +44 -0
- package/templates/recipes/websockets/src/shared/gateways/events.gateway.ts +55 -0
- package/templates/recipes/websockets/tests/unit/shared/gateways/events.gateway.spec.ts +23 -0
- package/templates/recipes/winston/README.md +45 -0
- package/templates/recipes/winston/src/infrastructure/logging/logger.module.ts +34 -0
- package/templates/recipes/winston/tests/unit/infrastructure/logging/logger.module.spec.ts +12 -0
- package/templates/recipes/worker-threads/README.md +71 -0
- package/templates/recipes/worker-threads/src/shared/utils/worker-pool.ts +59 -0
- package/templates/recipes/worker-threads/tests/unit/shared/utils/worker-pool.spec.ts +36 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# AdminJS — Auto-Generated CRUD Admin Panel
|
|
2
|
+
|
|
3
|
+
An out-of-the-box admin panel powered by [AdminJS](https://adminjs.co/) that provides auto-generated CRUD interfaces for your entities.
|
|
4
|
+
|
|
5
|
+
## Links
|
|
6
|
+
|
|
7
|
+
- [AdminJS Website](https://adminjs.co/)
|
|
8
|
+
- [NestJS Plugin Docs](https://docs.adminjs.co/installation/plugins/nest-js)
|
|
9
|
+
- [npm — adminjs](https://www.npmjs.com/package/adminjs)
|
|
10
|
+
|
|
11
|
+
## Dependencies
|
|
12
|
+
|
|
13
|
+
| Package | Version |
|
|
14
|
+
| -------------------------- | -------- |
|
|
15
|
+
| `adminjs` | 7.8.13 |
|
|
16
|
+
| `@adminjs/nestjs` | 6.1.0 |
|
|
17
|
+
| `@adminjs/express` | 6.1.0 |
|
|
18
|
+
| `@nestjs/platform-express` | 11.1.19 |
|
|
19
|
+
| `express-session` | 1.18.1 |
|
|
20
|
+
| `express-formidable` | 1.2.0 |
|
|
21
|
+
| `@types/express-session` | 1.18.1 |
|
|
22
|
+
|
|
23
|
+
> **Note:** AdminJS requires the Express HTTP adapter (`@nestjs/platform-express`). The `@adminjs/nestjs` module uses `@adminjs/express` internally, which is incompatible with Fastify. The Express platform package is included automatically by this recipe.
|
|
24
|
+
|
|
25
|
+
## Environment Variables
|
|
26
|
+
|
|
27
|
+
| Variable | Default | Description |
|
|
28
|
+
| ---------------- | ------------------- | -------------------------------- |
|
|
29
|
+
| `ADMIN_EMAIL` | `admin@example.com` | AdminJS login email |
|
|
30
|
+
| `ADMIN_PASSWORD` | _(empty)_ | AdminJS login password (required)|
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
### Registering a TypeORM Entity as a Resource
|
|
35
|
+
|
|
36
|
+
AdminJS uses ORM adapters to introspect your entities and generate CRUD interfaces automatically. Register the adapter once at startup, then add entities to the `resources` array in `AdminModule`.
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import AdminJS from 'adminjs';
|
|
40
|
+
import { Resource, Database } from '@adminjs/typeorm';
|
|
41
|
+
|
|
42
|
+
// Register the TypeORM adapter (do this once, e.g. in main.ts or admin.module.ts)
|
|
43
|
+
AdminJS.registerAdapter({ Resource, Database });
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Then add your entity to the resources array in `admin.module.ts`:
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
resources: [
|
|
50
|
+
{
|
|
51
|
+
resource: UserEntity,
|
|
52
|
+
options: {
|
|
53
|
+
properties: {
|
|
54
|
+
password: { isVisible: false },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### ORM Adapters
|
|
62
|
+
|
|
63
|
+
AdminJS supports multiple ORM adapters. Install the one matching your database layer:
|
|
64
|
+
|
|
65
|
+
| ORM | Adapter Package |
|
|
66
|
+
| --------- | -------------------- |
|
|
67
|
+
| TypeORM | `@adminjs/typeorm` |
|
|
68
|
+
| Prisma | `@adminjs/prisma` |
|
|
69
|
+
| Mongoose | `@adminjs/mongoose` |
|
|
70
|
+
| MikroORM | `@adminjs/mikroorm` |
|
|
71
|
+
| Sequelize | `@adminjs/sequelize` |
|
|
72
|
+
|
|
73
|
+
Each adapter follows the same pattern: install the package, call `AdminJS.registerAdapter()`, and pass your entities/models as resources.
|
|
74
|
+
|
|
75
|
+
## Generated Files
|
|
76
|
+
|
|
77
|
+
| File | Description |
|
|
78
|
+
| --------------------------------------- | ----------------------------------- |
|
|
79
|
+
| `src/app/modules/admin/admin.module.ts` | AdminJS module with auth and config |
|
|
80
|
+
|
|
81
|
+
## Production Considerations
|
|
82
|
+
|
|
83
|
+
- **Change the session secret**: Replace `'secret-session-key-change-in-production'` in `admin.module.ts` with a strong, randomly generated secret stored as an environment variable.
|
|
84
|
+
- **Change admin credentials**: Set `ADMIN_EMAIL` and `ADMIN_PASSWORD` to strong values. Consider integrating with your existing authentication system instead of env-var-based credentials.
|
|
85
|
+
- **Use a session store**: The default in-memory session store is not suitable for production. Use `connect-redis`, `connect-pg-simple`, or another persistent session store.
|
|
86
|
+
|
|
87
|
+
## Customization
|
|
88
|
+
|
|
89
|
+
### Custom Actions
|
|
90
|
+
|
|
91
|
+
Add custom actions to any resource:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
resources: [
|
|
95
|
+
{
|
|
96
|
+
resource: OrderEntity,
|
|
97
|
+
options: {
|
|
98
|
+
actions: {
|
|
99
|
+
approve: {
|
|
100
|
+
actionType: 'record',
|
|
101
|
+
handler: async (request, response, context) => {
|
|
102
|
+
const { record } = context;
|
|
103
|
+
// custom approval logic
|
|
104
|
+
return { record: record.toJSON(), msg: 'Order approved' };
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Custom Components
|
|
114
|
+
|
|
115
|
+
Override default components with React-based custom components:
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
const adminJsOptions = {
|
|
119
|
+
branding: {
|
|
120
|
+
companyName: 'My App',
|
|
121
|
+
logo: '/logo.png',
|
|
122
|
+
},
|
|
123
|
+
dashboard: {
|
|
124
|
+
component: AdminJS.bundle('./components/dashboard'),
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Custom Dashboard
|
|
130
|
+
|
|
131
|
+
Create a custom dashboard by providing a React component:
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
// components/dashboard.tsx
|
|
135
|
+
import React from 'react';
|
|
136
|
+
import { Box, H2 } from '@adminjs/design-system';
|
|
137
|
+
|
|
138
|
+
const Dashboard = () => (
|
|
139
|
+
<Box>
|
|
140
|
+
<H2>Welcome to the Admin Panel</H2>
|
|
141
|
+
</Box>
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
export default Dashboard;
|
|
145
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { AdminModule as AdminJSModule } from '@adminjs/nestjs';
|
|
3
|
+
import AdminJS from 'adminjs';
|
|
4
|
+
|
|
5
|
+
@Module({
|
|
6
|
+
imports: [
|
|
7
|
+
AdminJSModule.createAdminAsync({
|
|
8
|
+
useFactory: () => ({
|
|
9
|
+
adminJsOptions: {
|
|
10
|
+
rootPath: '/admin',
|
|
11
|
+
branding: {
|
|
12
|
+
companyName: 'Admin Panel',
|
|
13
|
+
softwareBrothers: false,
|
|
14
|
+
},
|
|
15
|
+
resources: [
|
|
16
|
+
// Register your entities here:
|
|
17
|
+
// {
|
|
18
|
+
// resource: UserEntity,
|
|
19
|
+
// options: {
|
|
20
|
+
// properties: {
|
|
21
|
+
// password: { isVisible: false },
|
|
22
|
+
// },
|
|
23
|
+
// },
|
|
24
|
+
// },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
auth: {
|
|
28
|
+
authenticate: async (email: string, password: string) => {
|
|
29
|
+
const adminEmail = process.env.ADMIN_EMAIL;
|
|
30
|
+
const adminPassword = process.env.ADMIN_PASSWORD;
|
|
31
|
+
if (!adminEmail) throw new Error('ADMIN_EMAIL environment variable is required');
|
|
32
|
+
if (!adminPassword) throw new Error('ADMIN_PASSWORD environment variable is required');
|
|
33
|
+
|
|
34
|
+
if (email === adminEmail && password === adminPassword) {
|
|
35
|
+
return { email: adminEmail };
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
},
|
|
39
|
+
cookieName: 'adminjs',
|
|
40
|
+
cookiePassword: (() => {
|
|
41
|
+
const secret = process.env.ADMIN_SESSION_SECRET;
|
|
42
|
+
if (!secret) throw new Error('ADMIN_SESSION_SECRET environment variable is required');
|
|
43
|
+
return secret;
|
|
44
|
+
})(),
|
|
45
|
+
},
|
|
46
|
+
sessionOptions: {
|
|
47
|
+
resave: false,
|
|
48
|
+
saveUninitialized: false,
|
|
49
|
+
secret: (() => {
|
|
50
|
+
const secret = process.env.ADMIN_SESSION_SECRET;
|
|
51
|
+
if (!secret) throw new Error('ADMIN_SESSION_SECRET environment variable is required');
|
|
52
|
+
return secret;
|
|
53
|
+
})(),
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
}),
|
|
57
|
+
],
|
|
58
|
+
})
|
|
59
|
+
export class AdminModule {}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AdminModule } from '@/app/modules/admin/admin.module';
|
|
2
|
+
|
|
3
|
+
describe('AdminModule', () => {
|
|
4
|
+
it('should be defined as a class', () => {
|
|
5
|
+
expect(AdminModule).toBeDefined();
|
|
6
|
+
expect(typeof AdminModule).toBe('function');
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('should be instantiable', () => {
|
|
10
|
+
const instance = new AdminModule();
|
|
11
|
+
expect(instance).toBeInstanceOf(AdminModule);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should have Module decorator metadata with imports', () => {
|
|
15
|
+
// Reflect.getMetadata is populated by @Module decorator at class-definition time.
|
|
16
|
+
// 'imports' is stored under the key 'imports' by NestJS.
|
|
17
|
+
const imports = Reflect.getMetadata('imports', AdminModule);
|
|
18
|
+
expect(imports).toBeDefined();
|
|
19
|
+
expect(Array.isArray(imports)).toBe(true);
|
|
20
|
+
expect(imports.length).toBeGreaterThan(0);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# AI Context
|
|
2
|
+
|
|
3
|
+
Project context files for AI coding assistants. These files help AI tools understand the project structure, conventions, and patterns.
|
|
4
|
+
|
|
5
|
+
## Providers
|
|
6
|
+
|
|
7
|
+
| Provider | Description |
|
|
8
|
+
| --------------------- | ------------------------------------------------------------- |
|
|
9
|
+
| [Claude](./claude/) | `CLAUDE.md` project instructions and custom commands |
|
|
10
|
+
| [Cursor](./cursor/) | `.cursor/rules/*.mdc` rule files for context-aware assistance |
|
|
11
|
+
| [Copilot](./copilot/) | `.github/copilot-instructions.md` project guidance |
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
## Package Manager
|
|
4
|
+
|
|
5
|
+
Always use **pnpm**. Never use npm or yarn.
|
|
6
|
+
|
|
7
|
+
## Imports
|
|
8
|
+
|
|
9
|
+
Use the `@/*` alias for all internal imports — it maps to `src/*`.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
// correct
|
|
13
|
+
import { UserService } from '@/users/user.service';
|
|
14
|
+
|
|
15
|
+
// wrong
|
|
16
|
+
import { UserService } from '../../users/user.service';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Code Style
|
|
20
|
+
|
|
21
|
+
Formatting and linting are enforced automatically by lint-staged on commit. Do not run `pnpm lint` or `pnpm format` manually unless explicitly asked.
|
|
22
|
+
|
|
23
|
+
Prettier config (`.prettierrc`): single quotes, semicolons, print width 100, tab width 2, trailing commas, LF line endings.
|
|
24
|
+
|
|
25
|
+
## Branch Naming
|
|
26
|
+
|
|
27
|
+
Format: `{type}/{TICKET_NUMBER}/{description}` or `{type}/{description}`
|
|
28
|
+
|
|
29
|
+
- Allowed types: `feature` `fix` `hotfix` `release` `chore` `docs` `refactor` `test`
|
|
30
|
+
- Description: lowercase, digits, hyphens only — no spaces or underscores
|
|
31
|
+
- Ticket number: optional, uppercase letters + hyphen + digits (e.g. `PROJ-123`)
|
|
32
|
+
- Exempt branches: `main`, `staging`, `production`
|
|
33
|
+
|
|
34
|
+
Examples: `feature/PROJ-123/user-authentication`, `fix/token-refresh`, `chore/update-dependencies`
|
|
35
|
+
|
|
36
|
+
## Commits
|
|
37
|
+
|
|
38
|
+
This project uses [Conventional Commits](https://www.conventionalcommits.org/). commitlint enforces this on every commit.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
<type>(<scope>): <description>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **type**: `feat` `fix` `docs` `style` `refactor` `perf` `test` `build` `ci` `chore` `revert`
|
|
45
|
+
- **scope**: optional, kebab-case (e.g. `auth`, `user-service`)
|
|
46
|
+
- **description**: lowercase, imperative tense, no trailing period, max 100 characters
|
|
47
|
+
|
|
48
|
+
Breaking changes: append `!` after type/scope and add a `BREAKING CHANGE:` footer.
|
|
49
|
+
|
|
50
|
+
## Testing
|
|
51
|
+
|
|
52
|
+
- Tests live in `tests/` at the project root, mirroring the `src/` structure
|
|
53
|
+
- Unit tests: `tests/unit/` — one `.spec.ts` per source file
|
|
54
|
+
- Integration tests: `tests/integration/` — uses Testcontainers, suffix `.integration.spec.ts`
|
|
55
|
+
- E2E tests: `tests/e2e/` — HTTP boundary tests, suffix `.e2e-spec.ts`
|
|
56
|
+
- Test factories: `tests/factories/` — shared test data builders
|
|
57
|
+
- Unit test all service methods — happy path, edge cases, and error paths
|
|
58
|
+
- **Mock only external dependencies** (databases, HTTP clients, third-party SDKs) — never mock code you own
|
|
59
|
+
- Integration tests use a real NestJS testing module with real providers
|
|
60
|
+
- Unit tests and type checking must pass before pushing (`pre-push` hook)
|
|
61
|
+
|
|
62
|
+
## Key Commands
|
|
63
|
+
|
|
64
|
+
| Command | Description |
|
|
65
|
+
| ----------------------- | ------------------------------------------ |
|
|
66
|
+
| `pnpm start:dev` | Start with file watching |
|
|
67
|
+
| `pnpm build` | Compile to `dist/` |
|
|
68
|
+
| `pnpm test` | Run unit tests |
|
|
69
|
+
| `pnpm test:unit` | Run unit tests (explicit) |
|
|
70
|
+
| `pnpm test:integration` | Run integration tests (Testcontainers) |
|
|
71
|
+
| `pnpm test:e2e` | Run end-to-end tests |
|
|
72
|
+
| `pnpm test:all` | Run all test suites |
|
|
73
|
+
| `pnpm test:cov` | Run unit + integration tests with coverage |
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Add CLI Command
|
|
2
|
+
|
|
3
|
+
Scaffold a new CLI command using nest-commander.
|
|
4
|
+
|
|
5
|
+
## Prompt
|
|
6
|
+
|
|
7
|
+
Ask the user for:
|
|
8
|
+
|
|
9
|
+
1. **Command name** (e.g. `sync-users`, `generate-report`)
|
|
10
|
+
2. **Description** — short summary shown in `--help` output
|
|
11
|
+
3. **Options/arguments** — any flags or positional arguments the command accepts
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. **Create the command** at `src/commands/<command-name>.command.ts`:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { Command, CommandRunner, Option } from 'nest-commander';
|
|
19
|
+
|
|
20
|
+
@Command({
|
|
21
|
+
name: 'sync-users',
|
|
22
|
+
description: 'Synchronize users from external source',
|
|
23
|
+
})
|
|
24
|
+
export class SyncUsersCommand extends CommandRunner {
|
|
25
|
+
async run(passedParams: string[]): Promise<void> {
|
|
26
|
+
// command logic
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Option({
|
|
30
|
+
flags: '-d, --dry-run',
|
|
31
|
+
description: 'Preview changes without applying them',
|
|
32
|
+
})
|
|
33
|
+
parseDryRun(val: string): boolean {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
2. **Extract business logic** — if the command does more than orchestration, create a dedicated service (e.g. `src/users/user-sync.service.ts`) and inject it into the command
|
|
40
|
+
|
|
41
|
+
3. **Register in module** — add the command class to the `providers` array of the relevant module (usually `AppModule` or a feature module)
|
|
42
|
+
|
|
43
|
+
4. **Create test stub** at `tests/unit/commands/<command-name>.command.spec.ts`:
|
|
44
|
+
- Use `TestingModule` from `@nestjs/testing`
|
|
45
|
+
- Test the `run()` method with different arguments and options
|
|
46
|
+
- Mock injected services
|
|
47
|
+
|
|
48
|
+
5. **Verify** — run `pnpm build` and `pnpm test`
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Add Message Consumer
|
|
2
|
+
|
|
3
|
+
Scaffold a new message consumer for event-driven or RPC-style messaging.
|
|
4
|
+
|
|
5
|
+
## Prompt
|
|
6
|
+
|
|
7
|
+
Ask the user for:
|
|
8
|
+
|
|
9
|
+
1. **Event or pattern name** (e.g. `order.created`, `user.sync`)
|
|
10
|
+
2. **Pattern type**: `@EventPattern` (fire-and-forget) or `@MessagePattern` (request-reply)
|
|
11
|
+
3. **Transport** if relevant (RabbitMQ, Kafka, Redis, NATS)
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. **Create the handler** at `src/<domain>/<event-name>.handler.ts`:
|
|
16
|
+
|
|
17
|
+
For event patterns (fire-and-forget):
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { Controller } from '@nestjs/common';
|
|
21
|
+
import { EventPattern, Payload } from '@nestjs/microservices';
|
|
22
|
+
|
|
23
|
+
@Controller()
|
|
24
|
+
export class OrderCreatedHandler {
|
|
25
|
+
@EventPattern('order.created')
|
|
26
|
+
async handle(@Payload() data: OrderCreatedEvent): Promise<void> {
|
|
27
|
+
// process event
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
For message patterns (request-reply):
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { Controller } from '@nestjs/common';
|
|
36
|
+
import { MessagePattern, Payload } from '@nestjs/microservices';
|
|
37
|
+
|
|
38
|
+
@Controller()
|
|
39
|
+
export class UserSyncHandler {
|
|
40
|
+
@MessagePattern('user.sync')
|
|
41
|
+
async handle(@Payload() data: UserSyncRequest): Promise<UserSyncResponse> {
|
|
42
|
+
// process and return response
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
2. **Create the event/message DTO** at `src/<domain>/dto/<event-name>.event.ts`:
|
|
48
|
+
- Use class-validator decorators for payload validation
|
|
49
|
+
- Define both the event payload and response type (for MessagePattern)
|
|
50
|
+
|
|
51
|
+
3. **Register in module** — add the handler to the `controllers` array of the domain module
|
|
52
|
+
|
|
53
|
+
4. **Create test stub** at `tests/unit/<domain>/<event-name>.handler.spec.ts`:
|
|
54
|
+
- Test payload processing logic
|
|
55
|
+
- Test error handling paths
|
|
56
|
+
- Mock only external dependencies (database, HTTP clients)
|
|
57
|
+
|
|
58
|
+
5. **Verify** — run `pnpm build` and `pnpm test`
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Add API Endpoint
|
|
2
|
+
|
|
3
|
+
Scaffold a new REST API endpoint with controller, service, DTOs, and tests.
|
|
4
|
+
|
|
5
|
+
## Prompt
|
|
6
|
+
|
|
7
|
+
Ask the user for:
|
|
8
|
+
|
|
9
|
+
1. **Resource name** (singular, e.g. `invoice`)
|
|
10
|
+
2. **HTTP methods** to include (default: CRUD — GET list, GET by ID, POST, PATCH, DELETE)
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
1. **Create the module directory** at `src/<resource>/`
|
|
15
|
+
|
|
16
|
+
2. **Create the DTOs** in `src/<resource>/dto/`:
|
|
17
|
+
- `create-<resource>.dto.ts` — request body for POST
|
|
18
|
+
- `update-<resource>.dto.ts` — request body for PATCH (PartialType of create DTO)
|
|
19
|
+
- `<resource>.response.dto.ts` — response shape
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { IsString, IsNotEmpty } from 'class-validator';
|
|
23
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
24
|
+
|
|
25
|
+
export class CreateInvoiceDto {
|
|
26
|
+
@ApiProperty({ description: 'Invoice number' })
|
|
27
|
+
@IsString()
|
|
28
|
+
@IsNotEmpty()
|
|
29
|
+
number: string;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
3. **Create the service** at `src/<resource>/<resource>.service.ts`:
|
|
34
|
+
- One public method per endpoint
|
|
35
|
+
- Inject repository or data source as needed
|
|
36
|
+
- Keep under 200 lines — extract helpers to separate classes
|
|
37
|
+
|
|
38
|
+
4. **Create the controller** at `src/<resource>/<resource>.controller.ts`:
|
|
39
|
+
- Use `@ApiTags('<resource>')` for Swagger grouping
|
|
40
|
+
- Use `@ApiOperation()` on each method
|
|
41
|
+
- Delegate all logic to the service
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
@ApiTags('invoices')
|
|
45
|
+
@Controller('invoices')
|
|
46
|
+
export class InvoiceController {
|
|
47
|
+
constructor(private readonly invoiceService: InvoiceService) {}
|
|
48
|
+
|
|
49
|
+
@Get()
|
|
50
|
+
@ApiOperation({ summary: 'List all invoices' })
|
|
51
|
+
findAll(): Promise<InvoiceResponseDto[]> {
|
|
52
|
+
return this.invoiceService.findAll();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
5. **Create the module** at `src/<resource>/<resource>.module.ts`:
|
|
58
|
+
- Register the controller and service as providers
|
|
59
|
+
- Export the service if other modules need it
|
|
60
|
+
|
|
61
|
+
6. **Register in parent module** — add the new module to the `imports` array of `AppModule` or the relevant feature module
|
|
62
|
+
|
|
63
|
+
7. **Create test stubs**:
|
|
64
|
+
- `tests/unit/<resource>/<resource>.service.spec.ts`
|
|
65
|
+
- `tests/unit/<resource>/<resource>.controller.spec.ts`
|
|
66
|
+
- Each test file should have `describe` blocks for every public method
|
|
67
|
+
- Include at least: happy path, invalid input, and not-found cases
|
|
68
|
+
|
|
69
|
+
8. **Verify** — run `pnpm build` and `pnpm test` to confirm everything compiles and tests pass
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Add Scheduled Job
|
|
2
|
+
|
|
3
|
+
Scaffold a new scheduled job using `@nestjs/schedule`.
|
|
4
|
+
|
|
5
|
+
## Prompt
|
|
6
|
+
|
|
7
|
+
Ask the user for:
|
|
8
|
+
|
|
9
|
+
1. **Job name** (e.g. `cleanup-expired-tokens`, `sync-inventory`)
|
|
10
|
+
2. **Schedule** — cron expression or a `CronExpression` constant (e.g. `EVERY_HOUR`, `EVERY_DAY_AT_MIDNIGHT`)
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
1. **Create the job** at `src/jobs/<job-name>.job.ts`:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { Injectable, Logger } from '@nestjs/common';
|
|
18
|
+
import { Cron, CronExpression } from '@nestjs/schedule';
|
|
19
|
+
|
|
20
|
+
@Injectable()
|
|
21
|
+
export class CleanupExpiredTokensJob {
|
|
22
|
+
private readonly logger = new Logger(CleanupExpiredTokensJob.name);
|
|
23
|
+
|
|
24
|
+
@Cron(CronExpression.EVERY_DAY_AT_MIDNIGHT)
|
|
25
|
+
async handle(): Promise<void> {
|
|
26
|
+
this.logger.log('Starting cleanup of expired tokens');
|
|
27
|
+
// job logic
|
|
28
|
+
this.logger.log('Cleanup complete');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
2. **Extract business logic** — if the job does more than orchestration, create a dedicated service and inject it. Keep the job class focused on scheduling concerns only.
|
|
34
|
+
|
|
35
|
+
3. **Register in module** — add the job class to the `providers` array of the relevant module. Ensure `ScheduleModule.forRoot()` is imported in `AppModule`.
|
|
36
|
+
|
|
37
|
+
4. **Create test stub** at `tests/unit/jobs/<job-name>.job.spec.ts`:
|
|
38
|
+
- Call the `handle()` method directly — do not test cron scheduling
|
|
39
|
+
- Test success and error paths
|
|
40
|
+
- Mock injected services
|
|
41
|
+
|
|
42
|
+
5. **Verify** — run `pnpm build` and `pnpm test`
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Database Migration
|
|
2
|
+
|
|
3
|
+
Create and run database migrations.
|
|
4
|
+
|
|
5
|
+
## TypeORM
|
|
6
|
+
|
|
7
|
+
### Create a migration
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm typeorm migration:create src/database/migrations/<MigrationName>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Generate a migration from entity changes
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm typeorm migration:generate src/database/migrations/<MigrationName> -d src/database/data-source.ts
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Run pending migrations
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm typeorm migration:run -d src/database/data-source.ts
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Revert the last migration
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm typeorm migration:revert -d src/database/data-source.ts
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Rules
|
|
32
|
+
|
|
33
|
+
- Migration class names use PascalCase with a timestamp prefix (auto-generated)
|
|
34
|
+
- Each migration must implement both `up()` and `down()` methods
|
|
35
|
+
- Never modify a migration that has already been applied in any environment
|
|
36
|
+
- Test both `up` and `down` directions locally before committing
|
|
37
|
+
|
|
38
|
+
## Prisma
|
|
39
|
+
|
|
40
|
+
### Create a migration
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pnpm prisma migrate dev --name <migration-name>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Apply migrations in production
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pnpm prisma migrate deploy
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Reset the database (development only)
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pnpm prisma migrate reset
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Generate Prisma client after schema changes
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pnpm prisma generate
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Rules
|
|
65
|
+
|
|
66
|
+
- Migration names use kebab-case (e.g. `add-user-email-index`)
|
|
67
|
+
- Edit `prisma/schema.prisma` first, then generate the migration
|
|
68
|
+
- Never edit migration SQL files after they have been applied
|
|
69
|
+
- Always run `pnpm prisma generate` after schema changes
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# GitHub Copilot Instructions
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
This is a NestJS application using Fastify, built with TypeScript and managed with pnpm.
|
|
6
|
+
|
|
7
|
+
## Code Conventions
|
|
8
|
+
|
|
9
|
+
### Imports
|
|
10
|
+
|
|
11
|
+
- Use `@/*` path alias for all internal imports (maps to `src/*`)
|
|
12
|
+
- Never use relative paths like `../../`
|
|
13
|
+
|
|
14
|
+
### Architecture
|
|
15
|
+
|
|
16
|
+
- 3-layer architecture: Controller -> Service -> Repository
|
|
17
|
+
- Controllers: HTTP concerns only, delegate to services
|
|
18
|
+
- Services: business logic, max 200 lines, no private methods
|
|
19
|
+
- Extract helpers into separate injectable classes
|
|
20
|
+
|
|
21
|
+
### File Naming
|
|
22
|
+
|
|
23
|
+
- Services: `<name>.service.ts`
|
|
24
|
+
- Controllers: `<name>.controller.ts`
|
|
25
|
+
- Modules: `<name>.module.ts`
|
|
26
|
+
- Entities: `<name>.entity.ts`
|
|
27
|
+
- DTOs: `<name>.dto.ts` inside `dto/` subdirectory
|
|
28
|
+
- Use descriptive suffixes for non-standard classes: `.processor.ts`, `.importer.ts`, `.scheduler.ts`
|
|
29
|
+
|
|
30
|
+
### DTOs and Validation
|
|
31
|
+
|
|
32
|
+
- Use `class-validator` decorators on all request DTOs
|
|
33
|
+
- Use `class-transformer` for response serialization
|
|
34
|
+
- Add `@ApiProperty()` to every DTO property for Swagger
|
|
35
|
+
|
|
36
|
+
### Modules
|
|
37
|
+
|
|
38
|
+
- Organize by feature domain, not by technical layer
|
|
39
|
+
- Each feature gets its own module directory under `src/`
|
|
40
|
+
- Export only what other modules need
|
|
41
|
+
|
|
42
|
+
### Error Handling
|
|
43
|
+
|
|
44
|
+
- Use NestJS built-in exceptions (`NotFoundException`, `BadRequestException`, etc.)
|
|
45
|
+
- Let the global exception filter handle unexpected errors
|
|
46
|
+
- Never catch exceptions just to rethrow them
|
|
47
|
+
|
|
48
|
+
## Testing
|
|
49
|
+
|
|
50
|
+
- Tests live in `tests/` at the project root, mirroring `src/` structure
|
|
51
|
+
- Unit tests: `tests/unit/` with `.spec.ts` suffix
|
|
52
|
+
- Integration tests: `tests/integration/` with `.integration.spec.ts` suffix
|
|
53
|
+
- E2E tests: `tests/e2e/` with `.e2e-spec.ts` suffix
|
|
54
|
+
- Mock only external dependencies — never mock code you own
|
|
55
|
+
- Use `Test.createTestingModule()` from `@nestjs/testing`
|
|
56
|
+
- Test factories go in `tests/factories/`
|
|
57
|
+
|
|
58
|
+
## Commands
|
|
59
|
+
|
|
60
|
+
- `pnpm start:dev` — start with file watching
|
|
61
|
+
- `pnpm build` — compile to `dist/`
|
|
62
|
+
- `pnpm test` — run unit tests
|
|
63
|
+
- `pnpm test:integration` — run integration tests
|
|
64
|
+
- `pnpm test:e2e` — run e2e tests
|
|
65
|
+
- `pnpm test:cov` — run tests with coverage
|
|
66
|
+
|
|
67
|
+
## Commits
|
|
68
|
+
|
|
69
|
+
Use Conventional Commits: `<type>(<scope>): <description>`
|
|
70
|
+
|
|
71
|
+
Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
|