kybernus 1.0.1 → 1.1.3
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/README.md +48 -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/commands/upgrade.js +2 -2
- 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/free/mvc/README.md.hbs +0 -28
- package/templates/nestjs/free/mvc/package.json.hbs +0 -29
- package/templates/nestjs/free/mvc/src/app.module.ts.hbs +0 -13
- package/templates/nestjs/free/mvc/src/controllers/health.controller.ts.hbs +0 -9
- package/templates/nestjs/free/mvc/src/controllers/items.controller.ts.hbs +0 -32
- package/templates/nestjs/free/mvc/src/main.ts.hbs +0 -17
- package/templates/nestjs/free/mvc/src/models/create-item.dto.ts.hbs +0 -10
- package/templates/nestjs/free/mvc/src/models/item.model.ts.hbs +0 -6
- package/templates/nestjs/free/mvc/src/modules/items.module.ts.hbs +0 -9
- package/templates/nestjs/free/mvc/src/services/items.service.ts.hbs +0 -32
- package/templates/nestjs/free/mvc/tsconfig.json.hbs +0 -21
- 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/free/mvc/README.md.hbs +0 -41
- package/templates/python-fastapi/free/mvc/app/controllers/health.py.hbs +0 -7
- package/templates/python-fastapi/free/mvc/app/controllers/items.py.hbs +0 -27
- package/templates/python-fastapi/free/mvc/app/main.py.hbs +0 -26
- package/templates/python-fastapi/free/mvc/app/models/item.py.hbs +0 -11
- package/templates/python-fastapi/free/mvc/app/schemas/item.py.hbs +0 -17
- package/templates/python-fastapi/free/mvc/app/services/item_service.py.hbs +0 -33
- package/templates/python-fastapi/free/mvc/requirements.txt.hbs +0 -4
- 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,14 +0,0 @@
|
|
|
1
|
-
import { Router } from 'express';
|
|
2
|
-
import healthController from '../controllers/healthController';
|
|
3
|
-
|
|
4
|
-
const router = Router();
|
|
5
|
-
|
|
6
|
-
// Health check endpoint
|
|
7
|
-
router.get('/health', healthController.check);
|
|
8
|
-
|
|
9
|
-
// Add your routes here
|
|
10
|
-
// Example:
|
|
11
|
-
// import userRoutes from './userRoutes';
|
|
12
|
-
// router.use('/users', userRoutes);
|
|
13
|
-
|
|
14
|
-
export default router;
|
|
File without changes
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import Stripe from 'stripe';
|
|
2
|
-
|
|
3
|
-
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || '', {
|
|
4
|
-
apiVersion: '2024-12-18.acacia',
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
export interface CreateCheckoutSessionParams {
|
|
8
|
-
priceId: string;
|
|
9
|
-
customerId?: string;
|
|
10
|
-
successUrl: string;
|
|
11
|
-
cancelUrl: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class StripeService {
|
|
15
|
-
/**
|
|
16
|
-
* Create a checkout session for subscription
|
|
17
|
-
*/
|
|
18
|
-
async createCheckoutSession(params: CreateCheckoutSessionParams) {
|
|
19
|
-
const session = await stripe.checkout.sessions.create({
|
|
20
|
-
mode: 'subscription',
|
|
21
|
-
payment_method_types: ['card'],
|
|
22
|
-
line_items: [
|
|
23
|
-
{
|
|
24
|
-
price: params.priceId,
|
|
25
|
-
quantity: 1,
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
customer: params.customerId,
|
|
29
|
-
success_url: params.successUrl,
|
|
30
|
-
cancel_url: params.cancelUrl,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
return session;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Create a customer portal session
|
|
38
|
-
*/
|
|
39
|
-
async createPortalSession(customerId: string, returnUrl: string) {
|
|
40
|
-
const session = await stripe.billingPortal.sessions.create({
|
|
41
|
-
customer: customerId,
|
|
42
|
-
return_url: returnUrl,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return session;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Handle webhook event
|
|
50
|
-
*/
|
|
51
|
-
async handleWebhook(rawBody: Buffer, signature: string) {
|
|
52
|
-
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET || '';
|
|
53
|
-
|
|
54
|
-
const event = stripe.webhooks.constructEvent(
|
|
55
|
-
rawBody,
|
|
56
|
-
signature,
|
|
57
|
-
webhookSecret
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
switch (event.type) {
|
|
61
|
-
case 'checkout.session.completed':
|
|
62
|
-
const session = event.data.object;
|
|
63
|
-
// Handle successful subscription
|
|
64
|
-
console.log('Checkout completed:', session.id);
|
|
65
|
-
break;
|
|
66
|
-
|
|
67
|
-
case 'customer.subscription.updated':
|
|
68
|
-
const subscription = event.data.object;
|
|
69
|
-
// Handle subscription update
|
|
70
|
-
console.log('Subscription updated:', subscription.id);
|
|
71
|
-
break;
|
|
72
|
-
|
|
73
|
-
case 'customer.subscription.deleted':
|
|
74
|
-
const deletedSubscription = event.data.object;
|
|
75
|
-
// Handle subscription cancellation
|
|
76
|
-
console.log('Subscription deleted:', deletedSubscription.id);
|
|
77
|
-
break;
|
|
78
|
-
|
|
79
|
-
case 'invoice.payment_failed':
|
|
80
|
-
const invoice = event.data.object;
|
|
81
|
-
// Handle failed payment
|
|
82
|
-
console.log('Payment failed:', invoice.id);
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return { received: true };
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Create a Stripe customer
|
|
91
|
-
*/
|
|
92
|
-
async createCustomer(email: string, name?: string) {
|
|
93
|
-
const customer = await stripe.customers.create({
|
|
94
|
-
email,
|
|
95
|
-
name,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
return customer;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export const stripeService = new StripeService();
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Node.js Express MVC",
|
|
3
|
-
"tier": "free",
|
|
4
|
-
"stack": "nodejs-express",
|
|
5
|
-
"version": "1.0.0",
|
|
6
|
-
"description": "Express.js REST API with TypeScript and MVC architecture",
|
|
7
|
-
"targetVersions": {
|
|
8
|
-
"node": ">=18.0.0",
|
|
9
|
-
"express": "^4.18.0",
|
|
10
|
-
"typescript": "^5.0.0"
|
|
11
|
-
},
|
|
12
|
-
"requiredConfig": [
|
|
13
|
-
"projectName"
|
|
14
|
-
],
|
|
15
|
-
"optionalConfig": [
|
|
16
|
-
"useAI"
|
|
17
|
-
]
|
|
18
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"lib": [
|
|
6
|
-
"ES2022"
|
|
7
|
-
],
|
|
8
|
-
"outDir": "./dist",
|
|
9
|
-
"rootDir": "./src",
|
|
10
|
-
"strict": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
"forceConsistentCasingInFileNames": true,
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"moduleResolution": "node",
|
|
16
|
-
"types": [
|
|
17
|
-
"node"
|
|
18
|
-
]
|
|
19
|
-
},
|
|
20
|
-
"include": [
|
|
21
|
-
"src/**/*"
|
|
22
|
-
],
|
|
23
|
-
"exclude": [
|
|
24
|
-
"node_modules",
|
|
25
|
-
"dist"
|
|
26
|
-
]
|
|
27
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# {{projectName}}
|
|
2
|
-
|
|
3
|
-
> Generated by [Kybernus CLI](https://kybernus.dev) 🚀 (Free)
|
|
4
|
-
|
|
5
|
-
## Stack
|
|
6
|
-
|
|
7
|
-
- **Framework**: FastAPI
|
|
8
|
-
- **Python**: 3.11+
|
|
9
|
-
- **Validation**: Pydantic v2
|
|
10
|
-
|
|
11
|
-
## Quick Start
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
# Create virtual environment
|
|
15
|
-
python -m venv venv
|
|
16
|
-
source venv/bin/activate # Linux/Mac
|
|
17
|
-
# or: venv\Scripts\activate # Windows
|
|
18
|
-
|
|
19
|
-
# Install dependencies
|
|
20
|
-
pip install -r requirements.txt
|
|
21
|
-
|
|
22
|
-
# Run development server
|
|
23
|
-
uvicorn app.main:app --reload
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## API Endpoints
|
|
27
|
-
|
|
28
|
-
- `GET /api/health` - Health check
|
|
29
|
-
- `GET /api/items` - List items
|
|
30
|
-
- `POST /api/items` - Create item
|
|
31
|
-
- `GET /api/items/{id}` - Get item
|
|
32
|
-
- `DELETE /api/items/{id}` - Delete item
|
|
33
|
-
|
|
34
|
-
## Documentation
|
|
35
|
-
|
|
36
|
-
- Swagger UI: http://localhost:8000/docs
|
|
37
|
-
- ReDoc: http://localhost:8000/redoc
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
Made with ❤️ using [Kybernus](https://kybernus.dev)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
from fastapi import APIRouter, HTTPException
|
|
2
|
-
from typing import List
|
|
3
|
-
from app.schemas.item import ItemCreate, ItemResponse
|
|
4
|
-
from app.services.item_service import ItemService
|
|
5
|
-
|
|
6
|
-
router = APIRouter()
|
|
7
|
-
item_service = ItemService()
|
|
8
|
-
|
|
9
|
-
@router.get("/", response_model=List[ItemResponse])
|
|
10
|
-
async def get_items():
|
|
11
|
-
return item_service.get_all()
|
|
12
|
-
|
|
13
|
-
@router.get("/{item_id}", response_model=ItemResponse)
|
|
14
|
-
async def get_item(item_id: str):
|
|
15
|
-
item = item_service.get_by_id(item_id)
|
|
16
|
-
if not item:
|
|
17
|
-
raise HTTPException(status_code=404, detail="Item not found")
|
|
18
|
-
return item
|
|
19
|
-
|
|
20
|
-
@router.post("/", response_model=ItemResponse, status_code=201)
|
|
21
|
-
async def create_item(item: ItemCreate):
|
|
22
|
-
return item_service.create(item)
|
|
23
|
-
|
|
24
|
-
@router.delete("/{item_id}", status_code=204)
|
|
25
|
-
async def delete_item(item_id: str):
|
|
26
|
-
if not item_service.delete(item_id):
|
|
27
|
-
raise HTTPException(status_code=404, detail="Item not found")
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from fastapi import FastAPI
|
|
2
|
-
from fastapi.middleware.cors import CORSMiddleware
|
|
3
|
-
from app.controllers import health, items
|
|
4
|
-
|
|
5
|
-
app = FastAPI(
|
|
6
|
-
title="{{projectNamePascalCase}}",
|
|
7
|
-
description="Generated by Kybernus CLI",
|
|
8
|
-
version="1.0.0"
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
# CORS
|
|
12
|
-
app.add_middleware(
|
|
13
|
-
CORSMiddleware,
|
|
14
|
-
allow_origins=["*"],
|
|
15
|
-
allow_credentials=True,
|
|
16
|
-
allow_methods=["*"],
|
|
17
|
-
allow_headers=["*"],
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
# Routes
|
|
21
|
-
app.include_router(health.router, prefix="/api", tags=["Health"])
|
|
22
|
-
app.include_router(items.router, prefix="/api/items", tags=["Items"])
|
|
23
|
-
|
|
24
|
-
@app.get("/")
|
|
25
|
-
async def root():
|
|
26
|
-
return {"message": "Welcome to {{projectNamePascalCase}} API"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass, field
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from typing import Optional
|
|
4
|
-
import uuid
|
|
5
|
-
|
|
6
|
-
@dataclass
|
|
7
|
-
class Item:
|
|
8
|
-
id: str = field(default_factory=lambda: str(uuid.uuid4()))
|
|
9
|
-
name: str = ""
|
|
10
|
-
description: Optional[str] = None
|
|
11
|
-
created_at: datetime = field(default_factory=datetime.now)
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from pydantic import BaseModel
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from typing import Optional
|
|
4
|
-
|
|
5
|
-
class ItemBase(BaseModel):
|
|
6
|
-
name: str
|
|
7
|
-
description: Optional[str] = None
|
|
8
|
-
|
|
9
|
-
class ItemCreate(ItemBase):
|
|
10
|
-
pass
|
|
11
|
-
|
|
12
|
-
class ItemResponse(ItemBase):
|
|
13
|
-
id: str
|
|
14
|
-
created_at: datetime
|
|
15
|
-
|
|
16
|
-
class Config:
|
|
17
|
-
from_attributes = True
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from typing import List, Optional
|
|
2
|
-
from app.models.item import Item
|
|
3
|
-
from app.schemas.item import ItemCreate
|
|
4
|
-
from datetime import datetime
|
|
5
|
-
import uuid
|
|
6
|
-
|
|
7
|
-
class ItemService:
|
|
8
|
-
"""Item Service - Business Logic Layer"""
|
|
9
|
-
|
|
10
|
-
def __init__(self):
|
|
11
|
-
self._items: dict[str, Item] = {}
|
|
12
|
-
|
|
13
|
-
def get_all(self) -> List[Item]:
|
|
14
|
-
return list(self._items.values())
|
|
15
|
-
|
|
16
|
-
def get_by_id(self, item_id: str) -> Optional[Item]:
|
|
17
|
-
return self._items.get(item_id)
|
|
18
|
-
|
|
19
|
-
def create(self, data: ItemCreate) -> Item:
|
|
20
|
-
item = Item(
|
|
21
|
-
id=str(uuid.uuid4()),
|
|
22
|
-
name=data.name,
|
|
23
|
-
description=data.description,
|
|
24
|
-
created_at=datetime.now()
|
|
25
|
-
)
|
|
26
|
-
self._items[item.id] = item
|
|
27
|
-
return item
|
|
28
|
-
|
|
29
|
-
def delete(self, item_id: str) -> bool:
|
|
30
|
-
if item_id in self._items:
|
|
31
|
-
del self._items[item_id]
|
|
32
|
-
return True
|
|
33
|
-
return False
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# {{projectName}} Environment Variables
|
|
2
|
-
|
|
3
|
-
# Server
|
|
4
|
-
PORT=8000
|
|
5
|
-
|
|
6
|
-
# Database
|
|
7
|
-
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/{{projectNameSnakeCase}}
|
|
8
|
-
|
|
9
|
-
# JWT
|
|
10
|
-
JWT_SECRET=your-super-secret-jwt-key-change-in-production
|
|
11
|
-
|
|
12
|
-
# Stripe
|
|
13
|
-
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
|
|
14
|
-
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
|
|
15
|
-
|
|
16
|
-
# Frontend
|
|
17
|
-
FRONTEND_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
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Production Dockerfile for {{projectName}}
|
|
2
|
-
|
|
3
|
-
FROM python:3.11-slim
|
|
4
|
-
|
|
5
|
-
WORKDIR /app
|
|
6
|
-
|
|
7
|
-
# Install dependencies
|
|
8
|
-
COPY requirements.txt .
|
|
9
|
-
RUN pip install --no-cache-dir -r requirements.txt
|
|
10
|
-
|
|
11
|
-
# Copy source
|
|
12
|
-
COPY . .
|
|
13
|
-
|
|
14
|
-
# Create non-root user
|
|
15
|
-
RUN adduser --disabled-password --gecos "" appuser
|
|
16
|
-
USER appuser
|
|
17
|
-
|
|
18
|
-
EXPOSE 8000
|
|
19
|
-
|
|
20
|
-
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass, field
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from typing import Optional
|
|
4
|
-
import uuid
|
|
5
|
-
|
|
6
|
-
@dataclass
|
|
7
|
-
class User:
|
|
8
|
-
"""User Entity - Domain Layer"""
|
|
9
|
-
email: str
|
|
10
|
-
name: str
|
|
11
|
-
password: str
|
|
12
|
-
id: str = field(default_factory=lambda: str(uuid.uuid4()))
|
|
13
|
-
stripe_customer_id: Optional[str] = None
|
|
14
|
-
created_at: datetime = field(default_factory=datetime.now)
|
|
15
|
-
|
|
16
|
-
def __post_init__(self):
|
|
17
|
-
if "@" not in self.email:
|
|
18
|
-
raise ValueError("Invalid email format")
|
|
19
|
-
if len(self.password) < 8:
|
|
20
|
-
raise ValueError("Password must be at least 8 characters")
|
|
21
|
-
|
|
22
|
-
def set_stripe_customer_id(self, customer_id: str):
|
|
23
|
-
self.stripe_customer_id = customer_id
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
from abc import ABC, abstractmethod
|
|
2
|
-
from typing import Optional, List
|
|
3
|
-
from app.domain.entities.user import User
|
|
4
|
-
|
|
5
|
-
class IUserRepository(ABC):
|
|
6
|
-
"""User Repository Interface - Domain Layer"""
|
|
7
|
-
|
|
8
|
-
@abstractmethod
|
|
9
|
-
async def find_by_id(self, user_id: str) -> Optional[User]:
|
|
10
|
-
pass
|
|
11
|
-
|
|
12
|
-
@abstractmethod
|
|
13
|
-
async def find_by_email(self, email: str) -> Optional[User]:
|
|
14
|
-
pass
|
|
15
|
-
|
|
16
|
-
@abstractmethod
|
|
17
|
-
async def save(self, user: User) -> User:
|
|
18
|
-
pass
|
|
19
|
-
|
|
20
|
-
@abstractmethod
|
|
21
|
-
async def delete(self, user_id: str) -> None:
|
|
22
|
-
pass
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
from app.domain.entities.user import User
|
|
2
|
-
from app.domain.repositories.user_repository import IUserRepository
|
|
3
|
-
from typing import Protocol
|
|
4
|
-
|
|
5
|
-
class IPasswordHasher(Protocol):
|
|
6
|
-
def hash(self, password: str) -> str: ...
|
|
7
|
-
def verify(self, password: str, hashed: str) -> bool: ...
|
|
8
|
-
|
|
9
|
-
class ITokenGenerator(Protocol):
|
|
10
|
-
def generate(self, user_id: str, email: str) -> str: ...
|
|
11
|
-
|
|
12
|
-
class RegisterUserUseCase:
|
|
13
|
-
"""Register User Use Case - Domain Layer"""
|
|
14
|
-
|
|
15
|
-
def __init__(self, repository: IUserRepository, hasher: IPasswordHasher, token_gen: ITokenGenerator):
|
|
16
|
-
self.repository = repository
|
|
17
|
-
self.hasher = hasher
|
|
18
|
-
self.token_gen = token_gen
|
|
19
|
-
|
|
20
|
-
async def execute(self, email: str, name: str, password: str):
|
|
21
|
-
existing = await self.repository.find_by_email(email)
|
|
22
|
-
if existing:
|
|
23
|
-
raise ValueError("User already exists")
|
|
24
|
-
|
|
25
|
-
hashed = self.hasher.hash(password)
|
|
26
|
-
user = User(email=email, name=name, password=hashed)
|
|
27
|
-
saved_user = await self.repository.save(user)
|
|
28
|
-
token = self.token_gen.generate(saved_user.id, saved_user.email)
|
|
29
|
-
|
|
30
|
-
return {"user": saved_user, "token": token}
|
package/templates/python-fastapi/pro/clean/app/infrastructure/database/in_memory_repository.py.hbs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from app.domain.repositories.user_repository import IUserRepository
|
|
2
|
-
from app.domain.entities.user import User
|
|
3
|
-
from typing import Optional
|
|
4
|
-
|
|
5
|
-
class InMemoryUserRepository(IUserRepository):
|
|
6
|
-
"""In-Memory User Repository - Infrastructure Layer"""
|
|
7
|
-
|
|
8
|
-
def __init__(self):
|
|
9
|
-
self._users: dict[str, User] = {}
|
|
10
|
-
|
|
11
|
-
async def find_by_id(self, user_id: str) -> Optional[User]:
|
|
12
|
-
return self._users.get(user_id)
|
|
13
|
-
|
|
14
|
-
async def find_by_email(self, email: str) -> Optional[User]:
|
|
15
|
-
for user in self._users.values():
|
|
16
|
-
if user.email == email:
|
|
17
|
-
return user
|
|
18
|
-
return None
|
|
19
|
-
|
|
20
|
-
async def save(self, user: User) -> User:
|
|
21
|
-
self._users[user.id] = user
|
|
22
|
-
return user
|
|
23
|
-
|
|
24
|
-
async def delete(self, user_id: str) -> None:
|
|
25
|
-
if user_id in self._users:
|
|
26
|
-
del self._users[user_id]
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from fastapi import APIRouter, HTTPException, Depends
|
|
2
|
-
from pydantic import BaseModel, EmailStr
|
|
3
|
-
from app.domain.usecases.register_user import RegisterUserUseCase
|
|
4
|
-
from app.infrastructure.database.in_memory_repository import InMemoryUserRepository
|
|
5
|
-
from app.infrastructure.security.adapters import BcryptHasher, JwtTokenGenerator
|
|
6
|
-
|
|
7
|
-
router = APIRouter()
|
|
8
|
-
|
|
9
|
-
# Dependency Injection
|
|
10
|
-
repo = InMemoryUserRepository()
|
|
11
|
-
hasher = BcryptHasher()
|
|
12
|
-
token_gen = JwtTokenGenerator()
|
|
13
|
-
register_usecase = RegisterUserUseCase(repo, hasher, token_gen)
|
|
14
|
-
|
|
15
|
-
class RegisterRequest(BaseModel):
|
|
16
|
-
email: EmailStr
|
|
17
|
-
name: str
|
|
18
|
-
password: str
|
|
19
|
-
|
|
20
|
-
@router.post("/register")
|
|
21
|
-
async def register(req: RegisterRequest):
|
|
22
|
-
try:
|
|
23
|
-
result = await register_usecase.execute(req.email, req.name, req.password)
|
|
24
|
-
return result
|
|
25
|
-
except ValueError as e:
|
|
26
|
-
raise HTTPException(status_code=400, detail=str(e))
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from passlib.context import CryptContext
|
|
2
|
-
from jose import jwt
|
|
3
|
-
from datetime import datetime, timedelta
|
|
4
|
-
import os
|
|
5
|
-
|
|
6
|
-
SECRET_KEY = os.getenv("JWT_SECRET", "secret")
|
|
7
|
-
ALGORITHM = "HS256"
|
|
8
|
-
|
|
9
|
-
class BcryptHasher:
|
|
10
|
-
def __init__(self):
|
|
11
|
-
self.pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
|
12
|
-
|
|
13
|
-
def hash(self, password: str) -> str:
|
|
14
|
-
return self.pwd_context.hash(password)
|
|
15
|
-
|
|
16
|
-
def verify(self, password: str, hashed: str) -> bool:
|
|
17
|
-
return self.pwd_context.verify(password, hashed)
|
|
18
|
-
|
|
19
|
-
class JwtTokenGenerator:
|
|
20
|
-
def generate(self, user_id: str, email: str) -> str:
|
|
21
|
-
expire = datetime.utcnow() + timedelta(days=7)
|
|
22
|
-
to_encode = {"exp": expire, "sub": user_id, "email": email}
|
|
23
|
-
return jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
from fastapi import FastAPI
|
|
2
|
-
from app.infrastructure.http import auth_controller
|
|
3
|
-
|
|
4
|
-
app = FastAPI(title="{{projectName}} - Clean Architecture")
|
|
5
|
-
|
|
6
|
-
app.include_router(auth_controller.router, prefix="/api/auth", tags=["Auth"])
|
|
7
|
-
|
|
8
|
-
@app.get("/health")
|
|
9
|
-
def health():
|
|
10
|
-
return {"status": "ok", "architecture": "clean"}
|