kybernus 1.0.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/README.md +321 -0
- package/dist/cli/commands/init.d.ts +12 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +71 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/login.d.ts +6 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/login.js +42 -0
- package/dist/cli/commands/login.js.map +1 -0
- package/dist/cli/commands/logout.d.ts +2 -0
- package/dist/cli/commands/logout.d.ts.map +1 -0
- package/dist/cli/commands/logout.js +22 -0
- package/dist/cli/commands/logout.js.map +1 -0
- package/dist/cli/commands/register.d.ts +2 -0
- package/dist/cli/commands/register.d.ts.map +1 -0
- package/dist/cli/commands/register.js +69 -0
- package/dist/cli/commands/register.js.map +1 -0
- package/dist/cli/commands/status.d.ts +2 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +46 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/upgrade.d.ts +2 -0
- package/dist/cli/commands/upgrade.d.ts.map +1 -0
- package/dist/cli/commands/upgrade.js +62 -0
- package/dist/cli/commands/upgrade.js.map +1 -0
- package/dist/cli/prompts/wizard.d.ts +3 -0
- package/dist/cli/prompts/wizard.d.ts.map +1 -0
- package/dist/cli/prompts/wizard.js +121 -0
- package/dist/cli/prompts/wizard.js.map +1 -0
- package/dist/cli/services/AnalyticsClient.d.ts +11 -0
- package/dist/cli/services/AnalyticsClient.d.ts.map +1 -0
- package/dist/cli/services/AnalyticsClient.js +32 -0
- package/dist/cli/services/AnalyticsClient.js.map +1 -0
- package/dist/core/ai/documentation-generator.d.ts +36 -0
- package/dist/core/ai/documentation-generator.d.ts.map +1 -0
- package/dist/core/ai/documentation-generator.js +111 -0
- package/dist/core/ai/documentation-generator.js.map +1 -0
- package/dist/core/ai/gemini-service.d.ts +17 -0
- package/dist/core/ai/gemini-service.d.ts.map +1 -0
- package/dist/core/ai/gemini-service.js +68 -0
- package/dist/core/ai/gemini-service.js.map +1 -0
- package/dist/core/ai/prompts/documentation-prompts.d.ts +17 -0
- package/dist/core/ai/prompts/documentation-prompts.d.ts.map +1 -0
- package/dist/core/ai/prompts/documentation-prompts.js +195 -0
- package/dist/core/ai/prompts/documentation-prompts.js.map +1 -0
- package/dist/core/auth/license-validator.d.ts +33 -0
- package/dist/core/auth/license-validator.d.ts.map +1 -0
- package/dist/core/auth/license-validator.js +81 -0
- package/dist/core/auth/license-validator.js.map +1 -0
- package/dist/core/config/config-manager.d.ts +24 -0
- package/dist/core/config/config-manager.d.ts.map +1 -0
- package/dist/core/config/config-manager.js +56 -0
- package/dist/core/config/config-manager.js.map +1 -0
- package/dist/core/generator/context-builder.d.ts +10 -0
- package/dist/core/generator/context-builder.d.ts.map +1 -0
- package/dist/core/generator/context-builder.js +43 -0
- package/dist/core/generator/context-builder.js.map +1 -0
- package/dist/core/generator/project.d.ts +42 -0
- package/dist/core/generator/project.d.ts.map +1 -0
- package/dist/core/generator/project.js +278 -0
- package/dist/core/generator/project.js.map +1 -0
- package/dist/core/templates/engine.d.ts +25 -0
- package/dist/core/templates/engine.d.ts.map +1 -0
- package/dist/core/templates/engine.js +78 -0
- package/dist/core/templates/engine.js.map +1 -0
- package/dist/core/templates/helpers.d.ts +6 -0
- package/dist/core/templates/helpers.d.ts.map +1 -0
- package/dist/core/templates/helpers.js +63 -0
- package/dist/core/templates/helpers.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/models/config.d.ts +38 -0
- package/dist/models/config.d.ts.map +1 -0
- package/dist/models/config.js +2 -0
- package/dist/models/config.js.map +1 -0
- package/package.json +66 -0
- package/templates/java-spring/free/mvc/.gitignore.hbs +39 -0
- package/templates/java-spring/free/mvc/README.md.hbs +116 -0
- package/templates/java-spring/free/mvc/docker-compose.yml.hbs +18 -0
- package/templates/java-spring/free/mvc/pom.xml.hbs +92 -0
- package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/config/GlobalExceptionHandler.java.hbs +39 -0
- package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/config/WebConfig.java.hbs +30 -0
- package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/controller/HealthController.java.hbs +30 -0
- package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/model/.gitkeep +0 -0
- package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/repository/.gitkeep +0 -0
- package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/service/.gitkeep +0 -0
- package/templates/java-spring/free/mvc/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +13 -0
- package/templates/java-spring/free/mvc/src/main/resources/application.yml.hbs +32 -0
- package/templates/java-spring/free/mvc/src/test/java/{{packagePath}}/{{projectNamePascalCase}}ApplicationTests.java.hbs +13 -0
- package/templates/java-spring/free/mvc/src/test/resources/application.yml.hbs +10 -0
- package/templates/java-spring/free/mvc/template.json +14 -0
- package/templates/java-spring/pro/clean/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/java-spring/pro/clean/Dockerfile.hbs +45 -0
- package/templates/java-spring/pro/clean/README.md.hbs +31 -0
- package/templates/java-spring/pro/clean/docker-compose.yml.hbs +18 -0
- package/templates/java-spring/pro/clean/infra/main.tf.hbs +83 -0
- package/templates/java-spring/pro/clean/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/java-spring/pro/clean/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/java-spring/pro/clean/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/java-spring/pro/clean/pom.xml.hbs +130 -0
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/application/service/AuthService.java.hbs +36 -0
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/entity/User.java.hbs +77 -0
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/repository/UserRepository.java.hbs +15 -0
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/usecase/LoginUserUseCase.java.hbs +36 -0
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/domain/usecase/RegisterUserUseCase.java.hbs +46 -0
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/infrastructure/persistence/InMemoryUserRepository.java.hbs +41 -0
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/infrastructure/security/SecurityAdapters.java.hbs +53 -0
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/infrastructure/web/controller/AuthController.java.hbs +41 -0
- package/templates/java-spring/pro/clean/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +14 -0
- package/templates/java-spring/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/java-spring/pro/hexagonal/Dockerfile.hbs +45 -0
- package/templates/java-spring/pro/hexagonal/README.md.hbs +38 -0
- package/templates/java-spring/pro/hexagonal/docker-compose.yml.hbs +18 -0
- package/templates/java-spring/pro/hexagonal/infra/main.tf.hbs +83 -0
- package/templates/java-spring/pro/hexagonal/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/java-spring/pro/hexagonal/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/java-spring/pro/hexagonal/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/java-spring/pro/hexagonal/pom.xml.hbs +130 -0
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/application/service/AuthService.java.hbs +36 -0
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/entity/User.java.hbs +77 -0
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/repository/UserRepository.java.hbs +15 -0
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/usecase/LoginUserUseCase.java.hbs +36 -0
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/domain/usecase/RegisterUserUseCase.java.hbs +46 -0
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/infrastructure/persistence/InMemoryUserRepository.java.hbs +41 -0
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/infrastructure/security/SecurityAdapters.java.hbs +53 -0
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/infrastructure/web/controller/AuthController.java.hbs +41 -0
- package/templates/java-spring/pro/hexagonal/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +14 -0
- package/templates/java-spring/pro/mvc/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/java-spring/pro/mvc/Dockerfile.hbs +45 -0
- package/templates/java-spring/pro/mvc/README.md.hbs +116 -0
- package/templates/java-spring/pro/mvc/docker-compose.yml.hbs +18 -0
- package/templates/java-spring/pro/mvc/infra/main.tf.hbs +83 -0
- package/templates/java-spring/pro/mvc/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/java-spring/pro/mvc/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/java-spring/pro/mvc/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/java-spring/pro/mvc/pom.xml.hbs +130 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/GlobalExceptionHandler.java.hbs +39 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/SecurityConfig.java.hbs +44 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/WebConfig.java.hbs +30 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/controller/AuthController.java.hbs +69 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/controller/HealthController.java.hbs +30 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/controller/PaymentsController.java.hbs +49 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/dto/AuthRequest.java.hbs +3 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/dto/AuthResponse.java.hbs +3 -0
- 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 +56 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/security/JwtTokenProvider.java.hbs +59 -0
- 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 +67 -0
- package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/{{projectNamePascalCase}}Application.java.hbs +13 -0
- package/templates/java-spring/pro/mvc/src/main/resources/application.yml.hbs +32 -0
- package/templates/java-spring/pro/mvc/src/test/java/{{packagePath}}/{{projectNamePascalCase}}ApplicationTests.java.hbs +13 -0
- package/templates/java-spring/pro/mvc/src/test/resources/application.yml.hbs +10 -0
- package/templates/java-spring/pro/mvc/template.json +14 -0
- package/templates/nestjs/free/mvc/README.md.hbs +28 -0
- package/templates/nestjs/free/mvc/package.json.hbs +29 -0
- package/templates/nestjs/free/mvc/src/app.module.ts.hbs +13 -0
- package/templates/nestjs/free/mvc/src/controllers/health.controller.ts.hbs +9 -0
- package/templates/nestjs/free/mvc/src/controllers/items.controller.ts.hbs +32 -0
- package/templates/nestjs/free/mvc/src/main.ts.hbs +17 -0
- package/templates/nestjs/free/mvc/src/models/create-item.dto.ts.hbs +10 -0
- package/templates/nestjs/free/mvc/src/models/item.model.ts.hbs +6 -0
- package/templates/nestjs/free/mvc/src/modules/items.module.ts.hbs +9 -0
- package/templates/nestjs/free/mvc/src/services/items.service.ts.hbs +32 -0
- package/templates/nestjs/free/mvc/tsconfig.json.hbs +21 -0
- package/templates/nestjs/pro/clean/.env.example.hbs +19 -0
- package/templates/nestjs/pro/clean/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/nestjs/pro/clean/Dockerfile.hbs +45 -0
- package/templates/nestjs/pro/clean/infra/main.tf.hbs +83 -0
- package/templates/nestjs/pro/clean/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/nestjs/pro/clean/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/nestjs/pro/clean/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/nestjs/pro/clean/package.json.hbs +37 -0
- package/templates/nestjs/pro/clean/src/auth.module.ts.hbs +17 -0
- package/templates/nestjs/pro/clean/src/domain/entities/user.entity.ts.hbs +12 -0
- package/templates/nestjs/pro/clean/src/domain/repositories/user.repository.ts.hbs +6 -0
- package/templates/nestjs/pro/clean/src/domain/use-cases/register.use-case.ts.hbs +18 -0
- package/templates/nestjs/pro/clean/src/infrastructure/database/in-memory.repository.ts.hbs +17 -0
- package/templates/nestjs/pro/clean/src/infrastructure/http/auth.controller.ts.hbs +16 -0
- package/templates/nestjs/pro/clean/tsconfig.json.hbs +21 -0
- package/templates/nestjs/pro/hexagonal/.env.example.hbs +19 -0
- package/templates/nestjs/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/nestjs/pro/hexagonal/Dockerfile.hbs +45 -0
- package/templates/nestjs/pro/hexagonal/infra/main.tf.hbs +83 -0
- package/templates/nestjs/pro/hexagonal/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/nestjs/pro/hexagonal/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/nestjs/pro/hexagonal/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/nestjs/pro/hexagonal/package.json.hbs +37 -0
- package/templates/nestjs/pro/hexagonal/src/adapters/inbound/http.adapter.ts.hbs +12 -0
- package/templates/nestjs/pro/hexagonal/src/adapters/outbound/persistence.adapter.ts.hbs +13 -0
- package/templates/nestjs/pro/hexagonal/src/auth.module.ts.hbs +19 -0
- package/templates/nestjs/pro/hexagonal/src/core/auth.service.ts.hbs +16 -0
- package/templates/nestjs/pro/hexagonal/src/core/domain/user.entity.ts.hbs +8 -0
- package/templates/nestjs/pro/hexagonal/src/core/ports/ports.ts.hbs +9 -0
- package/templates/nestjs/pro/hexagonal/tsconfig.json.hbs +21 -0
- package/templates/nestjs/pro/mvc/.env.example.hbs +19 -0
- package/templates/nestjs/pro/mvc/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/nestjs/pro/mvc/Dockerfile.hbs +45 -0
- package/templates/nestjs/pro/mvc/README.md.hbs +28 -0
- package/templates/nestjs/pro/mvc/infra/main.tf.hbs +83 -0
- package/templates/nestjs/pro/mvc/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/nestjs/pro/mvc/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/nestjs/pro/mvc/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/nestjs/pro/mvc/package.json.hbs +37 -0
- package/templates/nestjs/pro/mvc/src/app.module.ts.hbs +17 -0
- package/templates/nestjs/pro/mvc/src/auth/auth.controller.ts.hbs +35 -0
- package/templates/nestjs/pro/mvc/src/auth/auth.module.ts.hbs +25 -0
- package/templates/nestjs/pro/mvc/src/auth/auth.service.ts.hbs +55 -0
- package/templates/nestjs/pro/mvc/src/auth/jwt.strategy.ts.hbs +19 -0
- package/templates/nestjs/pro/mvc/src/controllers/health.controller.ts.hbs +9 -0
- package/templates/nestjs/pro/mvc/src/controllers/items.controller.ts.hbs +32 -0
- package/templates/nestjs/pro/mvc/src/main.ts.hbs +17 -0
- package/templates/nestjs/pro/mvc/src/models/create-item.dto.ts.hbs +10 -0
- package/templates/nestjs/pro/mvc/src/models/item.model.ts.hbs +6 -0
- package/templates/nestjs/pro/mvc/src/modules/items.module.ts.hbs +9 -0
- package/templates/nestjs/pro/mvc/src/payments/payments.controller.ts.hbs +26 -0
- package/templates/nestjs/pro/mvc/src/payments/payments.module.ts.hbs +11 -0
- package/templates/nestjs/pro/mvc/src/payments/payments.service.ts.hbs +43 -0
- package/templates/nestjs/pro/mvc/src/services/items.service.ts.hbs +32 -0
- package/templates/nestjs/pro/mvc/tsconfig.json.hbs +21 -0
- package/templates/nextjs/free/default/.env.example.hbs +1 -0
- package/templates/nextjs/free/default/.gitignore.hbs +8 -0
- package/templates/nextjs/free/default/README.md.hbs +96 -0
- package/templates/nextjs/free/default/docker-compose.yml.hbs +18 -0
- package/templates/nextjs/free/default/next.config.js.hbs +4 -0
- package/templates/nextjs/free/default/package.json.hbs +32 -0
- package/templates/nextjs/free/default/postcss.config.js.hbs +6 -0
- package/templates/nextjs/free/default/prisma/schema.prisma.hbs +18 -0
- package/templates/nextjs/free/default/public/.gitkeep +0 -0
- package/templates/nextjs/free/default/src/app/api/health/route.ts.hbs +9 -0
- package/templates/nextjs/free/default/src/app/globals.css.hbs +3 -0
- package/templates/nextjs/free/default/src/app/layout.tsx.hbs +22 -0
- package/templates/nextjs/free/default/src/app/page.tsx.hbs +38 -0
- package/templates/nextjs/free/default/src/components/.gitkeep +0 -0
- package/templates/nextjs/free/default/src/lib/prisma.ts.hbs +13 -0
- package/templates/nextjs/free/default/src/proxy.ts.hbs +22 -0
- package/templates/nextjs/free/default/tailwind.config.ts.hbs +15 -0
- package/templates/nextjs/free/default/template.json +18 -0
- package/templates/nextjs/free/default/tsconfig.json.hbs +23 -0
- package/templates/nextjs/pro/default/.env.example.hbs +20 -0
- package/templates/nextjs/pro/default/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/nextjs/pro/default/Dockerfile.hbs +45 -0
- package/templates/nextjs/pro/default/README.md.hbs +96 -0
- package/templates/nextjs/pro/default/docker-compose.yml.hbs +18 -0
- package/templates/nextjs/pro/default/infra/main.tf.hbs +83 -0
- package/templates/nextjs/pro/default/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/nextjs/pro/default/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/nextjs/pro/default/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/nextjs/pro/default/next.config.js.hbs +4 -0
- package/templates/nextjs/pro/default/package.json.hbs +34 -0
- package/templates/nextjs/pro/default/postcss.config.js.hbs +6 -0
- package/templates/nextjs/pro/default/prisma/schema.prisma.hbs +18 -0
- package/templates/nextjs/pro/default/public/.gitkeep +0 -0
- package/templates/nextjs/pro/default/src/app/api/auth/[...nextauth]/route.ts.hbs +61 -0
- package/templates/nextjs/pro/default/src/app/api/checkout/route.ts.hbs +30 -0
- package/templates/nextjs/pro/default/src/app/api/health/route.ts.hbs +9 -0
- package/templates/nextjs/pro/default/src/app/api/webhook/route.ts.hbs +51 -0
- package/templates/nextjs/pro/default/src/app/dashboard/page.tsx.hbs +52 -0
- package/templates/nextjs/pro/default/src/app/globals.css.hbs +3 -0
- package/templates/nextjs/pro/default/src/app/layout.tsx.hbs +22 -0
- package/templates/nextjs/pro/default/src/app/page.tsx.hbs +38 -0
- package/templates/nextjs/pro/default/src/components/.gitkeep +0 -0
- package/templates/nextjs/pro/default/src/components/AuthButton.tsx.hbs +34 -0
- package/templates/nextjs/pro/default/src/components/Providers.tsx.hbs +7 -0
- package/templates/nextjs/pro/default/src/lib/prisma.ts.hbs +13 -0
- package/templates/nextjs/pro/default/src/proxy.ts.hbs +22 -0
- package/templates/nextjs/pro/default/tailwind.config.ts.hbs +15 -0
- package/templates/nextjs/pro/default/template.json +18 -0
- package/templates/nextjs/pro/default/tsconfig.json.hbs +40 -0
- package/templates/nodejs-express/free/mvc/.env.example.hbs +3 -0
- package/templates/nodejs-express/free/mvc/.gitignore.hbs +6 -0
- package/templates/nodejs-express/free/mvc/README.md.hbs +128 -0
- package/templates/nodejs-express/free/mvc/docker-compose.yml.hbs +18 -0
- package/templates/nodejs-express/free/mvc/package.json.hbs +39 -0
- package/templates/nodejs-express/free/mvc/src/app.ts.hbs +29 -0
- package/templates/nodejs-express/free/mvc/src/config/database.ts.hbs +10 -0
- package/templates/nodejs-express/free/mvc/src/controllers/healthController.ts.hbs +20 -0
- package/templates/nodejs-express/free/mvc/src/index.ts.hbs +12 -0
- package/templates/nodejs-express/free/mvc/src/middleware/errorHandler.ts.hbs +22 -0
- package/templates/nodejs-express/free/mvc/src/models/.gitkeep +0 -0
- package/templates/nodejs-express/free/mvc/src/routes/index.ts.hbs +14 -0
- package/templates/nodejs-express/free/mvc/src/services/.gitkeep +0 -0
- package/templates/nodejs-express/free/mvc/template.json +18 -0
- package/templates/nodejs-express/free/mvc/tsconfig.json.hbs +18 -0
- package/templates/nodejs-express/pro/clean/.env.example.hbs +19 -0
- package/templates/nodejs-express/pro/clean/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/nodejs-express/pro/clean/Dockerfile.hbs +45 -0
- package/templates/nodejs-express/pro/clean/README.md.hbs +41 -0
- package/templates/nodejs-express/pro/clean/docker-compose.yml.hbs +18 -0
- package/templates/nodejs-express/pro/clean/infra/main.tf.hbs +83 -0
- package/templates/nodejs-express/pro/clean/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/nodejs-express/pro/clean/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/nodejs-express/pro/clean/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/nodejs-express/pro/clean/package.json.hbs +55 -0
- package/templates/nodejs-express/pro/clean/src/application/services/AuthService.ts.hbs +66 -0
- package/templates/nodejs-express/pro/clean/src/domain/entities/User.ts.hbs +38 -0
- package/templates/nodejs-express/pro/clean/src/domain/repositories/IUserRepository.ts.hbs +13 -0
- package/templates/nodejs-express/pro/clean/src/domain/usecases/LoginUserUseCase.ts.hbs +39 -0
- package/templates/nodejs-express/pro/clean/src/domain/usecases/RegisterUserUseCase.ts.hbs +51 -0
- package/templates/nodejs-express/pro/clean/src/index.ts.hbs +40 -0
- package/templates/nodejs-express/pro/clean/src/infrastructure/database/InMemoryUserRepository.ts.hbs +46 -0
- package/templates/nodejs-express/pro/clean/src/infrastructure/http/controllers/AuthController.ts.hbs +45 -0
- package/templates/nodejs-express/pro/clean/src/infrastructure/http/middlewares/AuthMiddleware.ts.hbs +27 -0
- package/templates/nodejs-express/pro/clean/src/infrastructure/providers/PasswordHasher.ts.hbs +14 -0
- package/templates/nodejs-express/pro/clean/src/infrastructure/providers/TokenGenerator.ts.hbs +25 -0
- package/templates/nodejs-express/pro/clean/tsconfig.json.hbs +27 -0
- package/templates/nodejs-express/pro/hexagonal/.env.example.hbs +19 -0
- package/templates/nodejs-express/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/nodejs-express/pro/hexagonal/Dockerfile.hbs +45 -0
- package/templates/nodejs-express/pro/hexagonal/README.md.hbs +42 -0
- package/templates/nodejs-express/pro/hexagonal/docker-compose.yml.hbs +18 -0
- package/templates/nodejs-express/pro/hexagonal/infra/main.tf.hbs +83 -0
- package/templates/nodejs-express/pro/hexagonal/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/nodejs-express/pro/hexagonal/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/nodejs-express/pro/hexagonal/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/nodejs-express/pro/hexagonal/package.json.hbs +55 -0
- package/templates/nodejs-express/pro/hexagonal/src/adapters/inbound/http/AuthController.ts.hbs +48 -0
- package/templates/nodejs-express/pro/hexagonal/src/adapters/outbound/SecurityAdapters.ts.hbs +31 -0
- package/templates/nodejs-express/pro/hexagonal/src/adapters/outbound/persistence/InMemoryUserAdapter.ts.hbs +38 -0
- package/templates/nodejs-express/pro/hexagonal/src/core/AuthService.ts.hbs +51 -0
- package/templates/nodejs-express/pro/hexagonal/src/core/domain/entities/User.ts.hbs +28 -0
- package/templates/nodejs-express/pro/hexagonal/src/core/ports/inbound/IAuthPort.ts.hbs +11 -0
- package/templates/nodejs-express/pro/hexagonal/src/core/ports/outbound/ISecurityPorts.ts.hbs +15 -0
- package/templates/nodejs-express/pro/hexagonal/src/core/ports/outbound/IUserRepositoryPort.ts.hbs +13 -0
- package/templates/nodejs-express/pro/hexagonal/src/index.ts.hbs +41 -0
- package/templates/nodejs-express/pro/hexagonal/tsconfig.json.hbs +27 -0
- package/templates/nodejs-express/pro/mvc/.env.example.hbs +19 -0
- package/templates/nodejs-express/pro/mvc/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/nodejs-express/pro/mvc/Dockerfile.hbs +45 -0
- package/templates/nodejs-express/pro/mvc/README.md.hbs +85 -0
- package/templates/nodejs-express/pro/mvc/docker-compose.yml.hbs +18 -0
- package/templates/nodejs-express/pro/mvc/infra/main.tf.hbs +83 -0
- package/templates/nodejs-express/pro/mvc/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/nodejs-express/pro/mvc/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/nodejs-express/pro/mvc/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/nodejs-express/pro/mvc/package.json.hbs +55 -0
- package/templates/nodejs-express/pro/mvc/src/app.ts.hbs +34 -0
- package/templates/nodejs-express/pro/mvc/src/config/database.ts.hbs +10 -0
- package/templates/nodejs-express/pro/mvc/src/controllers/auth.controller.ts.hbs +91 -0
- package/templates/nodejs-express/pro/mvc/src/controllers/healthController.ts.hbs +20 -0
- package/templates/nodejs-express/pro/mvc/src/controllers/payments.controller.ts.hbs +72 -0
- package/templates/nodejs-express/pro/mvc/src/index.ts.hbs +12 -0
- package/templates/nodejs-express/pro/mvc/src/middleware/errorHandler.ts.hbs +22 -0
- package/templates/nodejs-express/pro/mvc/src/middlewares/auth.middleware.ts.hbs +31 -0
- package/templates/nodejs-express/pro/mvc/src/models/.gitkeep +0 -0
- package/templates/nodejs-express/pro/mvc/src/routes/index.ts.hbs +14 -0
- package/templates/nodejs-express/pro/mvc/src/services/.gitkeep +0 -0
- package/templates/nodejs-express/pro/mvc/src/services/stripe.service.ts.hbs +102 -0
- package/templates/nodejs-express/pro/mvc/template.json +18 -0
- package/templates/nodejs-express/pro/mvc/tsconfig.json.hbs +27 -0
- package/templates/python-fastapi/free/mvc/README.md.hbs +41 -0
- package/templates/python-fastapi/free/mvc/app/controllers/health.py.hbs +7 -0
- package/templates/python-fastapi/free/mvc/app/controllers/items.py.hbs +27 -0
- package/templates/python-fastapi/free/mvc/app/main.py.hbs +26 -0
- package/templates/python-fastapi/free/mvc/app/models/item.py.hbs +11 -0
- package/templates/python-fastapi/free/mvc/app/schemas/item.py.hbs +17 -0
- package/templates/python-fastapi/free/mvc/app/services/item_service.py.hbs +33 -0
- package/templates/python-fastapi/free/mvc/requirements.txt.hbs +4 -0
- package/templates/python-fastapi/pro/clean/.env.example.hbs +17 -0
- package/templates/python-fastapi/pro/clean/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/python-fastapi/pro/clean/Dockerfile.hbs +20 -0
- package/templates/python-fastapi/pro/clean/app/domain/entities/user.py.hbs +23 -0
- package/templates/python-fastapi/pro/clean/app/domain/repositories/user_repository.py.hbs +22 -0
- package/templates/python-fastapi/pro/clean/app/domain/usecases/register_user.py.hbs +30 -0
- package/templates/python-fastapi/pro/clean/app/infrastructure/database/in_memory_repository.py.hbs +26 -0
- package/templates/python-fastapi/pro/clean/app/infrastructure/http/auth_controller.py.hbs +26 -0
- package/templates/python-fastapi/pro/clean/app/infrastructure/security/adapters.py.hbs +23 -0
- package/templates/python-fastapi/pro/clean/app/main.py.hbs +10 -0
- package/templates/python-fastapi/pro/clean/infra/main.tf.hbs +83 -0
- package/templates/python-fastapi/pro/clean/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/python-fastapi/pro/clean/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/python-fastapi/pro/clean/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/python-fastapi/pro/clean/requirements.txt.hbs +12 -0
- package/templates/python-fastapi/pro/hexagonal/.env.example.hbs +17 -0
- package/templates/python-fastapi/pro/hexagonal/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/python-fastapi/pro/hexagonal/Dockerfile.hbs +20 -0
- package/templates/python-fastapi/pro/hexagonal/app/adapters/inbound/http_adapter.py.hbs +29 -0
- package/templates/python-fastapi/pro/hexagonal/app/core/domain/user.py.hbs +15 -0
- package/templates/python-fastapi/pro/hexagonal/app/core/ports.py.hbs +25 -0
- package/templates/python-fastapi/pro/hexagonal/app/core/service.py.hbs +28 -0
- package/templates/python-fastapi/pro/hexagonal/app/main.py.hbs +22 -0
- package/templates/python-fastapi/pro/hexagonal/infra/main.tf.hbs +83 -0
- package/templates/python-fastapi/pro/hexagonal/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/python-fastapi/pro/hexagonal/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/python-fastapi/pro/hexagonal/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/python-fastapi/pro/hexagonal/requirements.txt.hbs +12 -0
- package/templates/python-fastapi/pro/mvc/.env.example.hbs +17 -0
- package/templates/python-fastapi/pro/mvc/.github/workflows/ci-cd.yml.hbs +88 -0
- package/templates/python-fastapi/pro/mvc/Dockerfile.hbs +20 -0
- package/templates/python-fastapi/pro/mvc/README.md.hbs +41 -0
- package/templates/python-fastapi/pro/mvc/app/controllers/auth.py.hbs +46 -0
- package/templates/python-fastapi/pro/mvc/app/controllers/health.py.hbs +7 -0
- package/templates/python-fastapi/pro/mvc/app/controllers/items.py.hbs +21 -0
- package/templates/python-fastapi/pro/mvc/app/controllers/payments.py.hbs +32 -0
- package/templates/python-fastapi/pro/mvc/app/main.py.hbs +20 -0
- package/templates/python-fastapi/pro/mvc/app/middleware/security.py.hbs +39 -0
- package/templates/python-fastapi/pro/mvc/app/models/item.py.hbs +11 -0
- package/templates/python-fastapi/pro/mvc/app/schemas/item.py.hbs +16 -0
- package/templates/python-fastapi/pro/mvc/app/services/item_service.py.hbs +24 -0
- package/templates/python-fastapi/pro/mvc/infra/main.tf.hbs +83 -0
- package/templates/python-fastapi/pro/mvc/infra/modules/ecs/main.tf.hbs +54 -0
- package/templates/python-fastapi/pro/mvc/infra/modules/rds/main.tf.hbs +88 -0
- package/templates/python-fastapi/pro/mvc/infra/modules/vpc/main.tf.hbs +107 -0
- package/templates/python-fastapi/pro/mvc/requirements.txt.hbs +12 -0
package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/config/SecurityConfig.java.hbs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
package {{packageName}}.security;
|
|
2
|
+
|
|
3
|
+
import jakarta.servlet.FilterChain;
|
|
4
|
+
import jakarta.servlet.ServletException;
|
|
5
|
+
import jakarta.servlet.http.HttpServletRequest;
|
|
6
|
+
import jakarta.servlet.http.HttpServletResponse;
|
|
7
|
+
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
|
8
|
+
import org.springframework.security.core.context.SecurityContextHolder;
|
|
9
|
+
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
|
10
|
+
import org.springframework.stereotype.Component;
|
|
11
|
+
import org.springframework.util.StringUtils;
|
|
12
|
+
import org.springframework.web.filter.OncePerRequestFilter;
|
|
13
|
+
|
|
14
|
+
import java.io.IOException;
|
|
15
|
+
import java.util.Collections;
|
|
16
|
+
|
|
17
|
+
@Component
|
|
18
|
+
public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
|
19
|
+
|
|
20
|
+
private final JwtTokenProvider tokenProvider;
|
|
21
|
+
|
|
22
|
+
public JwtAuthenticationFilter(JwtTokenProvider tokenProvider) {
|
|
23
|
+
this.tokenProvider = tokenProvider;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@Override
|
|
27
|
+
protected void doFilterInternal(HttpServletRequest request,
|
|
28
|
+
HttpServletResponse response,
|
|
29
|
+
FilterChain filterChain) throws ServletException, IOException {
|
|
30
|
+
try {
|
|
31
|
+
String jwt = getJwtFromRequest(request);
|
|
32
|
+
|
|
33
|
+
if (StringUtils.hasText(jwt) && tokenProvider.validateToken(jwt)) {
|
|
34
|
+
String userId = tokenProvider.getUserIdFromToken(jwt);
|
|
35
|
+
|
|
36
|
+
UsernamePasswordAuthenticationToken authentication =
|
|
37
|
+
new UsernamePasswordAuthenticationToken(userId, null, Collections.emptyList());
|
|
38
|
+
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
|
39
|
+
|
|
40
|
+
SecurityContextHolder.getContext().setAuthentication(authentication);
|
|
41
|
+
}
|
|
42
|
+
} catch (Exception ex) {
|
|
43
|
+
logger.error("Could not set user authentication in security context", ex);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
filterChain.doFilter(request, response);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private String getJwtFromRequest(HttpServletRequest request) {
|
|
50
|
+
String bearerToken = request.getHeader("Authorization");
|
|
51
|
+
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) {
|
|
52
|
+
return bearerToken.substring(7);
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
package {{packageName}}.security;
|
|
2
|
+
|
|
3
|
+
import io.jsonwebtoken.*;
|
|
4
|
+
import io.jsonwebtoken.security.Keys;
|
|
5
|
+
import org.springframework.beans.factory.annotation.Value;
|
|
6
|
+
import org.springframework.stereotype.Component;
|
|
7
|
+
|
|
8
|
+
import javax.crypto.SecretKey;
|
|
9
|
+
import java.nio.charset.StandardCharsets;
|
|
10
|
+
import java.util.Date;
|
|
11
|
+
|
|
12
|
+
@Component
|
|
13
|
+
public class JwtTokenProvider {
|
|
14
|
+
|
|
15
|
+
@Value("${jwt.secret:your-super-secret-jwt-key-change-in-production}")
|
|
16
|
+
private String jwtSecret;
|
|
17
|
+
|
|
18
|
+
@Value("${jwt.expiration:604800000}")
|
|
19
|
+
private long jwtExpiration; // 7 days in milliseconds
|
|
20
|
+
|
|
21
|
+
private SecretKey getSigningKey() {
|
|
22
|
+
return Keys.hmacShaKeyFor(jwtSecret.getBytes(StandardCharsets.UTF_8));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public String generateToken(String userId, String email) {
|
|
26
|
+
Date now = new Date();
|
|
27
|
+
Date expiryDate = new Date(now.getTime() + jwtExpiration);
|
|
28
|
+
|
|
29
|
+
return Jwts.builder()
|
|
30
|
+
.subject(userId)
|
|
31
|
+
.claim("email", email)
|
|
32
|
+
.issuedAt(now)
|
|
33
|
+
.expiration(expiryDate)
|
|
34
|
+
.signWith(getSigningKey())
|
|
35
|
+
.compact();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public String getUserIdFromToken(String token) {
|
|
39
|
+
Claims claims = Jwts.parser()
|
|
40
|
+
.verifyWith(getSigningKey())
|
|
41
|
+
.build()
|
|
42
|
+
.parseSignedClaims(token)
|
|
43
|
+
.getPayload();
|
|
44
|
+
|
|
45
|
+
return claims.getSubject();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public boolean validateToken(String token) {
|
|
49
|
+
try {
|
|
50
|
+
Jwts.parser()
|
|
51
|
+
.verifyWith(getSigningKey())
|
|
52
|
+
.build()
|
|
53
|
+
.parseSignedClaims(token);
|
|
54
|
+
return true;
|
|
55
|
+
} catch (JwtException | IllegalArgumentException e) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
File without changes
|
package/templates/java-spring/pro/mvc/src/main/java/{{packagePath}}/service/StripeService.java.hbs
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
package {{packageName}}.service;
|
|
2
|
+
|
|
3
|
+
import com.stripe.Stripe;
|
|
4
|
+
import com.stripe.exception.StripeException;
|
|
5
|
+
import com.stripe.model.Customer;
|
|
6
|
+
import com.stripe.model.checkout.Session;
|
|
7
|
+
import com.stripe.param.CustomerCreateParams;
|
|
8
|
+
import com.stripe.param.checkout.SessionCreateParams;
|
|
9
|
+
import jakarta.annotation.PostConstruct;
|
|
10
|
+
import org.springframework.beans.factory.annotation.Value;
|
|
11
|
+
import org.springframework.stereotype.Service;
|
|
12
|
+
|
|
13
|
+
@Service
|
|
14
|
+
public class StripeService {
|
|
15
|
+
|
|
16
|
+
@Value("${stripe.secret-key}")
|
|
17
|
+
private String stripeSecretKey;
|
|
18
|
+
|
|
19
|
+
@Value("${stripe.price-id}")
|
|
20
|
+
private String priceId;
|
|
21
|
+
|
|
22
|
+
@Value("${frontend.url}")
|
|
23
|
+
private String frontendUrl;
|
|
24
|
+
|
|
25
|
+
@PostConstruct
|
|
26
|
+
public void init() {
|
|
27
|
+
Stripe.apiKey = stripeSecretKey;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public Session createCheckoutSession(String customerId) throws StripeException {
|
|
31
|
+
SessionCreateParams.Builder paramsBuilder = SessionCreateParams.builder()
|
|
32
|
+
.setMode(SessionCreateParams.Mode.SUBSCRIPTION)
|
|
33
|
+
.setSuccessUrl(frontendUrl + "/success?session_id={CHECKOUT_SESSION_ID}")
|
|
34
|
+
.setCancelUrl(frontendUrl + "/cancel")
|
|
35
|
+
.addLineItem(
|
|
36
|
+
SessionCreateParams.LineItem.builder()
|
|
37
|
+
.setPrice(priceId)
|
|
38
|
+
.setQuantity(1L)
|
|
39
|
+
.build()
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (customerId != null && !customerId.isEmpty()) {
|
|
43
|
+
paramsBuilder.setCustomer(customerId);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return Session.create(paramsBuilder.build());
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public com.stripe.model.billingportal.Session createPortalSession(String customerId) throws StripeException {
|
|
50
|
+
com.stripe.param.billingportal.SessionCreateParams params =
|
|
51
|
+
com.stripe.param.billingportal.SessionCreateParams.builder()
|
|
52
|
+
.setCustomer(customerId)
|
|
53
|
+
.setReturnUrl(frontendUrl + "/dashboard")
|
|
54
|
+
.build();
|
|
55
|
+
|
|
56
|
+
return com.stripe.model.billingportal.Session.create(params);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public Customer createCustomer(String email, String name) throws StripeException {
|
|
60
|
+
CustomerCreateParams params = CustomerCreateParams.builder()
|
|
61
|
+
.setEmail(email)
|
|
62
|
+
.setName(name)
|
|
63
|
+
.build();
|
|
64
|
+
|
|
65
|
+
return Customer.create(params);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
package {{packageName}};
|
|
2
|
+
|
|
3
|
+
import org.springframework.boot.SpringApplication;
|
|
4
|
+
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
5
|
+
|
|
6
|
+
@SpringBootApplication
|
|
7
|
+
public class {{projectNamePascalCase}}Application {
|
|
8
|
+
|
|
9
|
+
public static void main(String[] args) {
|
|
10
|
+
SpringApplication.run({{projectNamePascalCase}}Application.class, args);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
spring:
|
|
2
|
+
application:
|
|
3
|
+
name: {{projectNameKebabCase}}
|
|
4
|
+
|
|
5
|
+
datasource:
|
|
6
|
+
url: jdbc:postgresql://localhost:5432/{{projectNameSnakeCase}}
|
|
7
|
+
username: postgres
|
|
8
|
+
password: postgres
|
|
9
|
+
driver-class-name: org.postgresql.Driver
|
|
10
|
+
|
|
11
|
+
jpa:
|
|
12
|
+
hibernate:
|
|
13
|
+
ddl-auto: update
|
|
14
|
+
show-sql: true
|
|
15
|
+
properties:
|
|
16
|
+
hibernate:
|
|
17
|
+
format_sql: true
|
|
18
|
+
dialect: org.hibernate.dialect.PostgreSQLDialect
|
|
19
|
+
|
|
20
|
+
# H2 Console (for development)
|
|
21
|
+
h2:
|
|
22
|
+
console:
|
|
23
|
+
enabled: true
|
|
24
|
+
path: /h2-console
|
|
25
|
+
|
|
26
|
+
server:
|
|
27
|
+
port: 8080
|
|
28
|
+
|
|
29
|
+
logging:
|
|
30
|
+
level:
|
|
31
|
+
root: INFO
|
|
32
|
+
{{packageName}}: DEBUG
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Java Spring Boot MVC",
|
|
3
|
+
"tier": "free",
|
|
4
|
+
"stack": "java-spring",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": "Spring Boot 4 REST API with Java 21 and MVC architecture",
|
|
7
|
+
"targetVersions": {
|
|
8
|
+
"java": "21",
|
|
9
|
+
"springBoot": "^4.0.0",
|
|
10
|
+
"maven": "^3.9.0"
|
|
11
|
+
},
|
|
12
|
+
"requiredConfig": ["projectName", "packageName"],
|
|
13
|
+
"optionalConfig": ["useAI", "buildTool"]
|
|
14
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
> Generated by [Kybernus CLI](https://kybernus.dev) 🚀 (Free)
|
|
4
|
+
|
|
5
|
+
## Stack
|
|
6
|
+
|
|
7
|
+
- **Framework**: NestJS
|
|
8
|
+
- **Language**: TypeScript
|
|
9
|
+
- **Validation**: class-validator
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install
|
|
15
|
+
npm run dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## API Endpoints
|
|
19
|
+
|
|
20
|
+
- `GET /api/health` - Health check
|
|
21
|
+
- `GET /api/items` - List items
|
|
22
|
+
- `POST /api/items` - Create item
|
|
23
|
+
- `GET /api/items/:id` - Get item
|
|
24
|
+
- `DELETE /api/items/:id` - Delete item
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
Made with ❤️ using [Kybernus](https://kybernus.dev)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{kebabCase projectName}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Generated by Kybernus CLI",
|
|
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/platform-express": "^10.3.0",
|
|
17
|
+
"class-transformer": "^0.5.1",
|
|
18
|
+
"class-validator": "^0.14.1",
|
|
19
|
+
"reflect-metadata": "^0.2.1",
|
|
20
|
+
"rxjs": "^7.8.1",
|
|
21
|
+
"uuid": "^9.0.1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@nestjs/cli": "^10.3.0",
|
|
25
|
+
"@types/node": "^20.11.0",
|
|
26
|
+
"@types/uuid": "^9.0.7",
|
|
27
|
+
"typescript": "^5.3.3"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { ConfigModule } from '@nestjs/config';
|
|
3
|
+
import { ItemsModule } from './modules/items.module';
|
|
4
|
+
import { HealthController } from './controllers/health.controller';
|
|
5
|
+
|
|
6
|
+
@Module({
|
|
7
|
+
imports: [
|
|
8
|
+
ConfigModule.forRoot({ isGlobal: true }),
|
|
9
|
+
ItemsModule,
|
|
10
|
+
],
|
|
11
|
+
controllers: [HealthController],
|
|
12
|
+
})
|
|
13
|
+
export class AppModule {}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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();
|