nestforge-generator 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 +371 -0
- package/README.pt-BR.md +370 -0
- package/dist/features/auth-strategy.js +19 -0
- package/dist/features/auth-strategy.js.map +1 -0
- package/dist/features/database.js +59 -0
- package/dist/features/database.js.map +1 -0
- package/dist/features/dependencies.js +57 -0
- package/dist/features/dependencies.js.map +1 -0
- package/dist/features/language.js +172 -0
- package/dist/features/language.js.map +1 -0
- package/dist/features/markers.js +116 -0
- package/dist/features/markers.js.map +1 -0
- package/dist/generator.js +120 -0
- package/dist/generator.js.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts.js +137 -0
- package/dist/prompts.js.map +1 -0
- package/package.json +76 -0
- package/templates/drizzle/.env.example +45 -0
- package/templates/drizzle/.env.test +38 -0
- package/templates/drizzle/.github/workflows/ci.yml +119 -0
- package/templates/drizzle/ARCHITECTURE.md +227 -0
- package/templates/drizzle/ARCHITECTURE.pt-BR.md +225 -0
- package/templates/drizzle/CODE_OF_CONDUCT.md +29 -0
- package/templates/drizzle/CODE_OF_CONDUCT.pt-BR.md +27 -0
- package/templates/drizzle/CONTRIBUTING.md +57 -0
- package/templates/drizzle/CONTRIBUTING.pt-BR.md +54 -0
- package/templates/drizzle/Dockerfile +43 -0
- package/templates/drizzle/LICENSE +21 -0
- package/templates/drizzle/README.md +257 -0
- package/templates/drizzle/README.pt-BR.md +257 -0
- package/templates/drizzle/ROADMAP.md +143 -0
- package/templates/drizzle/ROADMAP.pt-BR.md +143 -0
- package/templates/drizzle/TESTING.md +136 -0
- package/templates/drizzle/TESTING.pt-BR.md +136 -0
- package/templates/drizzle/docker-compose.yml +82 -0
- package/templates/drizzle/docs/adding-a-module.md +585 -0
- package/templates/drizzle/docs/features-markers.md +457 -0
- package/templates/drizzle/drizzle.config.ts +49 -0
- package/templates/drizzle/nest-cli.json +8 -0
- package/templates/drizzle/package.json +96 -0
- package/templates/drizzle/src/app.module.ts +72 -0
- package/templates/drizzle/src/auth/auth.controller.ts +283 -0
- package/templates/drizzle/src/auth/auth.module.ts +81 -0
- package/templates/drizzle/src/auth/auth.service.spec.ts +111 -0
- package/templates/drizzle/src/auth/auth.service.ts +631 -0
- package/templates/drizzle/src/auth/drizzle-session.store.ts +263 -0
- package/templates/drizzle/src/auth/dto/forgot-password.dto.ts +9 -0
- package/templates/drizzle/src/auth/dto/login.dto.ts +10 -0
- package/templates/drizzle/src/auth/dto/refresh-token.dto.ts +9 -0
- package/templates/drizzle/src/auth/dto/register.dto.ts +11 -0
- package/templates/drizzle/src/auth/dto/reset-password.dto.ts +10 -0
- package/templates/drizzle/src/auth/guards/github-auth.guard.ts +10 -0
- package/templates/drizzle/src/auth/guards/google-auth.guard.ts +10 -0
- package/templates/drizzle/src/auth/guards/jwt-auth.guard.ts +25 -0
- package/templates/drizzle/src/auth/guards/session-auth.guard.spec.ts +77 -0
- package/templates/drizzle/src/auth/guards/session-auth.guard.ts +37 -0
- package/templates/drizzle/src/auth/session.service.spec.ts +74 -0
- package/templates/drizzle/src/auth/session.service.ts +96 -0
- package/templates/drizzle/src/auth/strategies/github.strategy.ts +41 -0
- package/templates/drizzle/src/auth/strategies/google.strategy.ts +43 -0
- package/templates/drizzle/src/auth/strategies/jwt.strategy.ts +25 -0
- package/templates/drizzle/src/auth/token.service.ts +175 -0
- package/templates/drizzle/src/common/constants/permissions.ts +8 -0
- package/templates/drizzle/src/common/constants/role-permissions.ts +9 -0
- package/templates/drizzle/src/common/constants/role.enum.ts +5 -0
- package/templates/drizzle/src/common/decorators/current-user.decorator.ts +8 -0
- package/templates/drizzle/src/common/decorators/permissions.decorator.ts +7 -0
- package/templates/drizzle/src/common/decorators/public.decorator.ts +4 -0
- package/templates/drizzle/src/common/decorators/roles.decorator.ts +6 -0
- package/templates/drizzle/src/common/filters/http-exception.filter.ts +34 -0
- package/templates/drizzle/src/common/guards/permissions.guard.spec.ts +54 -0
- package/templates/drizzle/src/common/guards/permissions.guard.ts +28 -0
- package/templates/drizzle/src/common/guards/roles.guard.spec.ts +37 -0
- package/templates/drizzle/src/common/guards/roles.guard.ts +24 -0
- package/templates/drizzle/src/common/interceptors/logging.interceptor.ts +23 -0
- package/templates/drizzle/src/common/middleware/csrf.middleware.spec.ts +97 -0
- package/templates/drizzle/src/common/middleware/csrf.middleware.ts +46 -0
- package/templates/drizzle/src/common/utils/avatar-storage.util.ts +32 -0
- package/templates/drizzle/src/common/utils/hash.util.ts +5 -0
- package/templates/drizzle/src/config/env.validation.ts +50 -0
- package/templates/drizzle/src/database/database-lifecycle.service.ts +30 -0
- package/templates/drizzle/src/database/database.constants.ts +2 -0
- package/templates/drizzle/src/database/database.decorators.ts +5 -0
- package/templates/drizzle/src/database/database.module.ts +96 -0
- package/templates/drizzle/src/database/database.types.ts +28 -0
- package/templates/drizzle/src/database/schema/index.ts +11 -0
- package/templates/drizzle/src/database/schema/mysql.schema.ts +215 -0
- package/templates/drizzle/src/database/schema/postgres.schema.ts +218 -0
- package/templates/drizzle/src/database/schema/sqlite.schema.ts +190 -0
- package/templates/drizzle/src/database/seed.ts +152 -0
- package/templates/drizzle/src/health/health.controller.ts +49 -0
- package/templates/drizzle/src/health/health.module.ts +19 -0
- package/templates/drizzle/src/health/indicators/drizzle-health.indicator.spec.ts +71 -0
- package/templates/drizzle/src/health/indicators/drizzle-health.indicator.ts +52 -0
- package/templates/drizzle/src/health/indicators/redis-health.indicator.spec.ts +54 -0
- package/templates/drizzle/src/health/indicators/redis-health.indicator.ts +33 -0
- package/templates/drizzle/src/mail/mail.module.ts +12 -0
- package/templates/drizzle/src/mail/mail.processor.ts +48 -0
- package/templates/drizzle/src/mail/mail.service.ts +24 -0
- package/templates/drizzle/src/mail/templates/email-templates.ts +28 -0
- package/templates/drizzle/src/main.ts +145 -0
- package/templates/drizzle/src/metrics/metrics.controller.ts +22 -0
- package/templates/drizzle/src/metrics/metrics.interceptor.ts +30 -0
- package/templates/drizzle/src/metrics/metrics.module.ts +12 -0
- package/templates/drizzle/src/metrics/metrics.service.ts +34 -0
- package/templates/drizzle/src/types/express-session.d.ts +13 -0
- package/templates/drizzle/src/users/dto/create-user.dto.ts +12 -0
- package/templates/drizzle/src/users/dto/find-users-query.dto.ts +12 -0
- package/templates/drizzle/src/users/dto/update-user.dto.ts +6 -0
- package/templates/drizzle/src/users/entities/user.entity.ts +23 -0
- package/templates/drizzle/src/users/users.controller.ts +165 -0
- package/templates/drizzle/src/users/users.module.ts +10 -0
- package/templates/drizzle/src/users/users.service.spec.ts +301 -0
- package/templates/drizzle/src/users/users.service.ts +213 -0
- package/templates/drizzle/test/auth.e2e-spec.ts +114 -0
- package/templates/drizzle/test/session-auth.e2e-spec.ts +163 -0
- package/templates/drizzle/test/users.e2e-spec.ts +212 -0
- package/templates/drizzle/test/utils/clean-database.ts +104 -0
- package/templates/drizzle/test/utils/e2e-setup.ts +77 -0
- package/templates/drizzle/tsconfig.build.json +4 -0
- package/templates/drizzle/tsconfig.json +25 -0
- package/templates/drizzle/vitest.config.ts +20 -0
- package/templates/drizzle/vitest.e2e.config.ts +19 -0
- package/templates/prisma/.env.example +44 -0
- package/templates/prisma/.env.test +37 -0
- package/templates/prisma/.github/workflows/ci.yml +109 -0
- package/templates/prisma/ARCHITECTURE.md +70 -0
- package/templates/prisma/ARCHITECTURE.pt-BR.md +63 -0
- package/templates/prisma/CODE_OF_CONDUCT.md +29 -0
- package/templates/prisma/CODE_OF_CONDUCT.pt-BR.md +27 -0
- package/templates/prisma/CONTRIBUTING.md +57 -0
- package/templates/prisma/CONTRIBUTING.pt-BR.md +54 -0
- package/templates/prisma/Dockerfile +33 -0
- package/templates/prisma/LICENSE +21 -0
- package/templates/prisma/README.md +267 -0
- package/templates/prisma/README.pt-BR.md +267 -0
- package/templates/prisma/ROADMAP.md +75 -0
- package/templates/prisma/ROADMAP.pt-BR.md +65 -0
- package/templates/prisma/TESTING.md +123 -0
- package/templates/prisma/TESTING.pt-BR.md +123 -0
- package/templates/prisma/docker-compose.yml +78 -0
- package/templates/prisma/docs/adding-a-module.md +230 -0
- package/templates/prisma/docs/features-markers.md +50 -0
- package/templates/prisma/nest-cli.json +8 -0
- package/templates/prisma/package.json +95 -0
- package/templates/prisma/prisma/schema.prisma +105 -0
- package/templates/prisma/prisma/seed.ts +46 -0
- package/templates/prisma/src/app.module.ts +72 -0
- package/templates/prisma/src/auth/auth.controller.ts +283 -0
- package/templates/prisma/src/auth/auth.module.ts +59 -0
- package/templates/prisma/src/auth/auth.service.spec.ts +53 -0
- package/templates/prisma/src/auth/auth.service.ts +224 -0
- package/templates/prisma/src/auth/dto/forgot-password.dto.ts +9 -0
- package/templates/prisma/src/auth/dto/login.dto.ts +10 -0
- package/templates/prisma/src/auth/dto/refresh-token.dto.ts +9 -0
- package/templates/prisma/src/auth/dto/register.dto.ts +11 -0
- package/templates/prisma/src/auth/dto/reset-password.dto.ts +10 -0
- package/templates/prisma/src/auth/guards/github-auth.guard.ts +10 -0
- package/templates/prisma/src/auth/guards/google-auth.guard.ts +10 -0
- package/templates/prisma/src/auth/guards/jwt-auth.guard.ts +25 -0
- package/templates/prisma/src/auth/guards/session-auth.guard.spec.ts +77 -0
- package/templates/prisma/src/auth/guards/session-auth.guard.ts +37 -0
- package/templates/prisma/src/auth/session.service.spec.ts +74 -0
- package/templates/prisma/src/auth/session.service.ts +96 -0
- package/templates/prisma/src/auth/strategies/github.strategy.ts +41 -0
- package/templates/prisma/src/auth/strategies/google.strategy.ts +43 -0
- package/templates/prisma/src/auth/strategies/jwt.strategy.ts +25 -0
- package/templates/prisma/src/auth/token.service.ts +84 -0
- package/templates/prisma/src/common/constants/permissions.ts +8 -0
- package/templates/prisma/src/common/constants/role-permissions.ts +9 -0
- package/templates/prisma/src/common/decorators/current-user.decorator.ts +8 -0
- package/templates/prisma/src/common/decorators/permissions.decorator.ts +7 -0
- package/templates/prisma/src/common/decorators/public.decorator.ts +4 -0
- package/templates/prisma/src/common/decorators/roles.decorator.ts +6 -0
- package/templates/prisma/src/common/filters/http-exception.filter.ts +34 -0
- package/templates/prisma/src/common/guards/permissions.guard.spec.ts +54 -0
- package/templates/prisma/src/common/guards/permissions.guard.ts +28 -0
- package/templates/prisma/src/common/guards/roles.guard.spec.ts +37 -0
- package/templates/prisma/src/common/guards/roles.guard.ts +24 -0
- package/templates/prisma/src/common/interceptors/logging.interceptor.ts +23 -0
- package/templates/prisma/src/common/middleware/csrf.middleware.spec.ts +97 -0
- package/templates/prisma/src/common/middleware/csrf.middleware.ts +46 -0
- package/templates/prisma/src/common/utils/avatar-storage.util.ts +32 -0
- package/templates/prisma/src/common/utils/hash.util.ts +5 -0
- package/templates/prisma/src/config/env.validation.ts +49 -0
- package/templates/prisma/src/database/prisma.module.ts +9 -0
- package/templates/prisma/src/database/prisma.service.ts +13 -0
- package/templates/prisma/src/health/health.controller.ts +49 -0
- package/templates/prisma/src/health/health.module.ts +19 -0
- package/templates/prisma/src/health/indicators/prisma-health.indicator.spec.ts +22 -0
- package/templates/prisma/src/health/indicators/prisma-health.indicator.ts +19 -0
- package/templates/prisma/src/health/indicators/redis-health.indicator.spec.ts +54 -0
- package/templates/prisma/src/health/indicators/redis-health.indicator.ts +33 -0
- package/templates/prisma/src/mail/mail.module.ts +12 -0
- package/templates/prisma/src/mail/mail.processor.ts +48 -0
- package/templates/prisma/src/mail/mail.service.ts +24 -0
- package/templates/prisma/src/mail/templates/email-templates.ts +28 -0
- package/templates/prisma/src/main.ts +92 -0
- package/templates/prisma/src/metrics/metrics.controller.ts +22 -0
- package/templates/prisma/src/metrics/metrics.interceptor.ts +30 -0
- package/templates/prisma/src/metrics/metrics.module.ts +12 -0
- package/templates/prisma/src/metrics/metrics.service.ts +34 -0
- package/templates/prisma/src/types/express-session.d.ts +13 -0
- package/templates/prisma/src/users/dto/create-user.dto.ts +12 -0
- package/templates/prisma/src/users/dto/find-users-query.dto.ts +12 -0
- package/templates/prisma/src/users/dto/update-user.dto.ts +6 -0
- package/templates/prisma/src/users/entities/user.entity.ts +20 -0
- package/templates/prisma/src/users/users.controller.ts +165 -0
- package/templates/prisma/src/users/users.module.ts +10 -0
- package/templates/prisma/src/users/users.service.spec.ts +104 -0
- package/templates/prisma/src/users/users.service.ts +114 -0
- package/templates/prisma/test/auth.e2e-spec.ts +75 -0
- package/templates/prisma/test/session-auth.e2e-spec.ts +163 -0
- package/templates/prisma/test/users.e2e-spec.ts +106 -0
- package/templates/prisma/test/utils/clean-database.ts +14 -0
- package/templates/prisma/test/utils/e2e-setup.ts +58 -0
- package/templates/prisma/tsconfig.build.json +4 -0
- package/templates/prisma/tsconfig.json +25 -0
- package/templates/prisma/vitest.config.ts +20 -0
- package/templates/prisma/vitest.e2e.config.ts +19 -0
- package/templates/typeorm/.env.example +45 -0
- package/templates/typeorm/.env.test +38 -0
- package/templates/typeorm/.github/workflows/ci.yml +116 -0
- package/templates/typeorm/ARCHITECTURE.md +158 -0
- package/templates/typeorm/ARCHITECTURE.pt-BR.md +156 -0
- package/templates/typeorm/CODE_OF_CONDUCT.md +29 -0
- package/templates/typeorm/CODE_OF_CONDUCT.pt-BR.md +27 -0
- package/templates/typeorm/CONTRIBUTING.md +57 -0
- package/templates/typeorm/CONTRIBUTING.pt-BR.md +54 -0
- package/templates/typeorm/Dockerfile +43 -0
- package/templates/typeorm/LICENSE +21 -0
- package/templates/typeorm/README.md +266 -0
- package/templates/typeorm/README.pt-BR.md +266 -0
- package/templates/typeorm/ROADMAP.md +79 -0
- package/templates/typeorm/ROADMAP.pt-BR.md +67 -0
- package/templates/typeorm/TESTING.md +114 -0
- package/templates/typeorm/TESTING.pt-BR.md +114 -0
- package/templates/typeorm/docker-compose.yml +78 -0
- package/templates/typeorm/docs/adding-a-module.md +369 -0
- package/templates/typeorm/docs/features-markers.md +50 -0
- package/templates/typeorm/nest-cli.json +8 -0
- package/templates/typeorm/package.json +98 -0
- package/templates/typeorm/src/app.module.ts +72 -0
- package/templates/typeorm/src/auth/auth.controller.ts +283 -0
- package/templates/typeorm/src/auth/auth.module.ts +86 -0
- package/templates/typeorm/src/auth/auth.service.spec.ts +111 -0
- package/templates/typeorm/src/auth/auth.service.ts +346 -0
- package/templates/typeorm/src/auth/dto/forgot-password.dto.ts +9 -0
- package/templates/typeorm/src/auth/dto/login.dto.ts +10 -0
- package/templates/typeorm/src/auth/dto/refresh-token.dto.ts +9 -0
- package/templates/typeorm/src/auth/dto/register.dto.ts +11 -0
- package/templates/typeorm/src/auth/dto/reset-password.dto.ts +10 -0
- package/templates/typeorm/src/auth/entities/email-verification-token.entity.ts +69 -0
- package/templates/typeorm/src/auth/entities/oauth-account.entity.ts +50 -0
- package/templates/typeorm/src/auth/entities/password-reset-token.entity.ts +69 -0
- package/templates/typeorm/src/auth/entities/refresh-token.entity.ts +69 -0
- package/templates/typeorm/src/auth/entities/session.entity.ts +50 -0
- package/templates/typeorm/src/auth/guards/github-auth.guard.ts +10 -0
- package/templates/typeorm/src/auth/guards/google-auth.guard.ts +10 -0
- package/templates/typeorm/src/auth/guards/jwt-auth.guard.ts +25 -0
- package/templates/typeorm/src/auth/guards/session-auth.guard.spec.ts +77 -0
- package/templates/typeorm/src/auth/guards/session-auth.guard.ts +37 -0
- package/templates/typeorm/src/auth/session.service.spec.ts +74 -0
- package/templates/typeorm/src/auth/session.service.ts +96 -0
- package/templates/typeorm/src/auth/strategies/github.strategy.ts +41 -0
- package/templates/typeorm/src/auth/strategies/google.strategy.ts +43 -0
- package/templates/typeorm/src/auth/strategies/jwt.strategy.ts +25 -0
- package/templates/typeorm/src/auth/token.service.ts +115 -0
- package/templates/typeorm/src/common/constants/permissions.ts +8 -0
- package/templates/typeorm/src/common/constants/role-permissions.ts +9 -0
- package/templates/typeorm/src/common/constants/role.enum.ts +5 -0
- package/templates/typeorm/src/common/decorators/current-user.decorator.ts +8 -0
- package/templates/typeorm/src/common/decorators/permissions.decorator.ts +7 -0
- package/templates/typeorm/src/common/decorators/public.decorator.ts +4 -0
- package/templates/typeorm/src/common/decorators/roles.decorator.ts +6 -0
- package/templates/typeorm/src/common/filters/http-exception.filter.ts +34 -0
- package/templates/typeorm/src/common/guards/permissions.guard.spec.ts +54 -0
- package/templates/typeorm/src/common/guards/permissions.guard.ts +28 -0
- package/templates/typeorm/src/common/guards/roles.guard.spec.ts +37 -0
- package/templates/typeorm/src/common/guards/roles.guard.ts +24 -0
- package/templates/typeorm/src/common/interceptors/logging.interceptor.ts +23 -0
- package/templates/typeorm/src/common/middleware/csrf.middleware.spec.ts +97 -0
- package/templates/typeorm/src/common/middleware/csrf.middleware.ts +46 -0
- package/templates/typeorm/src/common/utils/avatar-storage.util.ts +32 -0
- package/templates/typeorm/src/common/utils/hash.util.ts +5 -0
- package/templates/typeorm/src/config/env.validation.ts +50 -0
- package/templates/typeorm/src/database/data-source.ts +20 -0
- package/templates/typeorm/src/database/database.module.ts +39 -0
- package/templates/typeorm/src/database/seed.ts +81 -0
- package/templates/typeorm/src/database/typeorm-options.ts +49 -0
- package/templates/typeorm/src/health/health.controller.ts +49 -0
- package/templates/typeorm/src/health/health.module.ts +19 -0
- package/templates/typeorm/src/health/indicators/redis-health.indicator.spec.ts +54 -0
- package/templates/typeorm/src/health/indicators/redis-health.indicator.ts +33 -0
- package/templates/typeorm/src/health/indicators/typeorm-health.indicator.spec.ts +49 -0
- package/templates/typeorm/src/health/indicators/typeorm-health.indicator.ts +37 -0
- package/templates/typeorm/src/mail/mail.module.ts +12 -0
- package/templates/typeorm/src/mail/mail.processor.ts +48 -0
- package/templates/typeorm/src/mail/mail.service.ts +24 -0
- package/templates/typeorm/src/mail/templates/email-templates.ts +28 -0
- package/templates/typeorm/src/main.ts +107 -0
- package/templates/typeorm/src/metrics/metrics.controller.ts +22 -0
- package/templates/typeorm/src/metrics/metrics.interceptor.ts +30 -0
- package/templates/typeorm/src/metrics/metrics.module.ts +12 -0
- package/templates/typeorm/src/metrics/metrics.service.ts +34 -0
- package/templates/typeorm/src/types/express-session.d.ts +13 -0
- package/templates/typeorm/src/users/dto/create-user.dto.ts +12 -0
- package/templates/typeorm/src/users/dto/find-users-query.dto.ts +12 -0
- package/templates/typeorm/src/users/dto/update-user.dto.ts +6 -0
- package/templates/typeorm/src/users/entities/user.entity.ts +113 -0
- package/templates/typeorm/src/users/users.controller.ts +165 -0
- package/templates/typeorm/src/users/users.module.ts +13 -0
- package/templates/typeorm/src/users/users.service.spec.ts +183 -0
- package/templates/typeorm/src/users/users.service.ts +124 -0
- package/templates/typeorm/test/auth.e2e-spec.ts +111 -0
- package/templates/typeorm/test/session-auth.e2e-spec.ts +159 -0
- package/templates/typeorm/test/users.e2e-spec.ts +183 -0
- package/templates/typeorm/test/utils/clean-database.ts +65 -0
- package/templates/typeorm/test/utils/e2e-setup.ts +77 -0
- package/templates/typeorm/tsconfig.build.json +4 -0
- package/templates/typeorm/tsconfig.json +25 -0
- package/templates/typeorm/vitest.config.ts +20 -0
- package/templates/typeorm/vitest.e2e.config.ts +19 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Roadmap
|
|
2
|
+
|
|
3
|
+
**English** | [Português](ROADMAP.pt-BR.md)
|
|
4
|
+
|
|
5
|
+
This roadmap presents the current state of the NestForge Drizzle ORM template and the areas that can still evolve.
|
|
6
|
+
|
|
7
|
+
For large changes, open an issue before the pull request to align the implementation.
|
|
8
|
+
|
|
9
|
+
## CLI and generation
|
|
10
|
+
|
|
11
|
+
* [x] Project generation with Drizzle ORM
|
|
12
|
+
* [x] TypeScript
|
|
13
|
+
* [x] JavaScript generated from the TypeScript template
|
|
14
|
+
* [x] PostgreSQL
|
|
15
|
+
* [x] MySQL
|
|
16
|
+
* [x] SQLite
|
|
17
|
+
* [x] Removal of optional features through markers
|
|
18
|
+
* [x] Removal of unused dependencies
|
|
19
|
+
* [x] Final commands adapted to Drizzle
|
|
20
|
+
* [x] Automated tests for generated combinations
|
|
21
|
+
|
|
22
|
+
## Database
|
|
23
|
+
|
|
24
|
+
* [x] Drizzle ORM
|
|
25
|
+
* [x] PostgreSQL-specific schema
|
|
26
|
+
* [x] MySQL-specific schema
|
|
27
|
+
* [x] SQLite-specific schema
|
|
28
|
+
* [x] Dynamic Drizzle Kit configuration
|
|
29
|
+
* [x] Migration generation
|
|
30
|
+
* [x] Migration execution
|
|
31
|
+
* [x] Seed with users for the default roles
|
|
32
|
+
* [x] Health check using the selected driver
|
|
33
|
+
* [x] Transactions adapted to `better-sqlite3`
|
|
34
|
+
* [x] Isolated database cleanup in E2E tests
|
|
35
|
+
|
|
36
|
+
## Authentication
|
|
37
|
+
|
|
38
|
+
* [x] JWT strategy
|
|
39
|
+
* [x] Session/Cookies strategy
|
|
40
|
+
* [x] OAuth-only strategy
|
|
41
|
+
* [x] Project without authentication
|
|
42
|
+
* [x] Login
|
|
43
|
+
* [x] Registration
|
|
44
|
+
* [x] Logout
|
|
45
|
+
* [x] Access token
|
|
46
|
+
* [x] Refresh token
|
|
47
|
+
* [x] Refresh token revocation
|
|
48
|
+
* [x] Password recovery
|
|
49
|
+
* [x] Password reset
|
|
50
|
+
* [x] Email verification
|
|
51
|
+
* [x] Google OAuth
|
|
52
|
+
* [x] GitHub OAuth
|
|
53
|
+
* [x] Sessions persisted with `DrizzleSessionStore`
|
|
54
|
+
* [x] CSRF protection for Session/Cookies
|
|
55
|
+
|
|
56
|
+
## Users and authorization
|
|
57
|
+
|
|
58
|
+
* [x] User CRUD
|
|
59
|
+
* [x] Pagination
|
|
60
|
+
* [x] Search and filters
|
|
61
|
+
* [x] Avatar upload
|
|
62
|
+
* [x] `ADMIN`, `MANAGER`, and `USER` roles
|
|
63
|
+
* [x] Granular permissions
|
|
64
|
+
* [x] Role and permission guards
|
|
65
|
+
* [x] Optional RBAC removal through the CLI
|
|
66
|
+
|
|
67
|
+
## Security
|
|
68
|
+
|
|
69
|
+
* [x] Helmet
|
|
70
|
+
* [x] Configurable CORS
|
|
71
|
+
* [x] Rate limit
|
|
72
|
+
* [x] Validation with Zod and `nestjs-zod`
|
|
73
|
+
* [x] Response serialization
|
|
74
|
+
* [x] CSRF protection for session authentication
|
|
75
|
+
* [x] `httpOnly` cookies
|
|
76
|
+
* [x] Secure cookies in production
|
|
77
|
+
* [x] Environment variable validation
|
|
78
|
+
|
|
79
|
+
## Optional features
|
|
80
|
+
|
|
81
|
+
* [x] Docker and Docker Compose
|
|
82
|
+
* [x] Swagger/OpenAPI
|
|
83
|
+
* [x] Global validation
|
|
84
|
+
* [x] Redis
|
|
85
|
+
* [x] BullMQ
|
|
86
|
+
* [x] Transactional email
|
|
87
|
+
* [x] Mailpit for development
|
|
88
|
+
* [x] RBAC and Permissions
|
|
89
|
+
* [x] Optional `.env` file generation
|
|
90
|
+
|
|
91
|
+
## Observability
|
|
92
|
+
|
|
93
|
+
* [x] Structured logging with Pino
|
|
94
|
+
* [x] Application health check
|
|
95
|
+
* [x] Drizzle health check
|
|
96
|
+
* [x] Redis health check
|
|
97
|
+
* [x] Memory check
|
|
98
|
+
* [x] Disk space check
|
|
99
|
+
* [x] Prometheus-format metrics
|
|
100
|
+
* [x] HTTP metrics
|
|
101
|
+
|
|
102
|
+
## Tests
|
|
103
|
+
|
|
104
|
+
* [x] Unit tests with Vitest
|
|
105
|
+
* [x] E2E tests with Supertest
|
|
106
|
+
* [x] JWT authentication tests
|
|
107
|
+
* [x] Session/Cookies tests
|
|
108
|
+
* [x] CSRF tests
|
|
109
|
+
* [x] User tests
|
|
110
|
+
* [x] RBAC tests
|
|
111
|
+
* [x] Drizzle health check tests
|
|
112
|
+
* [x] Separate test database
|
|
113
|
+
* [x] Table cleanup between tests
|
|
114
|
+
* [x] Smoke test with Drizzle, SQLite, and JWT
|
|
115
|
+
* [x] Smoke test with Drizzle, SQLite, and Session/Cookies
|
|
116
|
+
|
|
117
|
+
## CI and infrastructure
|
|
118
|
+
|
|
119
|
+
* [x] GitHub Actions
|
|
120
|
+
* [x] Reproducible installation with `npm ci`
|
|
121
|
+
* [x] Migration generation and execution in CI
|
|
122
|
+
* [x] Lint
|
|
123
|
+
* [x] Build
|
|
124
|
+
* [x] Unit tests
|
|
125
|
+
* [x] E2E tests
|
|
126
|
+
* [x] PostgreSQL, MySQL, and Redis services according to generation
|
|
127
|
+
* [ ] Automated deployment example
|
|
128
|
+
* [ ] Staging environment configuration example
|
|
129
|
+
|
|
130
|
+
## Documentation
|
|
131
|
+
|
|
132
|
+
* [x] Template README
|
|
133
|
+
* [x] Architecture guide
|
|
134
|
+
* [x] Guide for adding a module with Drizzle
|
|
135
|
+
* [x] Feature marker guide
|
|
136
|
+
* [x] Migration documentation
|
|
137
|
+
* [x] Testing documentation
|
|
138
|
+
* [x] Authentication documentation
|
|
139
|
+
* [x] Observability documentation
|
|
140
|
+
|
|
141
|
+
## Outside this template's scope
|
|
142
|
+
|
|
143
|
+
MongoDB is not part of the current Drizzle template. MongoDB support belongs to the general CLI roadmap and will require its own persistence strategy.
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Roadmap
|
|
2
|
+
|
|
3
|
+
[English](ROADMAP.md) | **Português**
|
|
4
|
+
|
|
5
|
+
Este roadmap apresenta o estado atual do template NestForge com Drizzle ORM e os pontos que ainda podem evoluir.
|
|
6
|
+
|
|
7
|
+
Para mudanças grandes, abra uma issue antes do pull request para alinhar a implementação.
|
|
8
|
+
|
|
9
|
+
## CLI e geração
|
|
10
|
+
|
|
11
|
+
* [x] Geração de projetos com Drizzle ORM
|
|
12
|
+
* [x] TypeScript
|
|
13
|
+
* [x] JavaScript gerado a partir do template TypeScript
|
|
14
|
+
* [x] PostgreSQL
|
|
15
|
+
* [x] MySQL
|
|
16
|
+
* [x] SQLite
|
|
17
|
+
* [x] Remoção de recursos opcionais por marcadores
|
|
18
|
+
* [x] Remoção de dependências não utilizadas
|
|
19
|
+
* [x] Comandos finais adaptados ao Drizzle
|
|
20
|
+
* [x] Testes automatizados das combinações geradas
|
|
21
|
+
|
|
22
|
+
## Banco de dados
|
|
23
|
+
|
|
24
|
+
* [x] Drizzle ORM
|
|
25
|
+
* [x] Schema específico para PostgreSQL
|
|
26
|
+
* [x] Schema específico para MySQL
|
|
27
|
+
* [x] Schema específico para SQLite
|
|
28
|
+
* [x] Configuração dinâmica do Drizzle Kit
|
|
29
|
+
* [x] Geração de migrations
|
|
30
|
+
* [x] Aplicação de migrations
|
|
31
|
+
* [x] Seed com usuários para as roles padrão
|
|
32
|
+
* [x] Health check usando o driver selecionado
|
|
33
|
+
* [x] Transações adaptadas ao `better-sqlite3`
|
|
34
|
+
* [x] Limpeza isolada do banco nos testes E2E
|
|
35
|
+
|
|
36
|
+
## Autenticação
|
|
37
|
+
|
|
38
|
+
* [x] Estratégia JWT
|
|
39
|
+
* [x] Estratégia Session/Cookies
|
|
40
|
+
* [x] Estratégia OAuth-only
|
|
41
|
+
* [x] Projeto sem autenticação
|
|
42
|
+
* [x] Login
|
|
43
|
+
* [x] Cadastro
|
|
44
|
+
* [x] Logout
|
|
45
|
+
* [x] Access token
|
|
46
|
+
* [x] Refresh token
|
|
47
|
+
* [x] Revogação de refresh token
|
|
48
|
+
* [x] Recuperação de senha
|
|
49
|
+
* [x] Redefinição de senha
|
|
50
|
+
* [x] Verificação de e-mail
|
|
51
|
+
* [x] OAuth com Google
|
|
52
|
+
* [x] OAuth com GitHub
|
|
53
|
+
* [x] Sessões persistidas com `DrizzleSessionStore`
|
|
54
|
+
* [x] Proteção CSRF para Session/Cookies
|
|
55
|
+
|
|
56
|
+
## Usuários e autorização
|
|
57
|
+
|
|
58
|
+
* [x] CRUD de usuários
|
|
59
|
+
* [x] Paginação
|
|
60
|
+
* [x] Busca e filtros
|
|
61
|
+
* [x] Upload de avatar
|
|
62
|
+
* [x] Roles `ADMIN`, `MANAGER` e `USER`
|
|
63
|
+
* [x] Permissions granulares
|
|
64
|
+
* [x] Guards de roles e permissions
|
|
65
|
+
* [x] Remoção opcional de RBAC pela CLI
|
|
66
|
+
|
|
67
|
+
## Segurança
|
|
68
|
+
|
|
69
|
+
* [x] Helmet
|
|
70
|
+
* [x] CORS configurável
|
|
71
|
+
* [x] Rate limit
|
|
72
|
+
* [x] Validação com Zod e `nestjs-zod`
|
|
73
|
+
* [x] Serialização de respostas
|
|
74
|
+
* [x] Proteção CSRF para autenticação por sessão
|
|
75
|
+
* [x] Cookies `httpOnly`
|
|
76
|
+
* [x] Cookies seguros em produção
|
|
77
|
+
* [x] Validação das variáveis de ambiente
|
|
78
|
+
|
|
79
|
+
## Recursos opcionais
|
|
80
|
+
|
|
81
|
+
* [x] Docker e Docker Compose
|
|
82
|
+
* [x] Swagger/OpenAPI
|
|
83
|
+
* [x] Validação global
|
|
84
|
+
* [x] Redis
|
|
85
|
+
* [x] BullMQ
|
|
86
|
+
* [x] E-mail transacional
|
|
87
|
+
* [x] Mailpit para desenvolvimento
|
|
88
|
+
* [x] RBAC e Permissions
|
|
89
|
+
* [x] Geração opcional do arquivo `.env`
|
|
90
|
+
|
|
91
|
+
## Observabilidade
|
|
92
|
+
|
|
93
|
+
* [x] Logs estruturados com Pino
|
|
94
|
+
* [x] Health check da aplicação
|
|
95
|
+
* [x] Health check do Drizzle
|
|
96
|
+
* [x] Health check do Redis
|
|
97
|
+
* [x] Verificação de memória
|
|
98
|
+
* [x] Verificação de espaço em disco
|
|
99
|
+
* [x] Métricas no formato Prometheus
|
|
100
|
+
* [x] Métricas HTTP
|
|
101
|
+
|
|
102
|
+
## Testes
|
|
103
|
+
|
|
104
|
+
* [x] Testes unitários com Vitest
|
|
105
|
+
* [x] Testes E2E com Supertest
|
|
106
|
+
* [x] Testes de autenticação JWT
|
|
107
|
+
* [x] Testes de Session/Cookies
|
|
108
|
+
* [x] Testes de CSRF
|
|
109
|
+
* [x] Testes de usuários
|
|
110
|
+
* [x] Testes de RBAC
|
|
111
|
+
* [x] Testes do health check Drizzle
|
|
112
|
+
* [x] Banco separado para testes
|
|
113
|
+
* [x] Limpeza das tabelas entre testes
|
|
114
|
+
* [x] Smoke test com Drizzle, SQLite e JWT
|
|
115
|
+
* [x] Smoke test com Drizzle, SQLite e Session/Cookies
|
|
116
|
+
|
|
117
|
+
## CI e infraestrutura
|
|
118
|
+
|
|
119
|
+
* [x] GitHub Actions
|
|
120
|
+
* [x] Instalação reproduzível com `npm ci`
|
|
121
|
+
* [x] Geração e aplicação de migrations no CI
|
|
122
|
+
* [x] Lint
|
|
123
|
+
* [x] Build
|
|
124
|
+
* [x] Testes unitários
|
|
125
|
+
* [x] Testes E2E
|
|
126
|
+
* [x] Serviços PostgreSQL, MySQL e Redis conforme a geração
|
|
127
|
+
* [ ] Exemplo de deploy automatizado
|
|
128
|
+
* [ ] Exemplo de configuração para ambiente de staging
|
|
129
|
+
|
|
130
|
+
## Documentação
|
|
131
|
+
|
|
132
|
+
* [x] README do template
|
|
133
|
+
* [x] Guia de arquitetura
|
|
134
|
+
* [x] Guia para adicionar um módulo com Drizzle
|
|
135
|
+
* [x] Guia de marcadores de funcionalidades
|
|
136
|
+
* [x] Documentação de migrations
|
|
137
|
+
* [x] Documentação de testes
|
|
138
|
+
* [x] Documentação de autenticação
|
|
139
|
+
* [x] Documentação de observabilidade
|
|
140
|
+
|
|
141
|
+
## Fora do escopo deste template
|
|
142
|
+
|
|
143
|
+
MongoDB não faz parte do template Drizzle atual. O suporte a MongoDB pertence ao roadmap geral da CLI e exigirá uma estratégia de persistência própria.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Testing the Drizzle template
|
|
2
|
+
|
|
3
|
+
**English** | [Português](TESTING.pt-BR.md)
|
|
4
|
+
|
|
5
|
+
This guide validates a project generated from the NestForge Drizzle template.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
* Node.js 20 or later
|
|
10
|
+
* npm 10 or later
|
|
11
|
+
* Docker when testing PostgreSQL, MySQL, Redis, or Mailpit
|
|
12
|
+
|
|
13
|
+
SQLite can be tested without Docker. Make sure the installed `better-sqlite3` version supports your Node version.
|
|
14
|
+
|
|
15
|
+
## Prepare the environment
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install
|
|
19
|
+
cp .env.example .env
|
|
20
|
+
cp .env.example .env.test
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Use different databases in `.env` and `.env.test`.
|
|
24
|
+
|
|
25
|
+
## Generate and apply migrations
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm run drizzle:generate
|
|
29
|
+
npm run drizzle:migrate
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Review the SQL files generated under `drizzle/` before applying them to shared or production environments.
|
|
33
|
+
|
|
34
|
+
Run the seed when the generated project includes password authentication:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run seed
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Static validation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm run build
|
|
44
|
+
npm run lint
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Unit tests
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm test
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For coverage:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm run test:cov
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Unit tests mock the Drizzle instance and Redis, so they do not require real services.
|
|
60
|
+
|
|
61
|
+
## E2E tests
|
|
62
|
+
|
|
63
|
+
Generate migrations at least once before the first E2E run:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm run drizzle:generate
|
|
67
|
+
npm run test:e2e
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The `pretest:e2e` script applies migrations using `.env.test` before the suite starts.
|
|
71
|
+
|
|
72
|
+
Depending on the generated authentication strategy, the suite may cover JWT, Session/Cookies, CSRF, user CRUD, RBAC, and permissions.
|
|
73
|
+
|
|
74
|
+
## Database-specific checks
|
|
75
|
+
|
|
76
|
+
### PostgreSQL
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
docker compose up -d postgres
|
|
80
|
+
npm run drizzle:migrate
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### MySQL
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
docker compose up -d mysql
|
|
87
|
+
npm run drizzle:migrate
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### SQLite
|
|
91
|
+
|
|
92
|
+
Set the database URL to a local file:
|
|
93
|
+
|
|
94
|
+
```dotenv
|
|
95
|
+
DATABASE_URL="file:./dev.db"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Then run:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm run drizzle:generate
|
|
102
|
+
npm run drizzle:migrate
|
|
103
|
+
npm run seed
|
|
104
|
+
npm run build
|
|
105
|
+
npm test
|
|
106
|
+
npm run test:e2e
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Check the dependencies and migration artifacts:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm ls drizzle-orm drizzle-kit better-sqlite3
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```powershell
|
|
116
|
+
Get-ChildItem .\drizzle -Recurse
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## SQLite transaction behavior
|
|
120
|
+
|
|
121
|
+
`better-sqlite3` uses synchronous transactions. Transaction callbacks must not return a `Promise`, and write operations use methods such as `.run()`.
|
|
122
|
+
|
|
123
|
+
PostgreSQL and MySQL use asynchronous transaction callbacks with `await`.
|
|
124
|
+
|
|
125
|
+
## Final checklist
|
|
126
|
+
|
|
127
|
+
* [ ] Dependencies install successfully
|
|
128
|
+
* [ ] The correct database driver is installed
|
|
129
|
+
* [ ] Migrations are generated and reviewed
|
|
130
|
+
* [ ] Migrations are applied
|
|
131
|
+
* [ ] Seed runs when applicable
|
|
132
|
+
* [ ] Build passes
|
|
133
|
+
* [ ] Lint passes
|
|
134
|
+
* [ ] Unit tests pass
|
|
135
|
+
* [ ] E2E tests pass
|
|
136
|
+
* [ ] `.env.test` uses an isolated database
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Testando o template Drizzle
|
|
2
|
+
|
|
3
|
+
[English](TESTING.md) | **Português**
|
|
4
|
+
|
|
5
|
+
Este guia valida um projeto gerado a partir do template Drizzle do NestForge.
|
|
6
|
+
|
|
7
|
+
## Pré-requisitos
|
|
8
|
+
|
|
9
|
+
* Node.js 20 ou superior
|
|
10
|
+
* npm 10 ou superior
|
|
11
|
+
* Docker para testar PostgreSQL, MySQL, Redis ou Mailpit
|
|
12
|
+
|
|
13
|
+
SQLite pode ser testado sem Docker. Confirme que a versão instalada do `better-sqlite3` oferece suporte à sua versão do Node.
|
|
14
|
+
|
|
15
|
+
## Preparar o ambiente
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install
|
|
19
|
+
cp .env.example .env
|
|
20
|
+
cp .env.example .env.test
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Use bancos diferentes em `.env` e `.env.test`.
|
|
24
|
+
|
|
25
|
+
## Gerar e aplicar migrations
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm run drizzle:generate
|
|
29
|
+
npm run drizzle:migrate
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Revise os arquivos SQL gerados em `drizzle/` antes de aplicá-los em ambientes compartilhados ou de produção.
|
|
33
|
+
|
|
34
|
+
Execute o seed quando o projeto gerado incluir autenticação por senha:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run seed
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Validação estática
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm run build
|
|
44
|
+
npm run lint
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Testes unitários
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm test
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Para cobertura:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm run test:cov
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Os testes unitários simulam a instância do Drizzle e o Redis, portanto não exigem serviços reais.
|
|
60
|
+
|
|
61
|
+
## Testes E2E
|
|
62
|
+
|
|
63
|
+
Gere as migrations pelo menos uma vez antes da primeira execução E2E:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm run drizzle:generate
|
|
67
|
+
npm run test:e2e
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
O script `pretest:e2e` aplica as migrations usando `.env.test` antes do início da suíte.
|
|
71
|
+
|
|
72
|
+
Dependendo da estratégia de autenticação gerada, a suíte pode cobrir JWT, Session/Cookies, CSRF, CRUD de usuários, RBAC e permissions.
|
|
73
|
+
|
|
74
|
+
## Verificações específicas por banco
|
|
75
|
+
|
|
76
|
+
### PostgreSQL
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
docker compose up -d postgres
|
|
80
|
+
npm run drizzle:migrate
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### MySQL
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
docker compose up -d mysql
|
|
87
|
+
npm run drizzle:migrate
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### SQLite
|
|
91
|
+
|
|
92
|
+
Defina a URL do banco como um arquivo local:
|
|
93
|
+
|
|
94
|
+
```dotenv
|
|
95
|
+
DATABASE_URL="file:./dev.db"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Depois execute:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm run drizzle:generate
|
|
102
|
+
npm run drizzle:migrate
|
|
103
|
+
npm run seed
|
|
104
|
+
npm run build
|
|
105
|
+
npm test
|
|
106
|
+
npm run test:e2e
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Confira as dependências e os artefatos das migrations:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm ls drizzle-orm drizzle-kit better-sqlite3
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```powershell
|
|
116
|
+
Get-ChildItem .\drizzle -Recurse
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Comportamento das transações SQLite
|
|
120
|
+
|
|
121
|
+
O `better-sqlite3` usa transações síncronas. As callbacks de transação não podem retornar uma `Promise`, e as operações de escrita usam métodos como `.run()`.
|
|
122
|
+
|
|
123
|
+
PostgreSQL e MySQL usam callbacks de transação assíncronas com `await`.
|
|
124
|
+
|
|
125
|
+
## Checklist final
|
|
126
|
+
|
|
127
|
+
* [ ] As dependências são instaladas corretamente
|
|
128
|
+
* [ ] O driver correto do banco está instalado
|
|
129
|
+
* [ ] As migrations são geradas e revisadas
|
|
130
|
+
* [ ] As migrations são aplicadas
|
|
131
|
+
* [ ] O seed executa quando aplicável
|
|
132
|
+
* [ ] O build passa
|
|
133
|
+
* [ ] O lint passa
|
|
134
|
+
* [ ] Os testes unitários passam
|
|
135
|
+
* [ ] Os testes E2E passam
|
|
136
|
+
* [ ] `.env.test` usa um banco isolado
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
version: "3.9"
|
|
2
|
+
|
|
3
|
+
services:
|
|
4
|
+
api:
|
|
5
|
+
build:
|
|
6
|
+
context: .
|
|
7
|
+
dockerfile: Dockerfile
|
|
8
|
+
container_name: nestforge-api
|
|
9
|
+
ports:
|
|
10
|
+
- "3000:3000"
|
|
11
|
+
env_file:
|
|
12
|
+
- .env
|
|
13
|
+
depends_on:
|
|
14
|
+
# nestforge:feature:database:postgres
|
|
15
|
+
- postgres
|
|
16
|
+
# nestforge:feature:database:postgres:end
|
|
17
|
+
# nestforge:feature:database:mysql
|
|
18
|
+
- mysql
|
|
19
|
+
# nestforge:feature:database:mysql:end
|
|
20
|
+
# nestforge:feature:redis
|
|
21
|
+
- redis
|
|
22
|
+
# nestforge:feature:redis:end
|
|
23
|
+
volumes:
|
|
24
|
+
- ./src:/app/src
|
|
25
|
+
command: npm run start:dev
|
|
26
|
+
|
|
27
|
+
# nestforge:feature:database:postgres
|
|
28
|
+
postgres:
|
|
29
|
+
image: postgres:16-alpine
|
|
30
|
+
container_name: nestforge-postgres
|
|
31
|
+
restart: unless-stopped
|
|
32
|
+
environment:
|
|
33
|
+
POSTGRES_USER: nestforge
|
|
34
|
+
POSTGRES_PASSWORD: nestforge
|
|
35
|
+
POSTGRES_DB: nestforge
|
|
36
|
+
ports:
|
|
37
|
+
- "5432:5432"
|
|
38
|
+
volumes:
|
|
39
|
+
- postgres_data:/var/lib/postgresql/data
|
|
40
|
+
# nestforge:feature:database:postgres:end
|
|
41
|
+
|
|
42
|
+
# nestforge:feature:database:mysql
|
|
43
|
+
mysql:
|
|
44
|
+
image: mysql:8
|
|
45
|
+
container_name: nestforge-mysql
|
|
46
|
+
restart: unless-stopped
|
|
47
|
+
environment:
|
|
48
|
+
MYSQL_USER: nestforge
|
|
49
|
+
MYSQL_PASSWORD: nestforge
|
|
50
|
+
MYSQL_ROOT_PASSWORD: nestforge
|
|
51
|
+
MYSQL_DATABASE: nestforge
|
|
52
|
+
ports:
|
|
53
|
+
- "3306:3306"
|
|
54
|
+
volumes:
|
|
55
|
+
- mysql_data:/var/lib/mysql
|
|
56
|
+
# nestforge:feature:database:mysql:end
|
|
57
|
+
|
|
58
|
+
# nestforge:feature:redis
|
|
59
|
+
redis:
|
|
60
|
+
image: redis:7-alpine
|
|
61
|
+
container_name: nestforge-redis
|
|
62
|
+
restart: unless-stopped
|
|
63
|
+
ports:
|
|
64
|
+
- "6379:6379"
|
|
65
|
+
|
|
66
|
+
mailpit:
|
|
67
|
+
image: axllent/mailpit:latest
|
|
68
|
+
container_name: nestforge-mailpit
|
|
69
|
+
restart: unless-stopped
|
|
70
|
+
ports:
|
|
71
|
+
- "8025:8025" # UI
|
|
72
|
+
- "1025:1025" # SMTP
|
|
73
|
+
# nestforge:feature:redis:end
|
|
74
|
+
|
|
75
|
+
# nestforge:feature:database:postgres
|
|
76
|
+
volumes:
|
|
77
|
+
postgres_data:
|
|
78
|
+
# nestforge:feature:database:postgres:end
|
|
79
|
+
# nestforge:feature:database:mysql
|
|
80
|
+
volumes:
|
|
81
|
+
mysql_data:
|
|
82
|
+
# nestforge:feature:database:mysql:end
|