kybernus 1.0.1 → 1.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 +20 -0
- package/README.md +49 -263
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +5 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/prompts/wizard.d.ts +14 -1
- package/dist/cli/prompts/wizard.d.ts.map +1 -1
- package/dist/cli/prompts/wizard.js +45 -9
- package/dist/cli/prompts/wizard.js.map +1 -1
- package/dist/core/generator/project.d.ts +8 -0
- package/dist/core/generator/project.d.ts.map +1 -1
- package/dist/core/generator/project.js +41 -2
- package/dist/core/generator/project.js.map +1 -1
- package/dist/core/templates/downloader.d.ts +32 -0
- package/dist/core/templates/downloader.d.ts.map +1 -0
- package/dist/core/templates/downloader.js +95 -0
- package/dist/core/templates/downloader.js.map +1 -0
- package/dist/models/config.d.ts +1 -0
- package/dist/models/config.d.ts.map +1 -1
- package/package.json +6 -2
- package/templates/java-spring/pro/clean/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/java-spring/pro/clean/Dockerfile.hbs +0 -45
- package/templates/java-spring/pro/clean/README.md.hbs +0 -31
- package/templates/java-spring/pro/clean/docker-compose.yml.hbs +0 -18
- package/templates/java-spring/pro/clean/infra/main.tf.hbs +0 -83
- package/templates/java-spring/pro/clean/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/java-spring/pro/clean/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/java-spring/pro/clean/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/java-spring/pro/clean/pom.xml.hbs +0 -130
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/application/service/AuthService.java.hbs +0 -36
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/entity/User.java.hbs +0 -77
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/repository/UserRepository.java.hbs +0 -15
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/usecase/LoginUserUseCase.java.hbs +0 -36
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/usecase/RegisterUserUseCase.java.hbs +0 -46
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/infrastructure/persistence/InMemoryUserRepository.java.hbs +0 -41
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/infrastructure/security/SecurityAdapters.java.hbs +0 -53
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/infrastructure/web/controller/AuthController.java.hbs +0 -41
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +0 -14
- package/templates/java-spring/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/java-spring/pro/hexagonal/Dockerfile.hbs +0 -45
- package/templates/java-spring/pro/hexagonal/README.md.hbs +0 -38
- package/templates/java-spring/pro/hexagonal/docker-compose.yml.hbs +0 -18
- package/templates/java-spring/pro/hexagonal/infra/main.tf.hbs +0 -83
- package/templates/java-spring/pro/hexagonal/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/java-spring/pro/hexagonal/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/java-spring/pro/hexagonal/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/java-spring/pro/hexagonal/pom.xml.hbs +0 -130
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/application/service/AuthService.java.hbs +0 -36
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/entity/User.java.hbs +0 -77
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/repository/UserRepository.java.hbs +0 -15
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/usecase/LoginUserUseCase.java.hbs +0 -36
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/usecase/RegisterUserUseCase.java.hbs +0 -46
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/infrastructure/persistence/InMemoryUserRepository.java.hbs +0 -41
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/infrastructure/security/SecurityAdapters.java.hbs +0 -53
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/infrastructure/web/controller/AuthController.java.hbs +0 -41
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +0 -14
- package/templates/java-spring/pro/mvc/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/java-spring/pro/mvc/Dockerfile.hbs +0 -45
- package/templates/java-spring/pro/mvc/README.md.hbs +0 -116
- package/templates/java-spring/pro/mvc/docker-compose.yml.hbs +0 -18
- package/templates/java-spring/pro/mvc/infra/main.tf.hbs +0 -83
- package/templates/java-spring/pro/mvc/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/java-spring/pro/mvc/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/java-spring/pro/mvc/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/java-spring/pro/mvc/pom.xml.hbs +0 -130
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/GlobalExceptionHandler.java.hbs +0 -39
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/SecurityConfig.java.hbs +0 -44
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/WebConfig.java.hbs +0 -30
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/controller/AuthController.java.hbs +0 -69
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/controller/HealthController.java.hbs +0 -30
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/controller/PaymentsController.java.hbs +0 -49
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/dto/AuthRequest.java.hbs +0 -3
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/dto/AuthResponse.java.hbs +0 -3
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/model/.gitkeep +0 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/repository/.gitkeep +0 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/security/JwtAuthenticationFilter.java.hbs +0 -56
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/security/JwtTokenProvider.java.hbs +0 -59
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/service/.gitkeep +0 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/service/StripeService.java.hbs +0 -67
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +0 -13
- package/templates/java-spring/pro/mvc/src/main/resources/application.yml.hbs +0 -32
- package/templates/java-spring/pro/mvc/src/test/java/{{packagePath}}/{{projectNamePascalCase}}ApplicationTests.java.hbs +0 -13
- package/templates/java-spring/pro/mvc/src/test/resources/application.yml.hbs +0 -10
- package/templates/java-spring/pro/mvc/template.json +0 -14
- package/templates/nestjs/pro/clean/.env.example.hbs +0 -19
- package/templates/nestjs/pro/clean/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/nestjs/pro/clean/Dockerfile.hbs +0 -45
- package/templates/nestjs/pro/clean/infra/main.tf.hbs +0 -83
- package/templates/nestjs/pro/clean/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/nestjs/pro/clean/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/nestjs/pro/clean/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/nestjs/pro/clean/package.json.hbs +0 -37
- package/templates/nestjs/pro/clean/src/auth.module.ts.hbs +0 -17
- package/templates/nestjs/pro/clean/src/domain/entities/user.entity.ts.hbs +0 -12
- package/templates/nestjs/pro/clean/src/domain/repositories/user.repository.ts.hbs +0 -6
- package/templates/nestjs/pro/clean/src/domain/use-cases/register.use-case.ts.hbs +0 -18
- package/templates/nestjs/pro/clean/src/infrastructure/database/in-memory.repository.ts.hbs +0 -17
- package/templates/nestjs/pro/clean/src/infrastructure/http/auth.controller.ts.hbs +0 -16
- package/templates/nestjs/pro/clean/tsconfig.json.hbs +0 -21
- package/templates/nestjs/pro/hexagonal/.env.example.hbs +0 -19
- package/templates/nestjs/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/nestjs/pro/hexagonal/Dockerfile.hbs +0 -45
- package/templates/nestjs/pro/hexagonal/infra/main.tf.hbs +0 -83
- package/templates/nestjs/pro/hexagonal/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/nestjs/pro/hexagonal/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/nestjs/pro/hexagonal/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/nestjs/pro/hexagonal/package.json.hbs +0 -37
- package/templates/nestjs/pro/hexagonal/src/adapters/inbound/http.adapter.ts.hbs +0 -12
- package/templates/nestjs/pro/hexagonal/src/adapters/outbound/persistence.adapter.ts.hbs +0 -13
- package/templates/nestjs/pro/hexagonal/src/auth.module.ts.hbs +0 -19
- package/templates/nestjs/pro/hexagonal/src/core/auth.service.ts.hbs +0 -16
- package/templates/nestjs/pro/hexagonal/src/core/domain/user.entity.ts.hbs +0 -8
- package/templates/nestjs/pro/hexagonal/src/core/ports/ports.ts.hbs +0 -9
- package/templates/nestjs/pro/hexagonal/tsconfig.json.hbs +0 -21
- package/templates/nestjs/pro/mvc/.env.example.hbs +0 -19
- package/templates/nestjs/pro/mvc/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/nestjs/pro/mvc/Dockerfile.hbs +0 -45
- package/templates/nestjs/pro/mvc/README.md.hbs +0 -28
- package/templates/nestjs/pro/mvc/infra/main.tf.hbs +0 -83
- package/templates/nestjs/pro/mvc/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/nestjs/pro/mvc/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/nestjs/pro/mvc/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/nestjs/pro/mvc/package.json.hbs +0 -37
- package/templates/nestjs/pro/mvc/src/app.module.ts.hbs +0 -17
- package/templates/nestjs/pro/mvc/src/auth/auth.controller.ts.hbs +0 -35
- package/templates/nestjs/pro/mvc/src/auth/auth.module.ts.hbs +0 -25
- package/templates/nestjs/pro/mvc/src/auth/auth.service.ts.hbs +0 -55
- package/templates/nestjs/pro/mvc/src/auth/jwt.strategy.ts.hbs +0 -19
- package/templates/nestjs/pro/mvc/src/controllers/health.controller.ts.hbs +0 -9
- package/templates/nestjs/pro/mvc/src/controllers/items.controller.ts.hbs +0 -32
- package/templates/nestjs/pro/mvc/src/main.ts.hbs +0 -17
- package/templates/nestjs/pro/mvc/src/models/create-item.dto.ts.hbs +0 -10
- package/templates/nestjs/pro/mvc/src/models/item.model.ts.hbs +0 -6
- package/templates/nestjs/pro/mvc/src/modules/items.module.ts.hbs +0 -9
- package/templates/nestjs/pro/mvc/src/payments/payments.controller.ts.hbs +0 -26
- package/templates/nestjs/pro/mvc/src/payments/payments.module.ts.hbs +0 -11
- package/templates/nestjs/pro/mvc/src/payments/payments.service.ts.hbs +0 -43
- package/templates/nestjs/pro/mvc/src/services/items.service.ts.hbs +0 -32
- package/templates/nestjs/pro/mvc/tsconfig.json.hbs +0 -21
- package/templates/nextjs/pro/default/.env.example.hbs +0 -20
- package/templates/nextjs/pro/default/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/nextjs/pro/default/Dockerfile.hbs +0 -45
- package/templates/nextjs/pro/default/README.md.hbs +0 -96
- package/templates/nextjs/pro/default/docker-compose.yml.hbs +0 -18
- package/templates/nextjs/pro/default/infra/main.tf.hbs +0 -83
- package/templates/nextjs/pro/default/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/nextjs/pro/default/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/nextjs/pro/default/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/nextjs/pro/default/next.config.js.hbs +0 -4
- package/templates/nextjs/pro/default/package.json.hbs +0 -34
- package/templates/nextjs/pro/default/postcss.config.js.hbs +0 -6
- package/templates/nextjs/pro/default/prisma/schema.prisma.hbs +0 -18
- package/templates/nextjs/pro/default/public/.gitkeep +0 -0
- package/templates/nextjs/pro/default/src/app/api/auth/[...nextauth]/route.ts.hbs +0 -61
- package/templates/nextjs/pro/default/src/app/api/checkout/route.ts.hbs +0 -30
- package/templates/nextjs/pro/default/src/app/api/health/route.ts.hbs +0 -9
- package/templates/nextjs/pro/default/src/app/api/webhook/route.ts.hbs +0 -51
- package/templates/nextjs/pro/default/src/app/dashboard/page.tsx.hbs +0 -52
- package/templates/nextjs/pro/default/src/app/globals.css.hbs +0 -3
- package/templates/nextjs/pro/default/src/app/layout.tsx.hbs +0 -22
- package/templates/nextjs/pro/default/src/app/page.tsx.hbs +0 -38
- package/templates/nextjs/pro/default/src/components/.gitkeep +0 -0
- package/templates/nextjs/pro/default/src/components/AuthButton.tsx.hbs +0 -34
- package/templates/nextjs/pro/default/src/components/Providers.tsx.hbs +0 -7
- package/templates/nextjs/pro/default/src/lib/prisma.ts.hbs +0 -13
- package/templates/nextjs/pro/default/src/proxy.ts.hbs +0 -22
- package/templates/nextjs/pro/default/tailwind.config.ts.hbs +0 -15
- package/templates/nextjs/pro/default/template.json +0 -18
- package/templates/nextjs/pro/default/tsconfig.json.hbs +0 -40
- package/templates/nodejs-express/pro/clean/.env.example.hbs +0 -19
- package/templates/nodejs-express/pro/clean/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/nodejs-express/pro/clean/Dockerfile.hbs +0 -45
- package/templates/nodejs-express/pro/clean/README.md.hbs +0 -41
- package/templates/nodejs-express/pro/clean/docker-compose.yml.hbs +0 -18
- package/templates/nodejs-express/pro/clean/infra/main.tf.hbs +0 -83
- package/templates/nodejs-express/pro/clean/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/nodejs-express/pro/clean/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/nodejs-express/pro/clean/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/nodejs-express/pro/clean/package.json.hbs +0 -55
- package/templates/nodejs-express/pro/clean/src/application/services/AuthService.ts.hbs +0 -66
- package/templates/nodejs-express/pro/clean/src/domain/entities/User.ts.hbs +0 -38
- package/templates/nodejs-express/pro/clean/src/domain/repositories/IUserRepository.ts.hbs +0 -13
- package/templates/nodejs-express/pro/clean/src/domain/usecases/LoginUserUseCase.ts.hbs +0 -39
- package/templates/nodejs-express/pro/clean/src/domain/usecases/RegisterUserUseCase.ts.hbs +0 -51
- package/templates/nodejs-express/pro/clean/src/index.ts.hbs +0 -40
- package/templates/nodejs-express/pro/clean/src/infrastructure/database/InMemoryUserRepository.ts.hbs +0 -46
- package/templates/nodejs-express/pro/clean/src/infrastructure/http/controllers/AuthController.ts.hbs +0 -45
- package/templates/nodejs-express/pro/clean/src/infrastructure/http/middlewares/AuthMiddleware.ts.hbs +0 -27
- package/templates/nodejs-express/pro/clean/src/infrastructure/providers/PasswordHasher.ts.hbs +0 -14
- package/templates/nodejs-express/pro/clean/src/infrastructure/providers/TokenGenerator.ts.hbs +0 -25
- package/templates/nodejs-express/pro/clean/tsconfig.json.hbs +0 -27
- package/templates/nodejs-express/pro/hexagonal/.env.example.hbs +0 -19
- package/templates/nodejs-express/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/nodejs-express/pro/hexagonal/Dockerfile.hbs +0 -45
- package/templates/nodejs-express/pro/hexagonal/README.md.hbs +0 -42
- package/templates/nodejs-express/pro/hexagonal/docker-compose.yml.hbs +0 -18
- package/templates/nodejs-express/pro/hexagonal/infra/main.tf.hbs +0 -83
- package/templates/nodejs-express/pro/hexagonal/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/nodejs-express/pro/hexagonal/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/nodejs-express/pro/hexagonal/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/nodejs-express/pro/hexagonal/package.json.hbs +0 -55
- package/templates/nodejs-express/pro/hexagonal/src/adapters/inbound/http/AuthController.ts.hbs +0 -48
- package/templates/nodejs-express/pro/hexagonal/src/adapters/outbound/SecurityAdapters.ts.hbs +0 -31
- package/templates/nodejs-express/pro/hexagonal/src/adapters/outbound/persistence/InMemoryUserAdapter.ts.hbs +0 -38
- package/templates/nodejs-express/pro/hexagonal/src/core/AuthService.ts.hbs +0 -51
- package/templates/nodejs-express/pro/hexagonal/src/core/domain/entities/User.ts.hbs +0 -28
- package/templates/nodejs-express/pro/hexagonal/src/core/ports/inbound/IAuthPort.ts.hbs +0 -11
- package/templates/nodejs-express/pro/hexagonal/src/core/ports/outbound/ISecurityPorts.ts.hbs +0 -15
- package/templates/nodejs-express/pro/hexagonal/src/core/ports/outbound/IUserRepositoryPort.ts.hbs +0 -13
- package/templates/nodejs-express/pro/hexagonal/src/index.ts.hbs +0 -41
- package/templates/nodejs-express/pro/hexagonal/tsconfig.json.hbs +0 -27
- package/templates/nodejs-express/pro/mvc/.env.example.hbs +0 -19
- package/templates/nodejs-express/pro/mvc/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/nodejs-express/pro/mvc/Dockerfile.hbs +0 -45
- package/templates/nodejs-express/pro/mvc/README.md.hbs +0 -85
- package/templates/nodejs-express/pro/mvc/docker-compose.yml.hbs +0 -18
- package/templates/nodejs-express/pro/mvc/infra/main.tf.hbs +0 -83
- package/templates/nodejs-express/pro/mvc/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/nodejs-express/pro/mvc/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/nodejs-express/pro/mvc/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/nodejs-express/pro/mvc/package.json.hbs +0 -55
- package/templates/nodejs-express/pro/mvc/src/app.ts.hbs +0 -34
- package/templates/nodejs-express/pro/mvc/src/config/database.ts.hbs +0 -10
- package/templates/nodejs-express/pro/mvc/src/controllers/auth.controller.ts.hbs +0 -91
- package/templates/nodejs-express/pro/mvc/src/controllers/healthController.ts.hbs +0 -20
- package/templates/nodejs-express/pro/mvc/src/controllers/payments.controller.ts.hbs +0 -72
- package/templates/nodejs-express/pro/mvc/src/index.ts.hbs +0 -12
- package/templates/nodejs-express/pro/mvc/src/middleware/errorHandler.ts.hbs +0 -22
- package/templates/nodejs-express/pro/mvc/src/middlewares/auth.middleware.ts.hbs +0 -31
- package/templates/nodejs-express/pro/mvc/src/models/.gitkeep +0 -0
- package/templates/nodejs-express/pro/mvc/src/routes/index.ts.hbs +0 -14
- package/templates/nodejs-express/pro/mvc/src/services/.gitkeep +0 -0
- package/templates/nodejs-express/pro/mvc/src/services/stripe.service.ts.hbs +0 -102
- package/templates/nodejs-express/pro/mvc/template.json +0 -18
- package/templates/nodejs-express/pro/mvc/tsconfig.json.hbs +0 -27
- package/templates/python-fastapi/pro/clean/.env.example.hbs +0 -17
- package/templates/python-fastapi/pro/clean/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/python-fastapi/pro/clean/Dockerfile.hbs +0 -20
- package/templates/python-fastapi/pro/clean/app/domain/entities/user.py.hbs +0 -23
- package/templates/python-fastapi/pro/clean/app/domain/repositories/user_repository.py.hbs +0 -22
- package/templates/python-fastapi/pro/clean/app/domain/usecases/register_user.py.hbs +0 -30
- package/templates/python-fastapi/pro/clean/app/infrastructure/database/in_memory_repository.py.hbs +0 -26
- package/templates/python-fastapi/pro/clean/app/infrastructure/http/auth_controller.py.hbs +0 -26
- package/templates/python-fastapi/pro/clean/app/infrastructure/security/adapters.py.hbs +0 -23
- package/templates/python-fastapi/pro/clean/app/main.py.hbs +0 -10
- package/templates/python-fastapi/pro/clean/infra/main.tf.hbs +0 -83
- package/templates/python-fastapi/pro/clean/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/python-fastapi/pro/clean/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/python-fastapi/pro/clean/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/python-fastapi/pro/clean/requirements.txt.hbs +0 -12
- package/templates/python-fastapi/pro/hexagonal/.env.example.hbs +0 -17
- package/templates/python-fastapi/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/python-fastapi/pro/hexagonal/Dockerfile.hbs +0 -20
- package/templates/python-fastapi/pro/hexagonal/app/adapters/inbound/http_adapter.py.hbs +0 -29
- package/templates/python-fastapi/pro/hexagonal/app/core/domain/user.py.hbs +0 -15
- package/templates/python-fastapi/pro/hexagonal/app/core/ports.py.hbs +0 -25
- package/templates/python-fastapi/pro/hexagonal/app/core/service.py.hbs +0 -28
- package/templates/python-fastapi/pro/hexagonal/app/main.py.hbs +0 -22
- package/templates/python-fastapi/pro/hexagonal/infra/main.tf.hbs +0 -83
- package/templates/python-fastapi/pro/hexagonal/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/python-fastapi/pro/hexagonal/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/python-fastapi/pro/hexagonal/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/python-fastapi/pro/hexagonal/requirements.txt.hbs +0 -12
- package/templates/python-fastapi/pro/mvc/.env.example.hbs +0 -17
- package/templates/python-fastapi/pro/mvc/.github/workflows/ci-cd.yml.hbs +0 -88
- package/templates/python-fastapi/pro/mvc/Dockerfile.hbs +0 -20
- package/templates/python-fastapi/pro/mvc/README.md.hbs +0 -41
- package/templates/python-fastapi/pro/mvc/app/controllers/auth.py.hbs +0 -46
- package/templates/python-fastapi/pro/mvc/app/controllers/health.py.hbs +0 -7
- package/templates/python-fastapi/pro/mvc/app/controllers/items.py.hbs +0 -21
- package/templates/python-fastapi/pro/mvc/app/controllers/payments.py.hbs +0 -32
- package/templates/python-fastapi/pro/mvc/app/main.py.hbs +0 -20
- package/templates/python-fastapi/pro/mvc/app/middleware/security.py.hbs +0 -39
- package/templates/python-fastapi/pro/mvc/app/models/item.py.hbs +0 -11
- package/templates/python-fastapi/pro/mvc/app/schemas/item.py.hbs +0 -16
- package/templates/python-fastapi/pro/mvc/app/services/item_service.py.hbs +0 -24
- package/templates/python-fastapi/pro/mvc/infra/main.tf.hbs +0 -83
- package/templates/python-fastapi/pro/mvc/infra/modules/ecs/main.tf.hbs +0 -54
- package/templates/python-fastapi/pro/mvc/infra/modules/rds/main.tf.hbs +0 -88
- package/templates/python-fastapi/pro/mvc/infra/modules/vpc/main.tf.hbs +0 -107
- package/templates/python-fastapi/pro/mvc/requirements.txt.hbs +0 -12
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
# VPC Module
|
|
2
|
-
|
|
3
|
-
variable "app_name" {
|
|
4
|
-
type = string
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
variable "environment" {
|
|
8
|
-
type = string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
# VPC
|
|
12
|
-
resource "aws_vpc" "main" {
|
|
13
|
-
cidr_block = "10.0.0.0/16"
|
|
14
|
-
enable_dns_hostnames = true
|
|
15
|
-
enable_dns_support = true
|
|
16
|
-
|
|
17
|
-
tags = {
|
|
18
|
-
Name = "${var.app_name}-${var.environment}-vpc"
|
|
19
|
-
Environment = var.environment
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
# Public Subnets
|
|
24
|
-
resource "aws_subnet" "public" {
|
|
25
|
-
count = 2
|
|
26
|
-
vpc_id = aws_vpc.main.id
|
|
27
|
-
cidr_block = "10.0.${count.index + 1}.0/24"
|
|
28
|
-
availability_zone = data.aws_availability_zones.available.names[count.index]
|
|
29
|
-
|
|
30
|
-
map_public_ip_on_launch = true
|
|
31
|
-
|
|
32
|
-
tags = {
|
|
33
|
-
Name = "${var.app_name}-${var.environment}-public-${count.index + 1}"
|
|
34
|
-
Environment = var.environment
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
# Private Subnets
|
|
39
|
-
resource "aws_subnet" "private" {
|
|
40
|
-
count = 2
|
|
41
|
-
vpc_id = aws_vpc.main.id
|
|
42
|
-
cidr_block = "10.0.${count.index + 10}.0/24"
|
|
43
|
-
availability_zone = data.aws_availability_zones.available.names[count.index]
|
|
44
|
-
|
|
45
|
-
tags = {
|
|
46
|
-
Name = "${var.app_name}-${var.environment}-private-${count.index + 1}"
|
|
47
|
-
Environment = var.environment
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
# Internet Gateway
|
|
52
|
-
resource "aws_internet_gateway" "main" {
|
|
53
|
-
vpc_id = aws_vpc.main.id
|
|
54
|
-
|
|
55
|
-
tags = {
|
|
56
|
-
Name = "${var.app_name}-${var.environment}-igw"
|
|
57
|
-
Environment = var.environment
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
# Data source for AZs
|
|
62
|
-
data "aws_availability_zones" "available" {
|
|
63
|
-
state = "available"
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
# Security Group for DB
|
|
67
|
-
resource "aws_security_group" "db" {
|
|
68
|
-
name = "${var.app_name}-${var.environment}-db-sg"
|
|
69
|
-
description = "Security group for database"
|
|
70
|
-
vpc_id = aws_vpc.main.id
|
|
71
|
-
|
|
72
|
-
ingress {
|
|
73
|
-
from_port = 5432
|
|
74
|
-
to_port = 5432
|
|
75
|
-
protocol = "tcp"
|
|
76
|
-
cidr_blocks = ["10.0.0.0/16"]
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
egress {
|
|
80
|
-
from_port = 0
|
|
81
|
-
to_port = 0
|
|
82
|
-
protocol = "-1"
|
|
83
|
-
cidr_blocks = ["0.0.0.0/0"]
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
tags = {
|
|
87
|
-
Name = "${var.app_name}-${var.environment}-db-sg"
|
|
88
|
-
Environment = var.environment
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
# Outputs
|
|
93
|
-
output "vpc_id" {
|
|
94
|
-
value = aws_vpc.main.id
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
output "public_subnet_ids" {
|
|
98
|
-
value = aws_subnet.public[*].id
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
output "private_subnet_ids" {
|
|
102
|
-
value = aws_subnet.private[*].id
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
output "db_security_group_id" {
|
|
106
|
-
value = aws_security_group.db.id
|
|
107
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{kebabCase projectName}}",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "Generated by Kybernus CLI (Pro)",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "nest start --watch",
|
|
7
|
-
"build": "nest build",
|
|
8
|
-
"start": "node dist/main.js",
|
|
9
|
-
"lint": "eslint \"{src,test}/**/*.ts\"",
|
|
10
|
-
"test": "jest"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@nestjs/common": "^10.3.0",
|
|
14
|
-
"@nestjs/core": "^10.3.0",
|
|
15
|
-
"@nestjs/config": "^3.1.1",
|
|
16
|
-
"@nestjs/jwt": "^10.2.0",
|
|
17
|
-
"@nestjs/passport": "^10.0.3",
|
|
18
|
-
"@nestjs/platform-express": "^10.3.0",
|
|
19
|
-
"bcryptjs": "^2.4.3",
|
|
20
|
-
"class-transformer": "^0.5.1",
|
|
21
|
-
"class-validator": "^0.14.1",
|
|
22
|
-
"passport": "^0.7.0",
|
|
23
|
-
"passport-jwt": "^4.0.1",
|
|
24
|
-
"reflect-metadata": "^0.2.1",
|
|
25
|
-
"rxjs": "^7.8.1",
|
|
26
|
-
"stripe": "^14.14.0",
|
|
27
|
-
"uuid": "^9.0.1"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@nestjs/cli": "^10.3.0",
|
|
31
|
-
"@types/bcryptjs": "^2.4.6",
|
|
32
|
-
"@types/node": "^20.11.0",
|
|
33
|
-
"@types/passport-jwt": "^4.0.0",
|
|
34
|
-
"@types/uuid": "^9.0.7",
|
|
35
|
-
"typescript": "^5.3.3"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
2
|
-
import { ConfigModule } from '@nestjs/config';
|
|
3
|
-
import { ItemsModule } from './modules/items.module';
|
|
4
|
-
import { AuthModule } from './auth/auth.module';
|
|
5
|
-
import { PaymentsModule } from './payments/payments.module';
|
|
6
|
-
import { HealthController } from './controllers/health.controller';
|
|
7
|
-
|
|
8
|
-
@Module({
|
|
9
|
-
imports: [
|
|
10
|
-
ConfigModule.forRoot({ isGlobal: true }),
|
|
11
|
-
AuthModule,
|
|
12
|
-
PaymentsModule,
|
|
13
|
-
ItemsModule,
|
|
14
|
-
],
|
|
15
|
-
controllers: [HealthController],
|
|
16
|
-
})
|
|
17
|
-
export class AppModule {}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Controller, Post, Body, Get, UseGuards, Request } from '@nestjs/common';
|
|
2
|
-
import { AuthGuard } from '@nestjs/passport';
|
|
3
|
-
import { AuthService } from './auth.service';
|
|
4
|
-
|
|
5
|
-
class RegisterDto {
|
|
6
|
-
email: string;
|
|
7
|
-
name: string;
|
|
8
|
-
password: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
class LoginDto {
|
|
12
|
-
email: string;
|
|
13
|
-
password: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@Controller('auth')
|
|
17
|
-
export class AuthController {
|
|
18
|
-
constructor(private authService: AuthService) {}
|
|
19
|
-
|
|
20
|
-
@Post('register')
|
|
21
|
-
async register(@Body() dto: RegisterDto) {
|
|
22
|
-
return this.authService.register(dto.email, dto.name, dto.password);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Post('login')
|
|
26
|
-
async login(@Body() dto: LoginDto) {
|
|
27
|
-
return this.authService.login(dto.email, dto.password);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Get('me')
|
|
31
|
-
@UseGuards(AuthGuard('jwt'))
|
|
32
|
-
async me(@Request() req: any) {
|
|
33
|
-
return { user: req.user };
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
2
|
-
import { JwtModule } from '@nestjs/jwt';
|
|
3
|
-
import { PassportModule } from '@nestjs/passport';
|
|
4
|
-
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
5
|
-
import { AuthController } from './auth.controller';
|
|
6
|
-
import { AuthService } from './auth.service';
|
|
7
|
-
import { JwtStrategy } from './jwt.strategy';
|
|
8
|
-
|
|
9
|
-
@Module({
|
|
10
|
-
imports: [
|
|
11
|
-
PassportModule.register({ defaultStrategy: 'jwt' }),
|
|
12
|
-
JwtModule.registerAsync({
|
|
13
|
-
imports: [ConfigModule],
|
|
14
|
-
useFactory: (configService: ConfigService) => ({
|
|
15
|
-
secret: configService.get('JWT_SECRET', 'your-secret-key'),
|
|
16
|
-
signOptions: { expiresIn: '7d' },
|
|
17
|
-
}),
|
|
18
|
-
inject: [ConfigService],
|
|
19
|
-
}),
|
|
20
|
-
],
|
|
21
|
-
controllers: [AuthController],
|
|
22
|
-
providers: [AuthService, JwtStrategy],
|
|
23
|
-
exports: [AuthService],
|
|
24
|
-
})
|
|
25
|
-
export class AuthModule {}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { JwtService } from '@nestjs/jwt';
|
|
3
|
-
import * as bcrypt from 'bcryptjs';
|
|
4
|
-
|
|
5
|
-
interface User {
|
|
6
|
-
id: string;
|
|
7
|
-
email: string;
|
|
8
|
-
name: string;
|
|
9
|
-
password: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@Injectable()
|
|
13
|
-
export class AuthService {
|
|
14
|
-
private users: Map<string, User> = new Map();
|
|
15
|
-
|
|
16
|
-
constructor(private jwtService: JwtService) {}
|
|
17
|
-
|
|
18
|
-
async register(email: string, name: string, password: string) {
|
|
19
|
-
if (this.users.has(email)) {
|
|
20
|
-
throw new Error('User already exists');
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const hashedPassword = await bcrypt.hash(password, 10);
|
|
24
|
-
const user: User = {
|
|
25
|
-
id: Date.now().toString(),
|
|
26
|
-
email,
|
|
27
|
-
name,
|
|
28
|
-
password: hashedPassword,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
this.users.set(email, user);
|
|
32
|
-
const token = this.jwtService.sign({ sub: user.id, email: user.email });
|
|
33
|
-
|
|
34
|
-
return { token, user: { id: user.id, email: user.email, name: user.name } };
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async login(email: string, password: string) {
|
|
38
|
-
const user = this.users.get(email);
|
|
39
|
-
if (!user || !(await bcrypt.compare(password, user.password))) {
|
|
40
|
-
throw new Error('Invalid credentials');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const token = this.jwtService.sign({ sub: user.id, email: user.email });
|
|
44
|
-
return { token, user: { id: user.id, email: user.email, name: user.name } };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async validateUser(userId: string) {
|
|
48
|
-
for (const user of this.users.values()) {
|
|
49
|
-
if (user.id === userId) {
|
|
50
|
-
return { id: user.id, email: user.email, name: user.name };
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { PassportStrategy } from '@nestjs/passport';
|
|
3
|
-
import { ExtractJwt, Strategy } from 'passport-jwt';
|
|
4
|
-
import { ConfigService } from '@nestjs/config';
|
|
5
|
-
|
|
6
|
-
@Injectable()
|
|
7
|
-
export class JwtStrategy extends PassportStrategy(Strategy) {
|
|
8
|
-
constructor(configService: ConfigService) {
|
|
9
|
-
super({
|
|
10
|
-
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
|
11
|
-
ignoreExpiration: false,
|
|
12
|
-
secretOrKey: configService.get('JWT_SECRET', 'your-secret-key'),
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async validate(payload: any) {
|
|
17
|
-
return { userId: payload.sub, email: payload.email };
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Controller, Get, Post, Delete, Param, Body, NotFoundException } from '@nestjs/common';
|
|
2
|
-
import { ItemsService } from '../services/items.service';
|
|
3
|
-
import { CreateItemDto } from '../models/create-item.dto';
|
|
4
|
-
|
|
5
|
-
@Controller('items')
|
|
6
|
-
export class ItemsController {
|
|
7
|
-
constructor(private readonly itemsService: ItemsService) {}
|
|
8
|
-
|
|
9
|
-
@Get()
|
|
10
|
-
findAll() {
|
|
11
|
-
return this.itemsService.findAll();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@Get(':id')
|
|
15
|
-
findOne(@Param('id') id: string) {
|
|
16
|
-
const item = this.itemsService.findOne(id);
|
|
17
|
-
if (!item) throw new NotFoundException('Item not found');
|
|
18
|
-
return item;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@Post()
|
|
22
|
-
create(@Body() createItemDto: CreateItemDto) {
|
|
23
|
-
return this.itemsService.create(createItemDto);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@Delete(':id')
|
|
27
|
-
remove(@Param('id') id: string) {
|
|
28
|
-
const deleted = this.itemsService.remove(id);
|
|
29
|
-
if (!deleted) throw new NotFoundException('Item not found');
|
|
30
|
-
return { message: 'Item deleted' };
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { NestFactory } from '@nestjs/core';
|
|
2
|
-
import { AppModule } from './app.module';
|
|
3
|
-
import { ValidationPipe } from '@nestjs/common';
|
|
4
|
-
|
|
5
|
-
async function bootstrap() {
|
|
6
|
-
const app = await NestFactory.create(AppModule);
|
|
7
|
-
|
|
8
|
-
app.enableCors();
|
|
9
|
-
app.setGlobalPrefix('api');
|
|
10
|
-
app.useGlobalPipes(new ValidationPipe({ whitelist: true }));
|
|
11
|
-
|
|
12
|
-
const port = process.env.PORT || 3000;
|
|
13
|
-
await app.listen(port);
|
|
14
|
-
|
|
15
|
-
console.log(`🚀 {{pascalCase projectName}} running on port ${port}`);
|
|
16
|
-
}
|
|
17
|
-
bootstrap();
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
2
|
-
import { ItemsController } from '../controllers/items.controller';
|
|
3
|
-
import { ItemsService } from '../services/items.service';
|
|
4
|
-
|
|
5
|
-
@Module({
|
|
6
|
-
controllers: [ItemsController],
|
|
7
|
-
providers: [ItemsService],
|
|
8
|
-
})
|
|
9
|
-
export class ItemsModule {}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Controller, Post, Body, Headers, UseGuards, RawBodyRequest, Req } from '@nestjs/common';
|
|
2
|
-
import { AuthGuard } from '@nestjs/passport';
|
|
3
|
-
import { PaymentsService } from './payments.service';
|
|
4
|
-
import { Request } from 'express';
|
|
5
|
-
|
|
6
|
-
class CreateCheckoutDto {
|
|
7
|
-
priceId: string;
|
|
8
|
-
customerId?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
@Controller('payments')
|
|
12
|
-
export class PaymentsController {
|
|
13
|
-
constructor(private paymentsService: PaymentsService) {}
|
|
14
|
-
|
|
15
|
-
@Post('checkout')
|
|
16
|
-
@UseGuards(AuthGuard('jwt'))
|
|
17
|
-
async createCheckout(@Body() dto: CreateCheckoutDto) {
|
|
18
|
-
const session = await this.paymentsService.createCheckoutSession(dto.priceId, dto.customerId);
|
|
19
|
-
return { url: session.url };
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@Post('webhook')
|
|
23
|
-
async webhook(@Req() req: RawBodyRequest<Request>, @Headers('stripe-signature') signature: string) {
|
|
24
|
-
return this.paymentsService.handleWebhook(req.rawBody!, signature);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
2
|
-
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
3
|
-
import { PaymentsController } from './payments.controller';
|
|
4
|
-
import { PaymentsService } from './payments.service';
|
|
5
|
-
|
|
6
|
-
@Module({
|
|
7
|
-
imports: [ConfigModule],
|
|
8
|
-
controllers: [PaymentsController],
|
|
9
|
-
providers: [PaymentsService],
|
|
10
|
-
})
|
|
11
|
-
export class PaymentsModule {}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { ConfigService } from '@nestjs/config';
|
|
3
|
-
import Stripe from 'stripe';
|
|
4
|
-
|
|
5
|
-
@Injectable()
|
|
6
|
-
export class PaymentsService {
|
|
7
|
-
private stripe: Stripe;
|
|
8
|
-
|
|
9
|
-
constructor(private configService: ConfigService) {
|
|
10
|
-
this.stripe = new Stripe(configService.get('STRIPE_SECRET_KEY', ''), {
|
|
11
|
-
apiVersion: '2024-12-18.acacia',
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async createCheckoutSession(priceId: string, customerId?: string) {
|
|
16
|
-
const session = await this.stripe.checkout.sessions.create({
|
|
17
|
-
mode: 'subscription',
|
|
18
|
-
payment_method_types: ['card'],
|
|
19
|
-
line_items: [{ price: priceId, quantity: 1 }],
|
|
20
|
-
customer: customerId || undefined,
|
|
21
|
-
success_url: `${this.configService.get('FRONTEND_URL')}/success?session_id={CHECKOUT_SESSION_ID}`,
|
|
22
|
-
cancel_url: `${this.configService.get('FRONTEND_URL')}/cancel`,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
return session;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async handleWebhook(payload: Buffer, signature: string) {
|
|
29
|
-
const webhookSecret = this.configService.get('STRIPE_WEBHOOK_SECRET', '');
|
|
30
|
-
const event = this.stripe.webhooks.constructEvent(payload, signature, webhookSecret);
|
|
31
|
-
|
|
32
|
-
switch (event.type) {
|
|
33
|
-
case 'checkout.session.completed':
|
|
34
|
-
console.log('Checkout completed:', event.data.object);
|
|
35
|
-
break;
|
|
36
|
-
case 'customer.subscription.updated':
|
|
37
|
-
console.log('Subscription updated:', event.data.object);
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return { received: true };
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { CreateItemDto } from '../models/create-item.dto';
|
|
3
|
-
import { Item } from '../models/item.model';
|
|
4
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
-
|
|
6
|
-
@Injectable()
|
|
7
|
-
export class ItemsService {
|
|
8
|
-
private items: Map<string, Item> = new Map();
|
|
9
|
-
|
|
10
|
-
findAll(): Item[] {
|
|
11
|
-
return Array.from(this.items.values());
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
findOne(id: string): Item | undefined {
|
|
15
|
-
return this.items.get(id);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
create(dto: CreateItemDto): Item {
|
|
19
|
-
const item: Item = {
|
|
20
|
-
id: uuidv4(),
|
|
21
|
-
name: dto.name,
|
|
22
|
-
description: dto.description,
|
|
23
|
-
createdAt: new Date(),
|
|
24
|
-
};
|
|
25
|
-
this.items.set(item.id, item);
|
|
26
|
-
return item;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
remove(id: string): boolean {
|
|
30
|
-
return this.items.delete(id);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"removeComments": true,
|
|
6
|
-
"emitDecoratorMetadata": true,
|
|
7
|
-
"experimentalDecorators": true,
|
|
8
|
-
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"target": "ES2021",
|
|
10
|
-
"sourceMap": true,
|
|
11
|
-
"outDir": "./dist",
|
|
12
|
-
"baseUrl": "./",
|
|
13
|
-
"incremental": true,
|
|
14
|
-
"skipLibCheck": true,
|
|
15
|
-
"strictNullChecks": true,
|
|
16
|
-
"noImplicitAny": true,
|
|
17
|
-
"strictBindCallApply": true,
|
|
18
|
-
"forceConsistentCasingInFileNames": true,
|
|
19
|
-
"noFallthroughCasesInSwitch": true
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# {{projectName}} Environment Variables
|
|
2
|
-
|
|
3
|
-
# NextAuth
|
|
4
|
-
NEXTAUTH_URL=http://localhost:3000
|
|
5
|
-
NEXTAUTH_SECRET=your-nextauth-secret-change-in-production
|
|
6
|
-
|
|
7
|
-
# Google OAuth (optional)
|
|
8
|
-
GOOGLE_CLIENT_ID=your-google-client-id
|
|
9
|
-
GOOGLE_CLIENT_SECRET=your-google-client-secret
|
|
10
|
-
|
|
11
|
-
# Database
|
|
12
|
-
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/{{projectNameSnakeCase}}"
|
|
13
|
-
|
|
14
|
-
# Stripe
|
|
15
|
-
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
|
|
16
|
-
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
|
|
17
|
-
STRIPE_PRICE_ID=price_your_price_id
|
|
18
|
-
|
|
19
|
-
# App URL
|
|
20
|
-
NEXT_PUBLIC_APP_URL=http://localhost:3000
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
name: CI/CD Pipeline
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main, develop]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [main]
|
|
8
|
-
|
|
9
|
-
env:
|
|
10
|
-
NODE_VERSION: '20'
|
|
11
|
-
AWS_REGION: 'us-east-1'
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
test:
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
|
|
20
|
-
- name: Setup Node.js
|
|
21
|
-
uses: actions/setup-node@v4
|
|
22
|
-
with:
|
|
23
|
-
node-version: $\{{ env.NODE_VERSION }}
|
|
24
|
-
cache: 'npm'
|
|
25
|
-
|
|
26
|
-
- name: Install dependencies
|
|
27
|
-
run: npm ci
|
|
28
|
-
|
|
29
|
-
- name: Run linter
|
|
30
|
-
run: npm run lint --if-present
|
|
31
|
-
|
|
32
|
-
- name: Run tests
|
|
33
|
-
run: npm test --if-present
|
|
34
|
-
|
|
35
|
-
- name: Build
|
|
36
|
-
run: npm run build
|
|
37
|
-
|
|
38
|
-
build-and-push:
|
|
39
|
-
needs: test
|
|
40
|
-
runs-on: ubuntu-latest
|
|
41
|
-
if: github.ref == 'refs/heads/main'
|
|
42
|
-
|
|
43
|
-
steps:
|
|
44
|
-
- uses: actions/checkout@v4
|
|
45
|
-
|
|
46
|
-
- name: Configure AWS credentials
|
|
47
|
-
uses: aws-actions/configure-aws-credentials@v4
|
|
48
|
-
with:
|
|
49
|
-
aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
|
|
50
|
-
aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
51
|
-
aws-region: $\{{ env.AWS_REGION }}
|
|
52
|
-
|
|
53
|
-
- name: Login to Amazon ECR
|
|
54
|
-
id: login-ecr
|
|
55
|
-
uses: aws-actions/amazon-ecr-login@v2
|
|
56
|
-
|
|
57
|
-
- name: Build, tag, and push image to Amazon ECR
|
|
58
|
-
env:
|
|
59
|
-
ECR_REGISTRY: $\{{ steps.login-ecr.outputs.registry }}
|
|
60
|
-
ECR_REPOSITORY: {{projectNameKebabCase}}
|
|
61
|
-
IMAGE_TAG: $\{{ github.sha }}
|
|
62
|
-
run: |
|
|
63
|
-
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
|
64
|
-
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
|
|
65
|
-
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
|
66
|
-
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
|
|
67
|
-
|
|
68
|
-
deploy:
|
|
69
|
-
needs: build-and-push
|
|
70
|
-
runs-on: ubuntu-latest
|
|
71
|
-
if: github.ref == 'refs/heads/main'
|
|
72
|
-
|
|
73
|
-
steps:
|
|
74
|
-
- uses: actions/checkout@v4
|
|
75
|
-
|
|
76
|
-
- name: Configure AWS credentials
|
|
77
|
-
uses: aws-actions/configure-aws-credentials@v4
|
|
78
|
-
with:
|
|
79
|
-
aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
|
|
80
|
-
aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
81
|
-
aws-region: $\{{ env.AWS_REGION }}
|
|
82
|
-
|
|
83
|
-
- name: Deploy to ECS
|
|
84
|
-
run: |
|
|
85
|
-
aws ecs update-service \
|
|
86
|
-
--cluster {{projectNameKebabCase}}-prod \
|
|
87
|
-
--service {{projectNameKebabCase}}-api \
|
|
88
|
-
--force-new-deployment
|