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
package/templates/recipes/dead-letter-queue/tests/unit/infrastructure/queue/dlq.service.spec.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DeadLetterQueueService } from '../../../../src/infrastructure/queue/dlq.service';
|
|
2
|
+
|
|
3
|
+
describe('DeadLetterQueueService', () => {
|
|
4
|
+
let service: DeadLetterQueueService;
|
|
5
|
+
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
service = new DeadLetterQueueService();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should add a message and retrieve it via getAll', () => {
|
|
11
|
+
service.add({ queue: 'orders', payload: { id: 1 }, error: 'timeout', attempts: 3 });
|
|
12
|
+
|
|
13
|
+
const messages = service.getAll();
|
|
14
|
+
|
|
15
|
+
expect(messages).toHaveLength(1);
|
|
16
|
+
expect(messages[0]).toEqual(
|
|
17
|
+
expect.objectContaining({
|
|
18
|
+
queue: 'orders',
|
|
19
|
+
payload: { id: 1 },
|
|
20
|
+
error: 'timeout',
|
|
21
|
+
attempts: 3,
|
|
22
|
+
}),
|
|
23
|
+
);
|
|
24
|
+
expect(messages[0].id).toBeDefined();
|
|
25
|
+
expect(messages[0].failedAt).toBeInstanceOf(Date);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should filter messages by queue name', () => {
|
|
29
|
+
service.add({ queue: 'orders', payload: {}, error: 'fail', attempts: 1 });
|
|
30
|
+
service.add({ queue: 'emails', payload: {}, error: 'fail', attempts: 1 });
|
|
31
|
+
service.add({ queue: 'orders', payload: {}, error: 'retry', attempts: 2 });
|
|
32
|
+
|
|
33
|
+
expect(service.getByQueue('orders')).toHaveLength(2);
|
|
34
|
+
expect(service.getByQueue('emails')).toHaveLength(1);
|
|
35
|
+
expect(service.getByQueue('unknown')).toHaveLength(0);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should remove a message by id and return true, or false if not found', () => {
|
|
39
|
+
service.add({ queue: 'q', payload: {}, error: 'e', attempts: 1 });
|
|
40
|
+
const id = service.getAll()[0].id;
|
|
41
|
+
|
|
42
|
+
expect(service.remove(id)).toBe(true);
|
|
43
|
+
expect(service.getAll()).toHaveLength(0);
|
|
44
|
+
expect(service.remove('nonexistent-id')).toBe(false);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: npm
|
|
4
|
+
directory: /
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
day: monday
|
|
8
|
+
time: '06:00'
|
|
9
|
+
timezone: Europe/Amsterdam
|
|
10
|
+
open-pull-requests-limit: 10
|
|
11
|
+
versioning-strategy: increase
|
|
12
|
+
labels:
|
|
13
|
+
- dependencies
|
|
14
|
+
- automated
|
|
15
|
+
commit-message:
|
|
16
|
+
prefix: 'chore(deps):'
|
|
17
|
+
include: scope
|
|
18
|
+
groups:
|
|
19
|
+
nestjs:
|
|
20
|
+
patterns:
|
|
21
|
+
- '@nestjs/*'
|
|
22
|
+
testing:
|
|
23
|
+
patterns:
|
|
24
|
+
- jest
|
|
25
|
+
- '@types/jest'
|
|
26
|
+
- ts-jest
|
|
27
|
+
linting:
|
|
28
|
+
patterns:
|
|
29
|
+
- eslint
|
|
30
|
+
- '@typescript-eslint/*'
|
|
31
|
+
- prettier
|
|
32
|
+
|
|
33
|
+
- package-ecosystem: github-actions
|
|
34
|
+
directory: /
|
|
35
|
+
schedule:
|
|
36
|
+
interval: weekly
|
|
37
|
+
day: monday
|
|
38
|
+
labels:
|
|
39
|
+
- ci
|
|
40
|
+
- automated
|
|
41
|
+
commit-message:
|
|
42
|
+
prefix: 'ci(deps):'
|
|
43
|
+
|
|
44
|
+
- package-ecosystem: docker
|
|
45
|
+
directory: /
|
|
46
|
+
schedule:
|
|
47
|
+
interval: monthly
|
|
48
|
+
labels:
|
|
49
|
+
- docker
|
|
50
|
+
- automated
|
|
51
|
+
commit-message:
|
|
52
|
+
prefix: 'build(docker):'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Dependabot and Renovate
|
|
2
|
+
|
|
3
|
+
Automated dependency update configurations for GitHub Dependabot and Renovate Bot.
|
|
4
|
+
|
|
5
|
+
## Links
|
|
6
|
+
|
|
7
|
+
- [GitHub Dependabot Documentation](https://docs.github.com/en/code-security/dependabot)
|
|
8
|
+
- [Renovate Documentation](https://docs.renovatebot.com)
|
|
9
|
+
- [Dependabot Configuration Options](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file)
|
|
10
|
+
- [Renovate on GitHub](https://github.com/renovatebot/renovate)
|
|
11
|
+
|
|
12
|
+
## Dependencies
|
|
13
|
+
|
|
14
|
+
No npm dependencies required. Both tools run as GitHub Apps or bots.
|
|
15
|
+
|
|
16
|
+
| Package | Version | Purpose |
|
|
17
|
+
| ------- | ------- | ------------------------ |
|
|
18
|
+
| (none) | - | Configuration files only |
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Dependabot
|
|
23
|
+
|
|
24
|
+
Place `.github/dependabot.yml` in your repository root. Dependabot is built into GitHub and activates automatically.
|
|
25
|
+
|
|
26
|
+
### Renovate
|
|
27
|
+
|
|
28
|
+
Place `renovate.json` in your repository root and install the [Renovate GitHub App](https://github.com/apps/renovate).
|
|
29
|
+
|
|
30
|
+
Choose one tool per project to avoid conflicting PRs.
|
|
31
|
+
|
|
32
|
+
## Generated Files
|
|
33
|
+
|
|
34
|
+
| File | Description |
|
|
35
|
+
| ------------------------ | --------------------------------------- |
|
|
36
|
+
| `.github/dependabot.yml` | Dependabot version update configuration |
|
|
37
|
+
| `renovate.json` | Renovate Bot configuration |
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
+
"extends": [
|
|
4
|
+
"config:recommended",
|
|
5
|
+
":pinAllExceptPeerDependencies",
|
|
6
|
+
":semanticCommits",
|
|
7
|
+
":separateMultipleMajorReleases",
|
|
8
|
+
"group:monorepos",
|
|
9
|
+
"group:recommended"
|
|
10
|
+
],
|
|
11
|
+
"schedule": ["before 7am on Monday"],
|
|
12
|
+
"timezone": "Europe/Amsterdam",
|
|
13
|
+
"labels": ["dependencies", "automated"],
|
|
14
|
+
"rangeStrategy": "pin",
|
|
15
|
+
"lockFileMaintenance": {
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"schedule": ["before 5am on the first day of the month"]
|
|
18
|
+
},
|
|
19
|
+
"packageRules": [
|
|
20
|
+
{
|
|
21
|
+
"groupName": "NestJS",
|
|
22
|
+
"matchPackagePatterns": ["^@nestjs/"],
|
|
23
|
+
"automerge": false
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"groupName": "Testing",
|
|
27
|
+
"matchPackageNames": ["jest", "ts-jest"],
|
|
28
|
+
"matchPackagePatterns": ["^@types/jest"],
|
|
29
|
+
"automerge": true,
|
|
30
|
+
"automergeType": "branch"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"groupName": "Linting",
|
|
34
|
+
"matchPackageNames": ["eslint", "prettier"],
|
|
35
|
+
"matchPackagePatterns": ["^@typescript-eslint/"],
|
|
36
|
+
"automerge": true,
|
|
37
|
+
"automergeType": "branch"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"matchDepTypes": ["devDependencies"],
|
|
41
|
+
"matchUpdateTypes": ["patch"],
|
|
42
|
+
"automerge": true,
|
|
43
|
+
"automergeType": "branch"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Deploy
|
|
2
|
+
|
|
3
|
+
Container and orchestration templates for deploying NestJS applications.
|
|
4
|
+
|
|
5
|
+
## Options
|
|
6
|
+
|
|
7
|
+
| Option | Description |
|
|
8
|
+
| ----------------------------------------------- | --------------------------------------------------------------- |
|
|
9
|
+
| [Dockerfile](./dockerfile/) | Multi-stage production Docker image |
|
|
10
|
+
| [Docker Compose](./docker-compose/) | Full-stack local/production setup with Postgres and Redis |
|
|
11
|
+
| [Kubernetes](./kubernetes/) | Kubernetes manifests with Deployment, Service, Ingress, and HPA |
|
|
12
|
+
| [Serverless Framework](./serverless-framework/) | AWS Lambda deployment using Serverless Framework |
|
|
13
|
+
| [Terraform](./terraform/) | Modular Terraform setup with AWS ECS Fargate module |
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Docker Compose
|
|
2
|
+
|
|
3
|
+
Full-stack Docker Compose setup with the NestJS application, Postgres, and Redis.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
- [Docker Compose](https://docs.docker.com/compose/)
|
|
8
|
+
- [Compose file reference](https://docs.docker.com/compose/compose-file/)
|
|
9
|
+
|
|
10
|
+
## Generated Files
|
|
11
|
+
|
|
12
|
+
| File | Description |
|
|
13
|
+
| -------------------- | ------------------------------------------------ |
|
|
14
|
+
| `docker-compose.yml` | Service definitions for app, Postgres, and Redis |
|
|
15
|
+
|
|
16
|
+
## Services
|
|
17
|
+
|
|
18
|
+
| Service | Image | Port | Description |
|
|
19
|
+
| ---------- | --------------------- | ---- | ------------------------------------- |
|
|
20
|
+
| `app` | Built from Dockerfile | 3000 | NestJS application |
|
|
21
|
+
| `postgres` | `postgres:16-alpine` | 5432 | PostgreSQL database with health check |
|
|
22
|
+
| `redis` | `redis:7-alpine` | 6379 | Redis cache with health check |
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Start all services
|
|
28
|
+
docker compose up -d
|
|
29
|
+
|
|
30
|
+
# View logs
|
|
31
|
+
docker compose logs -f app
|
|
32
|
+
|
|
33
|
+
# Stop all services
|
|
34
|
+
docker compose down
|
|
35
|
+
|
|
36
|
+
# Stop and remove volumes
|
|
37
|
+
docker compose down -v
|
|
38
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
version: '3.8'
|
|
2
|
+
|
|
3
|
+
services:
|
|
4
|
+
app:
|
|
5
|
+
build: .
|
|
6
|
+
ports:
|
|
7
|
+
- '${PORT:-3000}:3000'
|
|
8
|
+
env_file:
|
|
9
|
+
- .env
|
|
10
|
+
depends_on:
|
|
11
|
+
postgres:
|
|
12
|
+
condition: service_healthy
|
|
13
|
+
redis:
|
|
14
|
+
condition: service_healthy
|
|
15
|
+
|
|
16
|
+
postgres:
|
|
17
|
+
image: postgres:16-alpine
|
|
18
|
+
ports:
|
|
19
|
+
- '5432:5432'
|
|
20
|
+
environment:
|
|
21
|
+
POSTGRES_USER: ${DB_USER:-app}
|
|
22
|
+
POSTGRES_PASSWORD: ${DB_PASSWORD:-password}
|
|
23
|
+
POSTGRES_DB: ${DB_NAME:-app}
|
|
24
|
+
volumes:
|
|
25
|
+
- postgres_data:/var/lib/postgresql/data
|
|
26
|
+
healthcheck:
|
|
27
|
+
test: ['CMD-SHELL', 'pg_isready -U ${DB_USER:-app}']
|
|
28
|
+
interval: 5s
|
|
29
|
+
timeout: 5s
|
|
30
|
+
retries: 5
|
|
31
|
+
|
|
32
|
+
redis:
|
|
33
|
+
image: redis:7-alpine
|
|
34
|
+
ports:
|
|
35
|
+
- '6379:6379'
|
|
36
|
+
healthcheck:
|
|
37
|
+
test: ['CMD', 'redis-cli', 'ping']
|
|
38
|
+
interval: 5s
|
|
39
|
+
timeout: 5s
|
|
40
|
+
retries: 5
|
|
41
|
+
|
|
42
|
+
volumes:
|
|
43
|
+
postgres_data:
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Build stage
|
|
2
|
+
FROM node:22-alpine AS builder
|
|
3
|
+
|
|
4
|
+
RUN corepack enable && corepack prepare pnpm@10 --activate
|
|
5
|
+
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
|
|
8
|
+
COPY package.json pnpm-lock.yaml ./
|
|
9
|
+
RUN pnpm install --frozen-lockfile
|
|
10
|
+
|
|
11
|
+
COPY . .
|
|
12
|
+
RUN pnpm build
|
|
13
|
+
RUN pnpm prune --prod
|
|
14
|
+
|
|
15
|
+
# Production stage
|
|
16
|
+
FROM node:22-alpine
|
|
17
|
+
|
|
18
|
+
RUN apk add --no-cache dumb-init
|
|
19
|
+
|
|
20
|
+
WORKDIR /app
|
|
21
|
+
|
|
22
|
+
COPY --from=builder /app/dist ./dist
|
|
23
|
+
COPY --from=builder /app/node_modules ./node_modules
|
|
24
|
+
COPY --from=builder /app/package.json ./
|
|
25
|
+
|
|
26
|
+
USER node
|
|
27
|
+
|
|
28
|
+
EXPOSE 3000
|
|
29
|
+
|
|
30
|
+
CMD ["dumb-init", "node", "dist/main.js"]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Dockerfile
|
|
2
|
+
|
|
3
|
+
Multi-stage production Docker image for NestJS applications.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
- [Dockerfile reference](https://docs.docker.com/reference/dockerfile/)
|
|
8
|
+
- [Docker multi-stage builds](https://docs.docker.com/build/building/multi-stage/)
|
|
9
|
+
|
|
10
|
+
## Generated Files
|
|
11
|
+
|
|
12
|
+
| File | Description |
|
|
13
|
+
| --------------- | ------------------------------------------------- |
|
|
14
|
+
| `Dockerfile` | Multi-stage build (builder + production) |
|
|
15
|
+
| `.dockerignore` | Excludes unnecessary files from the build context |
|
|
16
|
+
|
|
17
|
+
## Build Stages
|
|
18
|
+
|
|
19
|
+
1. **builder** -- installs dependencies with `pnpm install --frozen-lockfile`, copies source, runs `pnpm build`, then prunes dev dependencies
|
|
20
|
+
2. **production** -- minimal `node:22-alpine` image with `dumb-init`, copies `dist/`, production `node_modules/`, and `package.json`; runs as the `node` user on port 3000
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Build the image
|
|
26
|
+
docker build -t my-app .
|
|
27
|
+
|
|
28
|
+
# Run the container
|
|
29
|
+
docker run -p 3000:3000 --env-file .env my-app
|
|
30
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Kubernetes Deployment
|
|
2
|
+
|
|
3
|
+
Kubernetes manifests for deploying the NestJS application.
|
|
4
|
+
|
|
5
|
+
## Links
|
|
6
|
+
|
|
7
|
+
- [Kubernetes Documentation](https://kubernetes.io/docs/)
|
|
8
|
+
- [kubectl Reference](https://kubernetes.io/docs/reference/kubectl/)
|
|
9
|
+
|
|
10
|
+
## Manifests
|
|
11
|
+
|
|
12
|
+
| File | Description |
|
|
13
|
+
| --------------------- | ------------------------------------------ |
|
|
14
|
+
| `k8s/deployment.yaml` | App Deployment (2 replicas, health probes) |
|
|
15
|
+
| `k8s/service.yaml` | ClusterIP Service (port 80 -> 3000) |
|
|
16
|
+
| `k8s/configmap.yaml` | Environment configuration |
|
|
17
|
+
| `k8s/ingress.yaml` | Ingress with TLS |
|
|
18
|
+
| `k8s/hpa.yaml` | HorizontalPodAutoscaler (2-10 replicas) |
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Apply all manifests
|
|
24
|
+
kubectl apply -f k8s/
|
|
25
|
+
|
|
26
|
+
# Check status
|
|
27
|
+
kubectl get pods -l app=app
|
|
28
|
+
kubectl get svc app
|
|
29
|
+
kubectl get ingress app
|
|
30
|
+
|
|
31
|
+
# View logs
|
|
32
|
+
kubectl logs -l app=app -f
|
|
33
|
+
|
|
34
|
+
# Scale manually
|
|
35
|
+
kubectl scale deployment app --replicas=3
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Configuration
|
|
39
|
+
|
|
40
|
+
1. Replace `REGISTRY/IMAGE:TAG` in deployment.yaml with your container registry
|
|
41
|
+
2. Create the `app-secrets` Secret with sensitive env vars
|
|
42
|
+
3. Update `app.example.com` in ingress.yaml with your domain
|
|
43
|
+
4. Update TLS secret name if using cert-manager
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: app
|
|
5
|
+
labels:
|
|
6
|
+
app: app
|
|
7
|
+
spec:
|
|
8
|
+
replicas: 2
|
|
9
|
+
selector:
|
|
10
|
+
matchLabels:
|
|
11
|
+
app: app
|
|
12
|
+
template:
|
|
13
|
+
metadata:
|
|
14
|
+
labels:
|
|
15
|
+
app: app
|
|
16
|
+
spec:
|
|
17
|
+
containers:
|
|
18
|
+
- name: app
|
|
19
|
+
image: REGISTRY/IMAGE:TAG
|
|
20
|
+
ports:
|
|
21
|
+
- containerPort: 3000
|
|
22
|
+
envFrom:
|
|
23
|
+
- configMapRef:
|
|
24
|
+
name: app-config
|
|
25
|
+
- secretRef:
|
|
26
|
+
name: app-secrets
|
|
27
|
+
resources:
|
|
28
|
+
requests:
|
|
29
|
+
memory: '128Mi'
|
|
30
|
+
cpu: '100m'
|
|
31
|
+
limits:
|
|
32
|
+
memory: '256Mi'
|
|
33
|
+
cpu: '250m'
|
|
34
|
+
livenessProbe:
|
|
35
|
+
httpGet:
|
|
36
|
+
path: /health
|
|
37
|
+
port: 3000
|
|
38
|
+
initialDelaySeconds: 15
|
|
39
|
+
periodSeconds: 10
|
|
40
|
+
readinessProbe:
|
|
41
|
+
httpGet:
|
|
42
|
+
path: /health
|
|
43
|
+
port: 3000
|
|
44
|
+
initialDelaySeconds: 5
|
|
45
|
+
periodSeconds: 5
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
apiVersion: autoscaling/v2
|
|
2
|
+
kind: HorizontalPodAutoscaler
|
|
3
|
+
metadata:
|
|
4
|
+
name: app
|
|
5
|
+
spec:
|
|
6
|
+
scaleTargetRef:
|
|
7
|
+
apiVersion: apps/v1
|
|
8
|
+
kind: Deployment
|
|
9
|
+
name: app
|
|
10
|
+
minReplicas: 2
|
|
11
|
+
maxReplicas: 10
|
|
12
|
+
metrics:
|
|
13
|
+
- type: Resource
|
|
14
|
+
resource:
|
|
15
|
+
name: cpu
|
|
16
|
+
target:
|
|
17
|
+
type: Utilization
|
|
18
|
+
averageUtilization: 80
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
apiVersion: networking.k8s.io/v1
|
|
2
|
+
kind: Ingress
|
|
3
|
+
metadata:
|
|
4
|
+
name: app
|
|
5
|
+
annotations:
|
|
6
|
+
nginx.ingress.kubernetes.io/rewrite-target: /
|
|
7
|
+
spec:
|
|
8
|
+
ingressClassName: nginx
|
|
9
|
+
tls:
|
|
10
|
+
- hosts:
|
|
11
|
+
- app.example.com
|
|
12
|
+
secretName: app-tls
|
|
13
|
+
rules:
|
|
14
|
+
- host: app.example.com
|
|
15
|
+
http:
|
|
16
|
+
paths:
|
|
17
|
+
- path: /
|
|
18
|
+
pathType: Prefix
|
|
19
|
+
backend:
|
|
20
|
+
service:
|
|
21
|
+
name: app
|
|
22
|
+
port:
|
|
23
|
+
number: 80
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Serverless Framework
|
|
2
|
+
|
|
3
|
+
Deploy the NestJS application as an AWS Lambda function using Serverless Framework.
|
|
4
|
+
|
|
5
|
+
## Links
|
|
6
|
+
|
|
7
|
+
- [Serverless Framework Docs](https://www.serverless.com/framework/docs/)
|
|
8
|
+
- [serverless-offline Plugin](https://www.npmjs.com/package/serverless-offline)
|
|
9
|
+
|
|
10
|
+
## Dependencies
|
|
11
|
+
|
|
12
|
+
| Package | Version | Purpose |
|
|
13
|
+
| -------------------- | ------- | ---------------------- |
|
|
14
|
+
| `serverless` | CLI | Deployment framework |
|
|
15
|
+
| `serverless-offline` | dev | Local Lambda emulation |
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Install Serverless CLI
|
|
21
|
+
npm install -g serverless
|
|
22
|
+
|
|
23
|
+
# Local development
|
|
24
|
+
pnpm add -D -E serverless-offline
|
|
25
|
+
serverless offline
|
|
26
|
+
|
|
27
|
+
# Deploy to AWS
|
|
28
|
+
serverless deploy --stage dev
|
|
29
|
+
serverless deploy --stage production
|
|
30
|
+
|
|
31
|
+
# Remove deployment
|
|
32
|
+
serverless remove --stage dev
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Generated Files
|
|
36
|
+
|
|
37
|
+
| File | Description |
|
|
38
|
+
| ---------------- | ---------------------------------- |
|
|
39
|
+
| `serverless.yml` | Serverless Framework configuration |
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
service: <%= name %>
|
|
2
|
+
|
|
3
|
+
frameworkVersion: '4'
|
|
4
|
+
|
|
5
|
+
provider:
|
|
6
|
+
name: aws
|
|
7
|
+
runtime: nodejs22.x
|
|
8
|
+
stage: ${opt:stage, 'dev'}
|
|
9
|
+
region: ${opt:region, 'eu-west-1'}
|
|
10
|
+
memorySize: 256
|
|
11
|
+
timeout: 30
|
|
12
|
+
environment:
|
|
13
|
+
NODE_ENV: ${self:provider.stage}
|
|
14
|
+
|
|
15
|
+
functions:
|
|
16
|
+
api:
|
|
17
|
+
handler: dist/main.handler
|
|
18
|
+
events:
|
|
19
|
+
- httpApi: '*'
|
|
20
|
+
|
|
21
|
+
plugins:
|
|
22
|
+
- serverless-offline
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Terraform
|
|
2
|
+
|
|
3
|
+
Modular Terraform setup for deploying a NestJS application to AWS using ECS Fargate.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
The root configuration is provider-agnostic and delegates to provider-specific modules:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
terraform/
|
|
11
|
+
├── main.tf.ejs # Root config with S3 backend (templated)
|
|
12
|
+
├── variables.tf # Root-level variables
|
|
13
|
+
├── outputs.tf # Root-level outputs
|
|
14
|
+
└── modules/
|
|
15
|
+
└── app/ # AWS ECS Fargate module
|
|
16
|
+
├── main.tf # ECS cluster, task definition, service
|
|
17
|
+
├── variables.tf # Module variables
|
|
18
|
+
├── outputs.tf # Module outputs
|
|
19
|
+
├── iam.tf # IAM roles for ECS execution and task
|
|
20
|
+
├── alb.tf # Application Load Balancer
|
|
21
|
+
└── security.tf # Security groups
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Prerequisites
|
|
25
|
+
|
|
26
|
+
- [Terraform](https://developer.hashicorp.com/terraform/install) >= 1.5
|
|
27
|
+
- AWS credentials configured (`aws configure` or environment variables)
|
|
28
|
+
- An S3 bucket for Terraform state storage
|
|
29
|
+
- A VPC with private subnets
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
### Initialize
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
terraform init \
|
|
37
|
+
-backend-config="bucket=my-terraform-state" \
|
|
38
|
+
-backend-config="key=my-app/terraform.tfstate" \
|
|
39
|
+
-backend-config="region=eu-west-1"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Plan
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
terraform plan -var="environment=dev"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Apply
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
terraform apply -var="environment=dev"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Destroy
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
terraform destroy -var="environment=dev"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Variables
|
|
61
|
+
|
|
62
|
+
| Variable | Type | Default | Description |
|
|
63
|
+
| ------------- | ------ | ----------- | ------------------------------------------------- |
|
|
64
|
+
| `environment` | string | `dev` | Deployment environment (dev, staging, production) |
|
|
65
|
+
| `region` | string | `eu-west-1` | AWS region |
|
|
66
|
+
|
|
67
|
+
### Module Variables (`modules/app`)
|
|
68
|
+
|
|
69
|
+
| Variable | Type | Default | Description |
|
|
70
|
+
| -------------------- | ------------ | ----------------------- | -------------------------- |
|
|
71
|
+
| `app_name` | string | - | Application name |
|
|
72
|
+
| `environment` | string | - | Deployment environment |
|
|
73
|
+
| `region` | string | `eu-west-1` | AWS region |
|
|
74
|
+
| `container_image` | string | `REGISTRY/IMAGE:latest` | Docker image URI |
|
|
75
|
+
| `cpu` | number | `256` | Fargate task CPU units |
|
|
76
|
+
| `memory` | number | `512` | Fargate task memory (MB) |
|
|
77
|
+
| `desired_count` | number | `2` | Number of running tasks |
|
|
78
|
+
| `private_subnet_ids` | list(string) | `[]` | Subnet IDs for ECS tasks |
|
|
79
|
+
| `vpc_id` | string | `""` | VPC ID for security groups |
|
|
80
|
+
|
|
81
|
+
## Modules
|
|
82
|
+
|
|
83
|
+
### `modules/app`
|
|
84
|
+
|
|
85
|
+
Deploys the NestJS application on AWS ECS Fargate with:
|
|
86
|
+
|
|
87
|
+
- **ECS Cluster** with Container Insights enabled
|
|
88
|
+
- **Fargate Task Definition** with health checks and CloudWatch logging
|
|
89
|
+
- **ECS Service** behind an Application Load Balancer
|
|
90
|
+
- **ALB** with HTTPS listener and health-check-based target group
|
|
91
|
+
- **IAM Roles** for ECS task execution and runtime permissions
|
|
92
|
+
- **Security Groups** restricting traffic between ALB and containers
|
|
93
|
+
|
|
94
|
+
## References
|
|
95
|
+
|
|
96
|
+
- [Terraform Documentation](https://developer.hashicorp.com/terraform/docs)
|
|
97
|
+
- [AWS Provider Documentation](https://registry.terraform.io/providers/hashicorp/aws/latest/docs)
|
|
98
|
+
- [ECS Fargate](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service)
|
|
99
|
+
- [Application Load Balancer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb)
|