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,54 +0,0 @@
|
|
|
1
|
-
# ECS Module
|
|
2
|
-
|
|
3
|
-
variable "app_name" {
|
|
4
|
-
type = string
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
variable "environment" {
|
|
8
|
-
type = string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
variable "vpc_id" {
|
|
12
|
-
type = string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
variable "subnet_ids" {
|
|
16
|
-
type = list(string)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
# ECS Cluster
|
|
20
|
-
resource "aws_ecs_cluster" "main" {
|
|
21
|
-
name = "${var.app_name}-${var.environment}"
|
|
22
|
-
|
|
23
|
-
setting {
|
|
24
|
-
name = "containerInsights"
|
|
25
|
-
value = "enabled"
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
tags = {
|
|
29
|
-
Name = "${var.app_name}-${var.environment}"
|
|
30
|
-
Environment = var.environment
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
# ECS Capacity Provider
|
|
35
|
-
resource "aws_ecs_cluster_capacity_providers" "main" {
|
|
36
|
-
cluster_name = aws_ecs_cluster.main.name
|
|
37
|
-
|
|
38
|
-
capacity_providers = ["FARGATE", "FARGATE_SPOT"]
|
|
39
|
-
|
|
40
|
-
default_capacity_provider_strategy {
|
|
41
|
-
base = 1
|
|
42
|
-
weight = 100
|
|
43
|
-
capacity_provider = "FARGATE"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
# Outputs
|
|
48
|
-
output "cluster_name" {
|
|
49
|
-
value = aws_ecs_cluster.main.name
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
output "cluster_arn" {
|
|
53
|
-
value = aws_ecs_cluster.main.arn
|
|
54
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# RDS Module
|
|
2
|
-
|
|
3
|
-
variable "app_name" {
|
|
4
|
-
type = string
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
variable "environment" {
|
|
8
|
-
type = string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
variable "vpc_id" {
|
|
12
|
-
type = string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
variable "subnet_ids" {
|
|
16
|
-
type = list(string)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
variable "security_group_id" {
|
|
20
|
-
type = string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
# DB Subnet Group
|
|
24
|
-
resource "aws_db_subnet_group" "main" {
|
|
25
|
-
name = "${var.app_name}-${var.environment}"
|
|
26
|
-
subnet_ids = var.subnet_ids
|
|
27
|
-
|
|
28
|
-
tags = {
|
|
29
|
-
Name = "${var.app_name}-${var.environment}"
|
|
30
|
-
Environment = var.environment
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
# RDS PostgreSQL Instance
|
|
35
|
-
resource "aws_db_instance" "main" {
|
|
36
|
-
identifier = "${var.app_name}-${var.environment}"
|
|
37
|
-
|
|
38
|
-
engine = "postgres"
|
|
39
|
-
engine_version = "16"
|
|
40
|
-
instance_class = "db.t3.micro"
|
|
41
|
-
|
|
42
|
-
allocated_storage = 20
|
|
43
|
-
max_allocated_storage = 100
|
|
44
|
-
storage_type = "gp3"
|
|
45
|
-
storage_encrypted = true
|
|
46
|
-
|
|
47
|
-
db_name = replace(var.app_name, "-", "_")
|
|
48
|
-
username = "postgres"
|
|
49
|
-
password = random_password.db_password.result
|
|
50
|
-
|
|
51
|
-
db_subnet_group_name = aws_db_subnet_group.main.name
|
|
52
|
-
vpc_security_group_ids = [var.security_group_id]
|
|
53
|
-
|
|
54
|
-
backup_retention_period = 7
|
|
55
|
-
skip_final_snapshot = var.environment != "prod"
|
|
56
|
-
|
|
57
|
-
tags = {
|
|
58
|
-
Name = "${var.app_name}-${var.environment}"
|
|
59
|
-
Environment = var.environment
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
# Random password for DB
|
|
64
|
-
resource "random_password" "db_password" {
|
|
65
|
-
length = 32
|
|
66
|
-
special = false
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
# Store password in SSM
|
|
70
|
-
resource "aws_ssm_parameter" "db_password" {
|
|
71
|
-
name = "/${var.app_name}/${var.environment}/db-password"
|
|
72
|
-
description = "Database password for ${var.app_name}"
|
|
73
|
-
type = "SecureString"
|
|
74
|
-
value = random_password.db_password.result
|
|
75
|
-
|
|
76
|
-
tags = {
|
|
77
|
-
Environment = var.environment
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
# Outputs
|
|
82
|
-
output "endpoint" {
|
|
83
|
-
value = aws_db_instance.main.endpoint
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
output "db_name" {
|
|
87
|
-
value = aws_db_instance.main.db_name
|
|
88
|
-
}
|
|
@@ -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,130 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
3
|
-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
|
4
|
-
https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
5
|
-
<modelVersion>4.0.0</modelVersion>
|
|
6
|
-
|
|
7
|
-
<parent>
|
|
8
|
-
<groupId>org.springframework.boot</groupId>
|
|
9
|
-
<artifactId>spring-boot-starter-parent</artifactId>
|
|
10
|
-
<version>3.4.1</version>
|
|
11
|
-
<relativePath />
|
|
12
|
-
</parent>
|
|
13
|
-
|
|
14
|
-
<groupId>{{packageName}}</groupId>
|
|
15
|
-
<artifactId>{{projectNameKebabCase}}</artifactId>
|
|
16
|
-
<version>0.0.1-SNAPSHOT</version>
|
|
17
|
-
<name>{{projectNamePascalCase}}</name>
|
|
18
|
-
<description>Generated by Kibernus CLI</description>
|
|
19
|
-
|
|
20
|
-
<properties>
|
|
21
|
-
<java.version>21</java.version>
|
|
22
|
-
</properties>
|
|
23
|
-
|
|
24
|
-
<dependencies>
|
|
25
|
-
<!-- Spring Boot Starters -->
|
|
26
|
-
<dependency>
|
|
27
|
-
<groupId>org.springframework.boot</groupId>
|
|
28
|
-
<artifactId>spring-boot-starter-web</artifactId>
|
|
29
|
-
</dependency>
|
|
30
|
-
<dependency>
|
|
31
|
-
<groupId>org.springframework.boot</groupId>
|
|
32
|
-
<artifactId>spring-boot-starter-validation</artifactId>
|
|
33
|
-
</dependency>
|
|
34
|
-
<dependency>
|
|
35
|
-
<groupId>org.springframework.boot</groupId>
|
|
36
|
-
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
|
37
|
-
</dependency>
|
|
38
|
-
<dependency>
|
|
39
|
-
<groupId>org.springframework.boot</groupId>
|
|
40
|
-
<artifactId>spring-boot-starter-security</artifactId>
|
|
41
|
-
</dependency>
|
|
42
|
-
<dependency>
|
|
43
|
-
<groupId>org.springframework.boot</groupId>
|
|
44
|
-
<artifactId>spring-boot-starter-actuator</artifactId>
|
|
45
|
-
</dependency>
|
|
46
|
-
|
|
47
|
-
<!-- JWT -->
|
|
48
|
-
<dependency>
|
|
49
|
-
<groupId>io.jsonwebtoken</groupId>
|
|
50
|
-
<artifactId>jjwt-api</artifactId>
|
|
51
|
-
<version>0.12.5</version>
|
|
52
|
-
</dependency>
|
|
53
|
-
<dependency>
|
|
54
|
-
<groupId>io.jsonwebtoken</groupId>
|
|
55
|
-
<artifactId>jjwt-impl</artifactId>
|
|
56
|
-
<version>0.12.5</version>
|
|
57
|
-
<scope>runtime</scope>
|
|
58
|
-
</dependency>
|
|
59
|
-
<dependency>
|
|
60
|
-
<groupId>io.jsonwebtoken</groupId>
|
|
61
|
-
<artifactId>jjwt-jackson</artifactId>
|
|
62
|
-
<version>0.12.5</version>
|
|
63
|
-
<scope>runtime</scope>
|
|
64
|
-
</dependency>
|
|
65
|
-
|
|
66
|
-
<!-- Stripe -->
|
|
67
|
-
<dependency>
|
|
68
|
-
<groupId>com.stripe</groupId>
|
|
69
|
-
<artifactId>stripe-java</artifactId>
|
|
70
|
-
<version>24.19.0</version>
|
|
71
|
-
</dependency>
|
|
72
|
-
|
|
73
|
-
<!-- Database -->
|
|
74
|
-
<dependency>
|
|
75
|
-
<groupId>org.postgresql</groupId>
|
|
76
|
-
<artifactId>postgresql</artifactId>
|
|
77
|
-
<scope>runtime</scope>
|
|
78
|
-
</dependency>
|
|
79
|
-
<dependency>
|
|
80
|
-
<groupId>com.h2database</groupId>
|
|
81
|
-
<artifactId>h2</artifactId>
|
|
82
|
-
<scope>runtime</scope>
|
|
83
|
-
</dependency>
|
|
84
|
-
|
|
85
|
-
<!-- Lombok -->
|
|
86
|
-
<dependency>
|
|
87
|
-
<groupId>org.projectlombok</groupId>
|
|
88
|
-
<artifactId>lombok</artifactId>
|
|
89
|
-
<optional>true</optional>
|
|
90
|
-
</dependency>
|
|
91
|
-
|
|
92
|
-
<!-- DevTools -->
|
|
93
|
-
<dependency>
|
|
94
|
-
<groupId>org.springframework.boot</groupId>
|
|
95
|
-
<artifactId>spring-boot-devtools</artifactId>
|
|
96
|
-
<scope>runtime</scope>
|
|
97
|
-
<optional>true</optional>
|
|
98
|
-
</dependency>
|
|
99
|
-
|
|
100
|
-
<!-- Testing -->
|
|
101
|
-
<dependency>
|
|
102
|
-
<groupId>org.springframework.boot</groupId>
|
|
103
|
-
<artifactId>spring-boot-starter-test</artifactId>
|
|
104
|
-
<scope>test</scope>
|
|
105
|
-
</dependency>
|
|
106
|
-
<dependency>
|
|
107
|
-
<groupId>org.springframework.security</groupId>
|
|
108
|
-
<artifactId>spring-security-test</artifactId>
|
|
109
|
-
<scope>test</scope>
|
|
110
|
-
</dependency>
|
|
111
|
-
</dependencies>
|
|
112
|
-
|
|
113
|
-
<build>
|
|
114
|
-
<plugins>
|
|
115
|
-
<plugin>
|
|
116
|
-
<groupId>org.springframework.boot</groupId>
|
|
117
|
-
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
118
|
-
<configuration>
|
|
119
|
-
<excludes>
|
|
120
|
-
<exclude>
|
|
121
|
-
<groupId>org.projectlombok</groupId>
|
|
122
|
-
<artifactId>lombok</artifactId>
|
|
123
|
-
</exclude>
|
|
124
|
-
</excludes>
|
|
125
|
-
</configuration>
|
|
126
|
-
</plugin>
|
|
127
|
-
</plugins>
|
|
128
|
-
</build>
|
|
129
|
-
|
|
130
|
-
</project>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
package {{packageName}}.config;
|
|
2
|
-
|
|
3
|
-
import org.springframework.http.HttpStatus;
|
|
4
|
-
import org.springframework.http.ResponseEntity;
|
|
5
|
-
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
6
|
-
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
7
|
-
|
|
8
|
-
import java.time.Instant;
|
|
9
|
-
import java.util.HashMap;
|
|
10
|
-
import java.util.Map;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Global exception handler for REST API
|
|
14
|
-
*/
|
|
15
|
-
@RestControllerAdvice
|
|
16
|
-
public class GlobalExceptionHandler {
|
|
17
|
-
|
|
18
|
-
@ExceptionHandler(Exception.class)
|
|
19
|
-
public ResponseEntity<Map<String, Object>> handleException(Exception ex) {
|
|
20
|
-
Map<String, Object> error = new HashMap<>();
|
|
21
|
-
error.put("timestamp", Instant.now().toString());
|
|
22
|
-
error.put("status", HttpStatus.INTERNAL_SERVER_ERROR.value());
|
|
23
|
-
error.put("error", "Internal Server Error");
|
|
24
|
-
error.put("message", ex.getMessage());
|
|
25
|
-
|
|
26
|
-
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@ExceptionHandler(IllegalArgumentException.class)
|
|
30
|
-
public ResponseEntity<Map<String, Object>> handleBadRequest(IllegalArgumentException ex) {
|
|
31
|
-
Map<String, Object> error = new HashMap<>();
|
|
32
|
-
error.put("timestamp", Instant.now().toString());
|
|
33
|
-
error.put("status", HttpStatus.BAD_REQUEST.value());
|
|
34
|
-
error.put("error", "Bad Request");
|
|
35
|
-
error.put("message", ex.getMessage());
|
|
36
|
-
|
|
37
|
-
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(error);
|
|
38
|
-
}
|
|
39
|
-
}
|
package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/SecurityConfig.java.hbs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
package {{packageName}}.config;
|
|
2
|
-
|
|
3
|
-
import {{packageName}}.security.JwtAuthenticationFilter;
|
|
4
|
-
import org.springframework.context.annotation.Bean;
|
|
5
|
-
import org.springframework.context.annotation.Configuration;
|
|
6
|
-
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
7
|
-
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
8
|
-
import org.springframework.security.config.http.SessionCreationPolicy;
|
|
9
|
-
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
10
|
-
import org.springframework.security.crypto.password.PasswordEncoder;
|
|
11
|
-
import org.springframework.security.web.SecurityFilterChain;
|
|
12
|
-
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
|
13
|
-
|
|
14
|
-
@Configuration
|
|
15
|
-
@EnableWebSecurity
|
|
16
|
-
public class SecurityConfig {
|
|
17
|
-
|
|
18
|
-
private final JwtAuthenticationFilter jwtAuthenticationFilter;
|
|
19
|
-
|
|
20
|
-
public SecurityConfig(JwtAuthenticationFilter jwtAuthenticationFilter) {
|
|
21
|
-
this.jwtAuthenticationFilter = jwtAuthenticationFilter;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@Bean
|
|
25
|
-
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
26
|
-
http
|
|
27
|
-
.csrf(csrf -> csrf.disable())
|
|
28
|
-
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
|
29
|
-
.authorizeHttpRequests(auth -> auth
|
|
30
|
-
.requestMatchers("/api/auth/**").permitAll()
|
|
31
|
-
.requestMatchers("/api/payments/webhook").permitAll()
|
|
32
|
-
.requestMatchers("/actuator/health").permitAll()
|
|
33
|
-
.anyRequest().authenticated()
|
|
34
|
-
)
|
|
35
|
-
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
|
|
36
|
-
|
|
37
|
-
return http.build();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@Bean
|
|
41
|
-
public PasswordEncoder passwordEncoder() {
|
|
42
|
-
return new BCryptPasswordEncoder();
|
|
43
|
-
}
|
|
44
|
-
}
|
package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/WebConfig.java.hbs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
package {{packageName}}.config;
|
|
2
|
-
|
|
3
|
-
import org.springframework.context.annotation.Bean;
|
|
4
|
-
import org.springframework.context.annotation.Configuration;
|
|
5
|
-
import org.springframework.web.cors.CorsConfiguration;
|
|
6
|
-
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
|
7
|
-
import org.springframework.web.filter.CorsFilter;
|
|
8
|
-
|
|
9
|
-
import java.util.Arrays;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Web configuration for CORS and other settings
|
|
13
|
-
*/
|
|
14
|
-
@Configuration
|
|
15
|
-
public class WebConfig {
|
|
16
|
-
|
|
17
|
-
@Bean
|
|
18
|
-
public CorsFilter corsFilter() {
|
|
19
|
-
CorsConfiguration config = new CorsConfiguration();
|
|
20
|
-
config.setAllowCredentials(true);
|
|
21
|
-
config.setAllowedOriginPatterns(Arrays.asList("*"));
|
|
22
|
-
config.setAllowedHeaders(Arrays.asList("*"));
|
|
23
|
-
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS"));
|
|
24
|
-
|
|
25
|
-
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
|
26
|
-
source.registerCorsConfiguration("/**", config);
|
|
27
|
-
|
|
28
|
-
return new CorsFilter(source);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
package {{packageName}}.controller;
|
|
2
|
-
|
|
3
|
-
import {{packageName}}.dto.AuthRequest;
|
|
4
|
-
import {{packageName}}.dto.AuthResponse;
|
|
5
|
-
import {{packageName}}.security.JwtTokenProvider;
|
|
6
|
-
import org.springframework.http.ResponseEntity;
|
|
7
|
-
import org.springframework.security.crypto.password.PasswordEncoder;
|
|
8
|
-
import org.springframework.web.bind.annotation.*;
|
|
9
|
-
|
|
10
|
-
import java.util.HashMap;
|
|
11
|
-
import java.util.Map;
|
|
12
|
-
import java.util.UUID;
|
|
13
|
-
|
|
14
|
-
@RestController
|
|
15
|
-
@RequestMapping("/api/auth")
|
|
16
|
-
public class AuthController {
|
|
17
|
-
|
|
18
|
-
private final JwtTokenProvider tokenProvider;
|
|
19
|
-
private final PasswordEncoder passwordEncoder;
|
|
20
|
-
|
|
21
|
-
// In-memory user store (replace with repository in production)
|
|
22
|
-
private final Map<String, Map<String, String>> users = new HashMap<>();
|
|
23
|
-
|
|
24
|
-
public AuthController(JwtTokenProvider tokenProvider, PasswordEncoder passwordEncoder) {
|
|
25
|
-
this.tokenProvider = tokenProvider;
|
|
26
|
-
this.passwordEncoder = passwordEncoder;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@PostMapping("/register")
|
|
30
|
-
public ResponseEntity
|
|
31
|
-
<?> register(@RequestBody AuthRequest request) {
|
|
32
|
-
if (users.containsKey(request.email())) {
|
|
33
|
-
return ResponseEntity.badRequest().body(Map.of("error", "User already exists"));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
String userId = UUID.randomUUID().toString();
|
|
37
|
-
String hashedPassword = passwordEncoder.encode(request.password());
|
|
38
|
-
|
|
39
|
-
users.put(request.email(), Map.of(
|
|
40
|
-
"id", userId,
|
|
41
|
-
"email", request.email(),
|
|
42
|
-
"password", hashedPassword
|
|
43
|
-
));
|
|
44
|
-
|
|
45
|
-
String token = tokenProvider.generateToken(userId, request.email());
|
|
46
|
-
|
|
47
|
-
return ResponseEntity.ok(new AuthResponse(token, userId, request.email()));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
@PostMapping("/login")
|
|
51
|
-
public ResponseEntity<?> login(@RequestBody AuthRequest request) {
|
|
52
|
-
Map<String, String> user = users.get(request.email());
|
|
53
|
-
|
|
54
|
-
if (user == null || !passwordEncoder.matches(request.password(), user.get("password"))) {
|
|
55
|
-
return ResponseEntity.status(401).body(Map.of("error", "Invalid credentials"));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
String token = tokenProvider.generateToken(user.get("id"), user.get("email"));
|
|
59
|
-
|
|
60
|
-
return ResponseEntity.ok(new AuthResponse(token, user.get("id"), user.get("email")));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@GetMapping("/me")
|
|
64
|
-
public ResponseEntity
|
|
65
|
-
<?> me(@RequestHeader("Authorization") String authHeader) {
|
|
66
|
-
// User is already authenticated by JWT filter
|
|
67
|
-
return ResponseEntity.ok(Map.of("message", "Authenticated"));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
package {{packageName}}.controller;
|
|
2
|
-
|
|
3
|
-
import org.springframework.http.ResponseEntity;
|
|
4
|
-
import org.springframework.web.bind.annotation.GetMapping;
|
|
5
|
-
import org.springframework.web.bind.annotation.RequestMapping;
|
|
6
|
-
import org.springframework.web.bind.annotation.RestController;
|
|
7
|
-
|
|
8
|
-
import java.time.Instant;
|
|
9
|
-
import java.util.HashMap;
|
|
10
|
-
import java.util.Map;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Health check controller
|
|
14
|
-
*/
|
|
15
|
-
@RestController
|
|
16
|
-
@RequestMapping("/api")
|
|
17
|
-
public class HealthController {
|
|
18
|
-
|
|
19
|
-
private final Instant startTime = Instant.now();
|
|
20
|
-
|
|
21
|
-
@GetMapping("/health")
|
|
22
|
-
public ResponseEntity<Map<String, Object>> health() {
|
|
23
|
-
Map<String, Object> response = new HashMap<>();
|
|
24
|
-
response.put("status", "ok");
|
|
25
|
-
response.put("message", "{{projectNamePascalCase}} API is running");
|
|
26
|
-
response.put("timestamp", Instant.now().toString());
|
|
27
|
-
response.put("uptime", java.time.Duration.between(startTime, Instant.now()).getSeconds());
|
|
28
|
-
return ResponseEntity.ok(response);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
package {{packageName}}.controller;
|
|
2
|
-
|
|
3
|
-
import {{packageName}}.service.StripeService;
|
|
4
|
-
import com.stripe.exception.StripeException;
|
|
5
|
-
import org.springframework.http.ResponseEntity;
|
|
6
|
-
import org.springframework.web.bind.annotation.*;
|
|
7
|
-
|
|
8
|
-
import java.util.Map;
|
|
9
|
-
|
|
10
|
-
@RestController
|
|
11
|
-
@RequestMapping("/api/payments")
|
|
12
|
-
public class PaymentsController {
|
|
13
|
-
|
|
14
|
-
private final StripeService stripeService;
|
|
15
|
-
|
|
16
|
-
public PaymentsController(StripeService stripeService) {
|
|
17
|
-
this.stripeService = stripeService;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@PostMapping("/checkout")
|
|
21
|
-
public ResponseEntity
|
|
22
|
-
<?> createCheckout(@RequestBody Map<String, String> request) {
|
|
23
|
-
try {
|
|
24
|
-
var session = stripeService.createCheckoutSession(request.get("customerId"));
|
|
25
|
-
return ResponseEntity.ok(Map.of("url", session.getUrl()));
|
|
26
|
-
} catch (StripeException e) {
|
|
27
|
-
return ResponseEntity.status(500).body(Map.of("error", e.getMessage()));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@PostMapping("/portal")
|
|
32
|
-
public ResponseEntity<?> createPortal(@RequestBody Map<String, String> request) {
|
|
33
|
-
try {
|
|
34
|
-
var session = stripeService.createPortalSession(request.get("customerId"));
|
|
35
|
-
return ResponseEntity.ok(Map.of("url", session.getUrl()));
|
|
36
|
-
} catch (StripeException e) {
|
|
37
|
-
return ResponseEntity.status(500).body(Map.of("error", e.getMessage()));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@PostMapping("/webhook")
|
|
42
|
-
public ResponseEntity
|
|
43
|
-
<?> handleWebhook(@RequestBody String payload,
|
|
44
|
-
@RequestHeader("Stripe-Signature") String sigHeader) {
|
|
45
|
-
// TODO: Implement webhook verification and handling
|
|
46
|
-
// Use Stripe.webhooks.constructEvent to verify signature
|
|
47
|
-
return ResponseEntity.ok(Map.of("received", true));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
File without changes
|
|
File without changes
|