@sibyllinesoft/arbiter 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +222 -0
- package/dist/cli.js +28718 -0
- package/dist/templates/plopfiles/__tests__/build-systems.test.ts +730 -0
- package/dist/templates/plopfiles/__tests__/e2e.test.ts +451 -0
- package/dist/templates/plopfiles/__tests__/generation.test.ts +384 -0
- package/dist/templates/plopfiles/__tests__/linting.test.ts +854 -0
- package/dist/templates/plopfiles/__tests__/modules.test.ts +278 -0
- package/dist/templates/plopfiles/__tests__/smoke.test.ts +619 -0
- package/dist/templates/plopfiles/__tests__/templates.test.ts +341 -0
- package/dist/templates/plopfiles/_modules/backends/go-chi/module.js +43 -0
- package/dist/templates/plopfiles/_modules/backends/go-chi/templates/.air.toml.hbs +30 -0
- package/dist/templates/plopfiles/_modules/backends/go-chi/templates/cmd/server/main.go.hbs +50 -0
- package/dist/templates/plopfiles/_modules/backends/go-chi/templates/go.mod.hbs +9 -0
- package/dist/templates/plopfiles/_modules/backends/go-chi/templates/internal/handlers/health.go.hbs +51 -0
- package/dist/templates/plopfiles/_modules/backends/kotlin-ktor/module.js +38 -0
- package/dist/templates/plopfiles/_modules/backends/kotlin-ktor/templates/build.gradle.kts.hbs +37 -0
- package/dist/templates/plopfiles/_modules/backends/kotlin-ktor/templates/settings.gradle.kts.hbs +1 -0
- package/dist/templates/plopfiles/_modules/backends/kotlin-ktor/templates/src/main/kotlin/Application.kt.hbs +44 -0
- package/dist/templates/plopfiles/_modules/backends/kotlin-ktor/templates/src/main/kotlin/routes/Health.kt.hbs +41 -0
- package/dist/templates/plopfiles/_modules/backends/kotlin-ktor/templates/src/main/resources/logback.xml.hbs +11 -0
- package/dist/templates/plopfiles/_modules/backends/node-express/module.js +54 -0
- package/dist/templates/plopfiles/_modules/backends/node-express/templates/src/index.ts.hbs +37 -0
- package/dist/templates/plopfiles/_modules/backends/node-express/templates/src/routes/health.ts.hbs +21 -0
- package/dist/templates/plopfiles/_modules/backends/node-express/templates/tsconfig.json.hbs +18 -0
- package/dist/templates/plopfiles/_modules/backends/node-hono/module.js +56 -0
- package/dist/templates/plopfiles/_modules/backends/node-hono/templates/src/index.ts.hbs +30 -0
- package/dist/templates/plopfiles/_modules/backends/node-hono/templates/src/routes/health.ts.hbs +64 -0
- package/dist/templates/plopfiles/_modules/backends/node-hono/templates/src/routes/index.ts.hbs +38 -0
- package/dist/templates/plopfiles/_modules/backends/node-hono/templates/tsconfig.json.hbs +20 -0
- package/dist/templates/plopfiles/_modules/backends/node-hono/templates/typedoc.json.hbs +25 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/module.js +65 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/app/__init__.py.hbs +1 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/app/config.py.hbs +28 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/app/main.py.hbs +40 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/app/routers/__init__.py.hbs +1 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/app/routers/health.py.hbs +24 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/pyproject.toml.hbs +40 -0
- package/dist/templates/plopfiles/_modules/backends/python-fastapi/templates/requirements.txt.hbs +6 -0
- package/dist/templates/plopfiles/_modules/backends/rust-axum/module.js +44 -0
- package/dist/templates/plopfiles/_modules/backends/rust-axum/templates/Cargo.toml.hbs +23 -0
- package/dist/templates/plopfiles/_modules/backends/rust-axum/templates/src/health.rs.hbs +41 -0
- package/dist/templates/plopfiles/_modules/backends/rust-axum/templates/src/main.rs.hbs +57 -0
- package/dist/templates/plopfiles/_modules/cloud/aws/module.js +33 -0
- package/dist/templates/plopfiles/_modules/cloud/aws/templates/aws-alb.tf.hbs +92 -0
- package/dist/templates/plopfiles/_modules/cloud/aws/templates/aws-ecs.tf.hbs +84 -0
- package/dist/templates/plopfiles/_modules/cloud/aws/templates/aws-iam.tf.hbs +60 -0
- package/dist/templates/plopfiles/_modules/cloud/aws/templates/aws-vpc.tf.hbs +106 -0
- package/dist/templates/plopfiles/_modules/cloud/aws/templates/aws.tf.hbs +56 -0
- package/dist/templates/plopfiles/_modules/cloud/azure/module.js +31 -0
- package/dist/templates/plopfiles/_modules/cloud/azure/templates/azure-container-apps.tf.hbs +99 -0
- package/dist/templates/plopfiles/_modules/cloud/azure/templates/azure.tf.hbs +54 -0
- package/dist/templates/plopfiles/_modules/cloud/cloudflare/module.js +43 -0
- package/dist/templates/plopfiles/_modules/cloud/cloudflare/templates/src/types.d.ts.hbs +6 -0
- package/dist/templates/plopfiles/_modules/cloud/cloudflare/templates/src/worker.ts.hbs +51 -0
- package/dist/templates/plopfiles/_modules/cloud/cloudflare/templates/wrangler.toml.hbs +36 -0
- package/dist/templates/plopfiles/_modules/cloud/gcp/module.js +31 -0
- package/dist/templates/plopfiles/_modules/cloud/gcp/templates/gcp-cloudrun.tf.hbs +89 -0
- package/dist/templates/plopfiles/_modules/cloud/gcp/templates/gcp.tf.hbs +62 -0
- package/dist/templates/plopfiles/_modules/cloud/supabase/module.js +51 -0
- package/dist/templates/plopfiles/_modules/cloud/supabase/templates/src/lib/supabase.ts.hbs +25 -0
- package/dist/templates/plopfiles/_modules/cloud/supabase/templates/src/types/supabase.ts.hbs +52 -0
- package/dist/templates/plopfiles/_modules/cloud/supabase/templates/supabase/config.toml.hbs +71 -0
- package/dist/templates/plopfiles/_modules/cloud/supabase/templates/supabase/functions/hello/index.ts.hbs +34 -0
- package/dist/templates/plopfiles/_modules/cloud/supabase/templates/supabase/migrations/00000000000000_init.sql.hbs +60 -0
- package/dist/templates/plopfiles/_modules/composer.js +180 -0
- package/dist/templates/plopfiles/_modules/databases/postgres-drizzle/drizzle.config.ts.hbs +10 -0
- package/dist/templates/plopfiles/_modules/databases/postgres-drizzle/module.js +53 -0
- package/dist/templates/plopfiles/_modules/databases/postgres-drizzle/templates/index.ts.hbs +15 -0
- package/dist/templates/plopfiles/_modules/databases/postgres-drizzle/templates/schema.ts.hbs +21 -0
- package/dist/templates/plopfiles/_modules/desktop/electron/module.js +51 -0
- package/dist/templates/plopfiles/_modules/desktop/electron/templates/forge.config.ts.hbs +38 -0
- package/dist/templates/plopfiles/_modules/desktop/electron/templates/package.json.hbs +22 -0
- package/dist/templates/plopfiles/_modules/desktop/electron/templates/src/main.ts.hbs +48 -0
- package/dist/templates/plopfiles/_modules/desktop/electron/templates/src/preload.ts.hbs +18 -0
- package/dist/templates/plopfiles/_modules/desktop/electron/templates/tsconfig.json.hbs +14 -0
- package/dist/templates/plopfiles/_modules/desktop/tauri/module.js +38 -0
- package/dist/templates/plopfiles/_modules/desktop/tauri/templates/src-tauri/Cargo.toml.hbs +20 -0
- package/dist/templates/plopfiles/_modules/desktop/tauri/templates/src-tauri/build.rs.hbs +3 -0
- package/dist/templates/plopfiles/_modules/desktop/tauri/templates/src-tauri/src/main.rs.hbs +30 -0
- package/dist/templates/plopfiles/_modules/desktop/tauri/templates/src-tauri/tauri.conf.json.hbs +44 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/module.js +61 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/architecture/components.md.hbs +37 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/architecture/overview.md.hbs +43 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/contributing/development.md.hbs +164 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/contributing/guidelines.md.hbs +50 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/getting-started/configuration.md.hbs +37 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/getting-started/installation.md.hbs +53 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/getting-started/quickstart.md.hbs +39 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/index.md.hbs +44 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/javascripts/extra.js.hbs +23 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/docs/stylesheets/extra.css.hbs +51 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/mkdocs.yml.hbs +141 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/requirements-docs.txt.hbs +15 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/scripts/aggregate-docs.mjs.hbs +188 -0
- package/dist/templates/plopfiles/_modules/docs/mkdocs/templates/scripts/gen_ref_pages.py.hbs +54 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/module.js +60 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/index.html.hbs +13 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/nginx.conf.hbs +31 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/postcss.config.js.hbs +6 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/src/App.tsx.hbs +12 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/src/index.css.hbs +25 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/src/lib/api.ts.hbs +52 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/src/main.tsx.hbs +18 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/src/pages/Home.tsx.hbs +31 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/tailwind.config.js.hbs +8 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/tsconfig.json.hbs +25 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/tsconfig.node.json.hbs +10 -0
- package/dist/templates/plopfiles/_modules/frontends/react-vite/templates/vite.config.ts.hbs +21 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/module.js +51 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/index.html.hbs +13 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/postcss.config.js.hbs +6 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/src/App.tsx.hbs +12 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/src/index.css.hbs +3 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/src/index.tsx.hbs +21 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/src/lib/api.ts.hbs +52 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/src/pages/Home.tsx.hbs +34 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/tailwind.config.js.hbs +8 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/tsconfig.json.hbs +24 -0
- package/dist/templates/plopfiles/_modules/frontends/solid-vite/templates/vite.config.ts.hbs +21 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/module.js +54 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/index.html.hbs +13 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/postcss.config.js.hbs +6 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/src/App.vue.hbs +9 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/src/index.css.hbs +3 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/src/lib/api.ts.hbs +52 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/src/main.ts.hbs +14 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/src/pages/Home.vue.hbs +27 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/src/router.ts.hbs +13 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/tailwind.config.js.hbs +8 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/tsconfig.json.hbs +25 -0
- package/dist/templates/plopfiles/_modules/frontends/vue-vite/templates/vite.config.ts.hbs +21 -0
- package/dist/templates/plopfiles/_modules/infra/docker-compose/module.js +52 -0
- package/dist/templates/plopfiles/_modules/infra/docker-compose/templates/Dockerfile.backend.hbs +32 -0
- package/dist/templates/plopfiles/_modules/infra/docker-compose/templates/Dockerfile.frontend.hbs +31 -0
- package/dist/templates/plopfiles/_modules/infra/docker-compose/templates/docker-compose.yml.hbs +97 -0
- package/dist/templates/plopfiles/_modules/infra/github-actions/module.js +24 -0
- package/dist/templates/plopfiles/_modules/infra/github-actions/templates/.github/workflows/ci.yml.hbs +78 -0
- package/dist/templates/plopfiles/_modules/infra/github-actions/templates/.github/workflows/deploy.yml.hbs +60 -0
- package/dist/templates/plopfiles/_modules/infra/just/module.js +26 -0
- package/dist/templates/plopfiles/_modules/infra/just/templates/justfile.hbs +205 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/module.js +30 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/base/deployment.yaml.hbs +48 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/base/ingress.yaml.hbs +23 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/base/kustomization.yaml.hbs +11 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/base/service.yaml.hbs +15 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/overlays/dev/deployment-patch.yaml.hbs +17 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/overlays/dev/kustomization.yaml.hbs +15 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/overlays/prod/deployment-patch.yaml.hbs +17 -0
- package/dist/templates/plopfiles/_modules/infra/kubernetes/templates/k8s/overlays/prod/kustomization.yaml.hbs +15 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/module.js +30 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/templates/.gitignore.hbs +5 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/templates/Pulumi.dev.yaml.hbs +3 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/templates/Pulumi.yaml.hbs +7 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/templates/index.ts.hbs +26 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/templates/package.json.hbs +12 -0
- package/dist/templates/plopfiles/_modules/infra/pulumi/templates/tsconfig.json.hbs +16 -0
- package/dist/templates/plopfiles/_modules/infra/terraform/module.js +31 -0
- package/dist/templates/plopfiles/_modules/infra/terraform/templates/.gitignore.hbs +12 -0
- package/dist/templates/plopfiles/_modules/infra/terraform/templates/main.tf.hbs +34 -0
- package/dist/templates/plopfiles/_modules/infra/terraform/templates/outputs.tf.hbs +15 -0
- package/dist/templates/plopfiles/_modules/infra/terraform/templates/terraform.tfvars.example.hbs +6 -0
- package/dist/templates/plopfiles/_modules/infra/terraform/templates/variables.tf.hbs +30 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/module.js +38 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/build.gradle.kts.hbs +102 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/proguard-rules.pro.hbs +20 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/AndroidManifest.xml.hbs +25 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/kotlin/com/example/app/ApiClient.kt.hbs +38 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/kotlin/com/example/app/App.kt.hbs +116 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/kotlin/com/example/app/MainActivity.kt.hbs +28 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/kotlin/com/example/app/ui/theme/Color.kt.hbs +11 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/kotlin/com/example/app/ui/theme/Theme.kt.hbs +55 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/kotlin/com/example/app/ui/theme/Type.kt.hbs +31 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/res/values/strings.xml.hbs +3 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/app/src/main/res/values/themes.xml.hbs +4 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/build.gradle.kts.hbs +6 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/gradle.properties.hbs +4 -0
- package/dist/templates/plopfiles/_modules/mobile/android-kotlin/templates/settings.gradle.kts.hbs +18 -0
- package/dist/templates/plopfiles/_modules/mobile/flutter/module.js +36 -0
- package/dist/templates/plopfiles/_modules/mobile/flutter/templates/.env.hbs +1 -0
- package/dist/templates/plopfiles/_modules/mobile/flutter/templates/lib/main.dart.hbs +29 -0
- package/dist/templates/plopfiles/_modules/mobile/flutter/templates/lib/screens/home_screen.dart.hbs +88 -0
- package/dist/templates/plopfiles/_modules/mobile/flutter/templates/lib/services/api_service.dart.hbs +61 -0
- package/dist/templates/plopfiles/_modules/mobile/flutter/templates/pubspec.yaml.hbs +25 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/module.js +39 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/App.swift.hbs +10 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/Assets.xcassets/AccentColor.colorset/Contents.json.hbs +11 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/Assets.xcassets/AppIcon.appiconset/Contents.json.hbs +13 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/Assets.xcassets/Contents.json.hbs +6 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/ContentView.swift.hbs +13 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/Services/APIClient.swift.hbs +58 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/Views/DetailsView.swift.hbs +22 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App/Views/HomeView.swift.hbs +62 -0
- package/dist/templates/plopfiles/_modules/mobile/ios-swift/templates/App.xcodeproj/project.pbxproj.hbs +363 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/module.js +36 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/templates/app/_layout.tsx.hbs +16 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/templates/app/index.tsx.hbs +66 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/templates/app.json.hbs +37 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/templates/package.json.hbs +29 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/templates/src/lib/api.ts.hbs +52 -0
- package/dist/templates/plopfiles/_modules/mobile/react-native/templates/tsconfig.json.hbs +11 -0
- package/dist/templates/plopfiles/_modules/quality/biome/module.js +44 -0
- package/dist/templates/plopfiles/_modules/quality/biome/templates/biome.json.hbs +126 -0
- package/dist/templates/plopfiles/_modules/quality/clippy/module.js +40 -0
- package/dist/templates/plopfiles/_modules/quality/clippy/templates/clippy.toml.hbs +29 -0
- package/dist/templates/plopfiles/_modules/quality/clippy/templates/rustfmt.toml.hbs +44 -0
- package/dist/templates/plopfiles/_modules/quality/golangci-lint/module.js +40 -0
- package/dist/templates/plopfiles/_modules/quality/golangci-lint/templates/.golangci.yml.hbs +199 -0
- package/dist/templates/plopfiles/_modules/quality/ruff/module.js +43 -0
- package/dist/templates/plopfiles/_modules/quality/ruff/templates/mypy.ini.hbs +48 -0
- package/dist/templates/plopfiles/_modules/quality/ruff/templates/ruff.toml.hbs +111 -0
- package/dist/templates/plopfiles/_modules/storybook/react-storybook/module.js +54 -0
- package/dist/templates/plopfiles/_modules/storybook/react-storybook/templates/.storybook/main.ts.hbs +44 -0
- package/dist/templates/plopfiles/_modules/storybook/react-storybook/templates/.storybook/preview.ts.hbs +68 -0
- package/dist/templates/plopfiles/_modules/storybook/react-storybook/templates/src/stories/Button.stories.tsx.hbs +158 -0
- package/dist/templates/plopfiles/_modules/types.ts +98 -0
- package/dist/templates/plopfiles/full-stack/plopfile.js +132 -0
- package/dist/templates/plopfiles/full-stack/templates/gitignore.hbs +44 -0
- package/dist/templates/plopfiles/full-stack/templates/package.json.hbs +21 -0
- package/dist/templates/plopfiles/presets/cli-go/module.js +43 -0
- package/dist/templates/plopfiles/presets/cli-go/templates/README.md.hbs +42 -0
- package/dist/templates/plopfiles/presets/cli-go/templates/config.json.hbs +9 -0
- package/dist/templates/plopfiles/presets/cli-node/module.js +45 -0
- package/dist/templates/plopfiles/presets/cli-node/templates/README.md.hbs +42 -0
- package/dist/templates/plopfiles/presets/cli-node/templates/config.json.hbs +9 -0
- package/dist/templates/plopfiles/presets/cli-python/module.js +43 -0
- package/dist/templates/plopfiles/presets/cli-python/templates/README.md.hbs +42 -0
- package/dist/templates/plopfiles/presets/cli-python/templates/config.json.hbs +9 -0
- package/dist/templates/plopfiles/presets/cli-rust/module.js +43 -0
- package/dist/templates/plopfiles/presets/cli-rust/templates/README.md.hbs +42 -0
- package/dist/templates/plopfiles/presets/cli-rust/templates/config.json.hbs +9 -0
- package/dist/templates/plopfiles/presets/loader.js +125 -0
- package/dist/templates/plopfiles/typescript-service/plopfile.js +186 -0
- package/dist/templates/plopfiles/typescript-service/templates/Dockerfile.hbs +29 -0
- package/dist/templates/plopfiles/typescript-service/templates/README.md.hbs +85 -0
- package/dist/templates/plopfiles/typescript-service/templates/config.ts.hbs +15 -0
- package/dist/templates/plopfiles/typescript-service/templates/db/index.ts.hbs +19 -0
- package/dist/templates/plopfiles/typescript-service/templates/db/schema.ts.hbs +16 -0
- package/dist/templates/plopfiles/typescript-service/templates/index.ts.hbs +89 -0
- package/dist/templates/plopfiles/typescript-service/templates/package.json.hbs +36 -0
- package/dist/templates/plopfiles/typescript-service/templates/routes/health.ts.hbs +61 -0
- package/dist/templates/plopfiles/typescript-service/templates/routes/index.ts.hbs +35 -0
- package/dist/templates/plopfiles/typescript-service/templates/tsconfig.json.hbs +24 -0
- package/dist/templates/plopfiles/typescript-service/templates/types.ts.hbs +28 -0
- package/dist/templates/typescript/component.module.css.tpl +6 -0
- package/dist/templates/typescript/component.test.tsx.tpl +9 -0
- package/dist/templates/typescript/component.tsx.tpl +17 -0
- package/dist/templates/typescript/component.types.ts.tpl +3 -0
- package/dist/templates/typescript/project/nextjs/app/globals.css.tpl +10 -0
- package/dist/templates/typescript/project/nextjs/app/layout.tsx.tpl +15 -0
- package/dist/templates/typescript/project/nextjs/app/page.tsx.tpl +8 -0
- package/dist/templates/typescript/project/nextjs/babel.config.js.tpl +8 -0
- package/dist/templates/typescript/project/nextjs/jest.config.js.tpl +10 -0
- package/dist/templates/typescript/project/nextjs/jest.setup.ts.tpl +6 -0
- package/dist/templates/typescript/project/nextjs/next-env.d.ts.tpl +5 -0
- package/dist/templates/typescript/project/nextjs/next.config.js.tpl +9 -0
- package/dist/templates/typescript/project/nextjs/package.json.tpl +1 -0
- package/dist/templates/typescript/project/nextjs/tsconfig.json.tpl +1 -0
- package/dist/templates/typescript/project/vite/App.css.tpl +8 -0
- package/dist/templates/typescript/project/vite/App.tsx.tpl +17 -0
- package/dist/templates/typescript/project/vite/index.css.tpl +8 -0
- package/dist/templates/typescript/project/vite/index.html.tpl +13 -0
- package/dist/templates/typescript/project/vite/main.tsx.tpl +10 -0
- package/dist/templates/typescript/project/vite/package.json.tpl +1 -0
- package/dist/templates/typescript/project/vite/test-setup.ts.tpl +1 -0
- package/dist/templates/typescript/project/vite/tsconfig.build.json.tpl +1 -0
- package/dist/templates/typescript/project/vite/tsconfig.json.tpl +1 -0
- package/dist/templates/typescript/project/vite/tsconfig.node.json.tpl +1 -0
- package/dist/templates/typescript/project/vite/vite.config.ts.tpl +18 -0
- package/dist/templates/typescript/service.api.ts.tpl +27 -0
- package/dist/templates/typescript/service.class.ts.tpl +28 -0
- package/dist/templates/typescript/service.handler.ts.tpl +42 -0
- package/dist/templates/typescript/service.schema.ts.tpl +16 -0
- package/package.json +95 -0
- package/templates/typescript/component.module.css.tpl +6 -0
- package/templates/typescript/component.test.tsx.tpl +9 -0
- package/templates/typescript/component.tsx.tpl +17 -0
- package/templates/typescript/component.types.ts.tpl +3 -0
- package/templates/typescript/project/nextjs/app/globals.css.tpl +10 -0
- package/templates/typescript/project/nextjs/app/layout.tsx.tpl +15 -0
- package/templates/typescript/project/nextjs/app/page.tsx.tpl +8 -0
- package/templates/typescript/project/nextjs/babel.config.js.tpl +8 -0
- package/templates/typescript/project/nextjs/jest.config.js.tpl +10 -0
- package/templates/typescript/project/nextjs/jest.setup.ts.tpl +6 -0
- package/templates/typescript/project/nextjs/next-env.d.ts.tpl +5 -0
- package/templates/typescript/project/nextjs/next.config.js.tpl +9 -0
- package/templates/typescript/project/nextjs/package.json.tpl +1 -0
- package/templates/typescript/project/nextjs/tsconfig.json.tpl +1 -0
- package/templates/typescript/project/vite/App.css.tpl +8 -0
- package/templates/typescript/project/vite/App.tsx.tpl +17 -0
- package/templates/typescript/project/vite/index.css.tpl +8 -0
- package/templates/typescript/project/vite/index.html.tpl +13 -0
- package/templates/typescript/project/vite/main.tsx.tpl +10 -0
- package/templates/typescript/project/vite/package.json.tpl +1 -0
- package/templates/typescript/project/vite/test-setup.ts.tpl +1 -0
- package/templates/typescript/project/vite/tsconfig.build.json.tpl +1 -0
- package/templates/typescript/project/vite/tsconfig.json.tpl +1 -0
- package/templates/typescript/project/vite/tsconfig.node.json.tpl +1 -0
- package/templates/typescript/project/vite/vite.config.ts.tpl +18 -0
- package/templates/typescript/service.api.ts.tpl +27 -0
- package/templates/typescript/service.class.ts.tpl +28 -0
- package/templates/typescript/service.handler.ts.tpl +42 -0
- package/templates/typescript/service.schema.ts.tpl +16 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
use axum::{routing::get, Json, Router};
|
|
2
|
+
use serde::Serialize;
|
|
3
|
+
|
|
4
|
+
#[derive(Serialize)]
|
|
5
|
+
struct HealthResponse {
|
|
6
|
+
status: String,
|
|
7
|
+
service: String,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
#[derive(Serialize)]
|
|
11
|
+
struct ReadyResponse {
|
|
12
|
+
ready: bool,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#[derive(Serialize)]
|
|
16
|
+
struct LiveResponse {
|
|
17
|
+
alive: bool,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
pub fn router() -> Router {
|
|
21
|
+
Router::new()
|
|
22
|
+
.route("/", get(health_check))
|
|
23
|
+
.route("/ready", get(readiness_check))
|
|
24
|
+
.route("/live", get(liveness_check))
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async fn health_check() -> Json<HealthResponse> {
|
|
28
|
+
Json(HealthResponse {
|
|
29
|
+
status: "ok".to_string(),
|
|
30
|
+
service: "{{kebabCase name}}-backend".to_string(),
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async fn readiness_check() -> Json<ReadyResponse> {
|
|
35
|
+
// Add database/service checks here
|
|
36
|
+
Json(ReadyResponse { ready: true })
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async fn liveness_check() -> Json<LiveResponse> {
|
|
40
|
+
Json(LiveResponse { alive: true })
|
|
41
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
use axum::{
|
|
2
|
+
routing::get,
|
|
3
|
+
Router,
|
|
4
|
+
Json,
|
|
5
|
+
};
|
|
6
|
+
use serde::Serialize;
|
|
7
|
+
use std::net::SocketAddr;
|
|
8
|
+
use tower_http::cors::{CorsLayer, Any};
|
|
9
|
+
use tower_http::trace::TraceLayer;
|
|
10
|
+
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
|
11
|
+
|
|
12
|
+
mod health;
|
|
13
|
+
|
|
14
|
+
#[derive(Serialize)]
|
|
15
|
+
struct Message {
|
|
16
|
+
message: String,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#[tokio::main]
|
|
20
|
+
async fn main() {
|
|
21
|
+
// Load .env file
|
|
22
|
+
dotenvy::dotenv().ok();
|
|
23
|
+
|
|
24
|
+
// Initialize tracing
|
|
25
|
+
tracing_subscriber::registry()
|
|
26
|
+
.with(
|
|
27
|
+
tracing_subscriber::EnvFilter::try_from_default_env()
|
|
28
|
+
.unwrap_or_else(|_| "info,{{snakeCase name}}=debug".into()),
|
|
29
|
+
)
|
|
30
|
+
.with(tracing_subscriber::fmt::layer())
|
|
31
|
+
.init();
|
|
32
|
+
|
|
33
|
+
// Build router
|
|
34
|
+
let app = Router::new()
|
|
35
|
+
.route("/", get(root))
|
|
36
|
+
.nest("/health", health::router())
|
|
37
|
+
.layer(CorsLayer::new().allow_origin(Any).allow_methods(Any).allow_headers(Any))
|
|
38
|
+
.layer(TraceLayer::new_for_http());
|
|
39
|
+
|
|
40
|
+
// Get port from environment
|
|
41
|
+
let port: u16 = std::env::var("PORT")
|
|
42
|
+
.unwrap_or_else(|_| "3000".to_string())
|
|
43
|
+
.parse()
|
|
44
|
+
.expect("PORT must be a number");
|
|
45
|
+
|
|
46
|
+
let addr = SocketAddr::from(([0, 0, 0, 0], port));
|
|
47
|
+
tracing::info!("{{titleCase name}} listening on {}", addr);
|
|
48
|
+
|
|
49
|
+
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
|
|
50
|
+
axum::serve(listener, app).await.unwrap();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async fn root() -> Json<Message> {
|
|
54
|
+
Json(Message {
|
|
55
|
+
message: "Welcome to {{titleCase name}} API".to_string(),
|
|
56
|
+
})
|
|
57
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AWS Cloud Module
|
|
3
|
+
*
|
|
4
|
+
* Provides AWS-specific configuration and Terraform resources.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { dirname, resolve } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const templatesDir = resolve(__dirname, "templates");
|
|
12
|
+
|
|
13
|
+
export default function (data) {
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
type: "addMany",
|
|
17
|
+
destination: "{{projectDir}}/infra/terraform",
|
|
18
|
+
base: templatesDir,
|
|
19
|
+
templateFiles: `${templatesDir}/**/*.hbs`,
|
|
20
|
+
stripExtensions: ["hbs"],
|
|
21
|
+
data,
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const description = "AWS cloud resources (ECS, RDS, S3, etc.)";
|
|
27
|
+
|
|
28
|
+
export const envVars = {
|
|
29
|
+
AWS_REGION: "us-east-1",
|
|
30
|
+
AWS_PROFILE: "default",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const requires = ["infra/terraform"];
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Application Load Balancer
|
|
2
|
+
resource "aws_lb" "main" {
|
|
3
|
+
name = "${local.project_name}-alb"
|
|
4
|
+
internal = false
|
|
5
|
+
load_balancer_type = "application"
|
|
6
|
+
security_groups = [aws_security_group.alb.id]
|
|
7
|
+
subnets = aws_subnet.public[*].id
|
|
8
|
+
|
|
9
|
+
enable_deletion_protection = var.environment == "prod"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
resource "aws_lb_target_group" "app" {
|
|
13
|
+
name = "${local.project_name}-tg"
|
|
14
|
+
port = var.app_port
|
|
15
|
+
protocol = "HTTP"
|
|
16
|
+
vpc_id = aws_vpc.main.id
|
|
17
|
+
target_type = "ip"
|
|
18
|
+
|
|
19
|
+
health_check {
|
|
20
|
+
path = "/health"
|
|
21
|
+
healthy_threshold = 2
|
|
22
|
+
unhealthy_threshold = 10
|
|
23
|
+
timeout = 60
|
|
24
|
+
interval = 300
|
|
25
|
+
matcher = "200"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
resource "aws_lb_listener" "app" {
|
|
30
|
+
load_balancer_arn = aws_lb.main.arn
|
|
31
|
+
port = "80"
|
|
32
|
+
protocol = "HTTP"
|
|
33
|
+
|
|
34
|
+
default_action {
|
|
35
|
+
type = "forward"
|
|
36
|
+
target_group_arn = aws_lb_target_group.app.arn
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# Security Groups
|
|
41
|
+
resource "aws_security_group" "alb" {
|
|
42
|
+
name = "${local.project_name}-alb-sg"
|
|
43
|
+
description = "ALB Security Group"
|
|
44
|
+
vpc_id = aws_vpc.main.id
|
|
45
|
+
|
|
46
|
+
ingress {
|
|
47
|
+
from_port = 80
|
|
48
|
+
to_port = 80
|
|
49
|
+
protocol = "tcp"
|
|
50
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
ingress {
|
|
54
|
+
from_port = 443
|
|
55
|
+
to_port = 443
|
|
56
|
+
protocol = "tcp"
|
|
57
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
egress {
|
|
61
|
+
from_port = 0
|
|
62
|
+
to_port = 0
|
|
63
|
+
protocol = "-1"
|
|
64
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
resource "aws_security_group" "app" {
|
|
69
|
+
name = "${local.project_name}-app-sg"
|
|
70
|
+
description = "Application Security Group"
|
|
71
|
+
vpc_id = aws_vpc.main.id
|
|
72
|
+
|
|
73
|
+
ingress {
|
|
74
|
+
from_port = var.app_port
|
|
75
|
+
to_port = var.app_port
|
|
76
|
+
protocol = "tcp"
|
|
77
|
+
security_groups = [aws_security_group.alb.id]
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
egress {
|
|
81
|
+
from_port = 0
|
|
82
|
+
to_port = 0
|
|
83
|
+
protocol = "-1"
|
|
84
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# Outputs
|
|
89
|
+
output "alb_dns_name" {
|
|
90
|
+
description = "ALB DNS name"
|
|
91
|
+
value = aws_lb.main.dns_name
|
|
92
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# ECS Cluster for containerized applications
|
|
2
|
+
resource "aws_ecs_cluster" "main" {
|
|
3
|
+
name = "${local.project_name}-${var.environment}"
|
|
4
|
+
|
|
5
|
+
setting {
|
|
6
|
+
name = "containerInsights"
|
|
7
|
+
value = "enabled"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
# ECS Task Definition
|
|
12
|
+
resource "aws_ecs_task_definition" "app" {
|
|
13
|
+
family = "${local.project_name}-${var.environment}"
|
|
14
|
+
network_mode = "awsvpc"
|
|
15
|
+
requires_compatibilities = ["FARGATE"]
|
|
16
|
+
cpu = 256
|
|
17
|
+
memory = 512
|
|
18
|
+
execution_role_arn = aws_iam_role.ecs_execution.arn
|
|
19
|
+
task_role_arn = aws_iam_role.ecs_task.arn
|
|
20
|
+
|
|
21
|
+
container_definitions = jsonencode([
|
|
22
|
+
{
|
|
23
|
+
name = local.project_name
|
|
24
|
+
image = "${aws_ecr_repository.app.repository_url}:latest"
|
|
25
|
+
portMappings = [
|
|
26
|
+
{
|
|
27
|
+
containerPort = var.app_port
|
|
28
|
+
protocol = "tcp"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
environment = [
|
|
32
|
+
{ name = "NODE_ENV", value = var.environment },
|
|
33
|
+
{ name = "PORT", value = tostring(var.app_port) }
|
|
34
|
+
]
|
|
35
|
+
logConfiguration = {
|
|
36
|
+
logDriver = "awslogs"
|
|
37
|
+
options = {
|
|
38
|
+
awslogs-group = aws_cloudwatch_log_group.app.name
|
|
39
|
+
awslogs-region = var.aws_region
|
|
40
|
+
awslogs-stream-prefix = "ecs"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
])
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# ECS Service
|
|
48
|
+
resource "aws_ecs_service" "app" {
|
|
49
|
+
name = local.project_name
|
|
50
|
+
cluster = aws_ecs_cluster.main.id
|
|
51
|
+
task_definition = aws_ecs_task_definition.app.arn
|
|
52
|
+
desired_count = var.instance_count
|
|
53
|
+
launch_type = "FARGATE"
|
|
54
|
+
|
|
55
|
+
network_configuration {
|
|
56
|
+
subnets = aws_subnet.private[*].id
|
|
57
|
+
security_groups = [aws_security_group.app.id]
|
|
58
|
+
assign_public_ip = false
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
load_balancer {
|
|
62
|
+
target_group_arn = aws_lb_target_group.app.arn
|
|
63
|
+
container_name = local.project_name
|
|
64
|
+
container_port = var.app_port
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
depends_on = [aws_lb_listener.app]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
# ECR Repository
|
|
71
|
+
resource "aws_ecr_repository" "app" {
|
|
72
|
+
name = local.project_name
|
|
73
|
+
image_tag_mutability = "MUTABLE"
|
|
74
|
+
|
|
75
|
+
image_scanning_configuration {
|
|
76
|
+
scan_on_push = true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
# CloudWatch Log Group
|
|
81
|
+
resource "aws_cloudwatch_log_group" "app" {
|
|
82
|
+
name = "/ecs/${local.project_name}-${var.environment}"
|
|
83
|
+
retention_in_days = 30
|
|
84
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# ECS Execution Role
|
|
2
|
+
resource "aws_iam_role" "ecs_execution" {
|
|
3
|
+
name = "${local.project_name}-ecs-execution-role"
|
|
4
|
+
|
|
5
|
+
assume_role_policy = jsonencode({
|
|
6
|
+
Version = "2012-10-17"
|
|
7
|
+
Statement = [
|
|
8
|
+
{
|
|
9
|
+
Action = "sts:AssumeRole"
|
|
10
|
+
Effect = "Allow"
|
|
11
|
+
Principal = {
|
|
12
|
+
Service = "ecs-tasks.amazonaws.com"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
resource "aws_iam_role_policy_attachment" "ecs_execution" {
|
|
20
|
+
role = aws_iam_role.ecs_execution.name
|
|
21
|
+
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
# ECS Task Role
|
|
25
|
+
resource "aws_iam_role" "ecs_task" {
|
|
26
|
+
name = "${local.project_name}-ecs-task-role"
|
|
27
|
+
|
|
28
|
+
assume_role_policy = jsonencode({
|
|
29
|
+
Version = "2012-10-17"
|
|
30
|
+
Statement = [
|
|
31
|
+
{
|
|
32
|
+
Action = "sts:AssumeRole"
|
|
33
|
+
Effect = "Allow"
|
|
34
|
+
Principal = {
|
|
35
|
+
Service = "ecs-tasks.amazonaws.com"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# Add additional policies as needed
|
|
43
|
+
# resource "aws_iam_role_policy" "ecs_task_s3" {
|
|
44
|
+
# name = "${local.project_name}-s3-access"
|
|
45
|
+
# role = aws_iam_role.ecs_task.id
|
|
46
|
+
#
|
|
47
|
+
# policy = jsonencode({
|
|
48
|
+
# Version = "2012-10-17"
|
|
49
|
+
# Statement = [
|
|
50
|
+
# {
|
|
51
|
+
# Effect = "Allow"
|
|
52
|
+
# Action = [
|
|
53
|
+
# "s3:GetObject",
|
|
54
|
+
# "s3:PutObject"
|
|
55
|
+
# ]
|
|
56
|
+
# Resource = "${aws_s3_bucket.app.arn}/*"
|
|
57
|
+
# }
|
|
58
|
+
# ]
|
|
59
|
+
# })
|
|
60
|
+
# }
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# VPC Configuration
|
|
2
|
+
resource "aws_vpc" "main" {
|
|
3
|
+
cidr_block = "10.0.0.0/16"
|
|
4
|
+
enable_dns_hostnames = true
|
|
5
|
+
enable_dns_support = true
|
|
6
|
+
|
|
7
|
+
tags = {
|
|
8
|
+
Name = "${local.project_name}-vpc"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
# Public Subnets
|
|
13
|
+
resource "aws_subnet" "public" {
|
|
14
|
+
count = 2
|
|
15
|
+
vpc_id = aws_vpc.main.id
|
|
16
|
+
cidr_block = "10.0.${count.index + 1}.0/24"
|
|
17
|
+
availability_zone = data.aws_availability_zones.available.names[count.index]
|
|
18
|
+
map_public_ip_on_launch = true
|
|
19
|
+
|
|
20
|
+
tags = {
|
|
21
|
+
Name = "${local.project_name}-public-${count.index + 1}"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
# Private Subnets
|
|
26
|
+
resource "aws_subnet" "private" {
|
|
27
|
+
count = 2
|
|
28
|
+
vpc_id = aws_vpc.main.id
|
|
29
|
+
cidr_block = "10.0.${count.index + 10}.0/24"
|
|
30
|
+
availability_zone = data.aws_availability_zones.available.names[count.index]
|
|
31
|
+
|
|
32
|
+
tags = {
|
|
33
|
+
Name = "${local.project_name}-private-${count.index + 1}"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# Internet Gateway
|
|
38
|
+
resource "aws_internet_gateway" "main" {
|
|
39
|
+
vpc_id = aws_vpc.main.id
|
|
40
|
+
|
|
41
|
+
tags = {
|
|
42
|
+
Name = "${local.project_name}-igw"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# NAT Gateway
|
|
47
|
+
resource "aws_eip" "nat" {
|
|
48
|
+
domain = "vpc"
|
|
49
|
+
|
|
50
|
+
tags = {
|
|
51
|
+
Name = "${local.project_name}-nat-eip"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
resource "aws_nat_gateway" "main" {
|
|
56
|
+
allocation_id = aws_eip.nat.id
|
|
57
|
+
subnet_id = aws_subnet.public[0].id
|
|
58
|
+
|
|
59
|
+
tags = {
|
|
60
|
+
Name = "${local.project_name}-nat"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Route Tables
|
|
65
|
+
resource "aws_route_table" "public" {
|
|
66
|
+
vpc_id = aws_vpc.main.id
|
|
67
|
+
|
|
68
|
+
route {
|
|
69
|
+
cidr_block = "0.0.0.0/0"
|
|
70
|
+
gateway_id = aws_internet_gateway.main.id
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
tags = {
|
|
74
|
+
Name = "${local.project_name}-public-rt"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
resource "aws_route_table" "private" {
|
|
79
|
+
vpc_id = aws_vpc.main.id
|
|
80
|
+
|
|
81
|
+
route {
|
|
82
|
+
cidr_block = "0.0.0.0/0"
|
|
83
|
+
nat_gateway_id = aws_nat_gateway.main.id
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
tags = {
|
|
87
|
+
Name = "${local.project_name}-private-rt"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
resource "aws_route_table_association" "public" {
|
|
92
|
+
count = length(aws_subnet.public)
|
|
93
|
+
subnet_id = aws_subnet.public[count.index].id
|
|
94
|
+
route_table_id = aws_route_table.public.id
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
resource "aws_route_table_association" "private" {
|
|
98
|
+
count = length(aws_subnet.private)
|
|
99
|
+
subnet_id = aws_subnet.private[count.index].id
|
|
100
|
+
route_table_id = aws_route_table.private.id
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
# Data Sources
|
|
104
|
+
data "aws_availability_zones" "available" {
|
|
105
|
+
state = "available"
|
|
106
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# AWS Provider Configuration
|
|
2
|
+
terraform {
|
|
3
|
+
required_providers {
|
|
4
|
+
aws = {
|
|
5
|
+
source = "hashicorp/aws"
|
|
6
|
+
version = "~> 5.0"
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
provider "aws" {
|
|
12
|
+
region = var.aws_region
|
|
13
|
+
|
|
14
|
+
default_tags {
|
|
15
|
+
tags = local.common_tags
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
variable "aws_region" {
|
|
20
|
+
description = "AWS region"
|
|
21
|
+
type = string
|
|
22
|
+
default = "us-east-1"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
variable "environment" {
|
|
26
|
+
description = "Environment name (e.g., dev, staging, prod)"
|
|
27
|
+
type = string
|
|
28
|
+
default = "dev"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
variable "app_port" {
|
|
32
|
+
description = "Application port"
|
|
33
|
+
type = number
|
|
34
|
+
default = 3000
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
variable "instance_count" {
|
|
38
|
+
description = "Number of instances to run"
|
|
39
|
+
type = number
|
|
40
|
+
default = 1
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
variable "container_image" {
|
|
44
|
+
description = "Container image to deploy"
|
|
45
|
+
type = string
|
|
46
|
+
default = ""
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
locals {
|
|
50
|
+
project_name = "{{kebabCase name}}"
|
|
51
|
+
common_tags = {
|
|
52
|
+
Project = local.project_name
|
|
53
|
+
Environment = var.environment
|
|
54
|
+
ManagedBy = "terraform"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Azure Cloud Module
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { dirname, resolve } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const templatesDir = resolve(__dirname, "templates");
|
|
10
|
+
|
|
11
|
+
export default function (data) {
|
|
12
|
+
return [
|
|
13
|
+
{
|
|
14
|
+
type: "addMany",
|
|
15
|
+
destination: "{{projectDir}}/infra/terraform",
|
|
16
|
+
base: templatesDir,
|
|
17
|
+
templateFiles: `${templatesDir}/**/*.hbs`,
|
|
18
|
+
stripExtensions: ["hbs"],
|
|
19
|
+
data,
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const description = "Azure cloud resources (Container Apps, SQL, Storage, etc.)";
|
|
25
|
+
|
|
26
|
+
export const envVars = {
|
|
27
|
+
ARM_SUBSCRIPTION_ID: "your-subscription-id",
|
|
28
|
+
AZURE_REGION: "eastus",
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const requires = ["infra/terraform"];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Container Apps Environment
|
|
2
|
+
resource "azurerm_container_app_environment" "main" {
|
|
3
|
+
name = "${local.project_name}-env"
|
|
4
|
+
location = azurerm_resource_group.main.location
|
|
5
|
+
resource_group_name = azurerm_resource_group.main.name
|
|
6
|
+
|
|
7
|
+
log_analytics_workspace_id = azurerm_log_analytics_workspace.main.id
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
# Container App
|
|
11
|
+
resource "azurerm_container_app" "app" {
|
|
12
|
+
name = local.project_name
|
|
13
|
+
container_app_environment_id = azurerm_container_app_environment.main.id
|
|
14
|
+
resource_group_name = azurerm_resource_group.main.name
|
|
15
|
+
revision_mode = "Single"
|
|
16
|
+
|
|
17
|
+
template {
|
|
18
|
+
container {
|
|
19
|
+
name = local.project_name
|
|
20
|
+
image = "${azurerm_container_registry.main.login_server}/${local.project_name}:latest"
|
|
21
|
+
cpu = 0.25
|
|
22
|
+
memory = "0.5Gi"
|
|
23
|
+
|
|
24
|
+
env {
|
|
25
|
+
name = "NODE_ENV"
|
|
26
|
+
value = var.environment
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
env {
|
|
30
|
+
name = "PORT"
|
|
31
|
+
value = tostring(var.app_port)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
liveness_probe {
|
|
35
|
+
transport = "HTTP"
|
|
36
|
+
path = "/health/live"
|
|
37
|
+
port = var.app_port
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
readiness_probe {
|
|
41
|
+
transport = "HTTP"
|
|
42
|
+
path = "/health/ready"
|
|
43
|
+
port = var.app_port
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
min_replicas = var.environment == "prod" ? 1 : 0
|
|
48
|
+
max_replicas = var.environment == "prod" ? 10 : 2
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
ingress {
|
|
52
|
+
external_enabled = true
|
|
53
|
+
target_port = var.app_port
|
|
54
|
+
traffic_weight {
|
|
55
|
+
percentage = 100
|
|
56
|
+
latest_revision = true
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
registry {
|
|
61
|
+
server = azurerm_container_registry.main.login_server
|
|
62
|
+
username = azurerm_container_registry.main.admin_username
|
|
63
|
+
password_secret_name = "registry-password"
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
secret {
|
|
67
|
+
name = "registry-password"
|
|
68
|
+
value = azurerm_container_registry.main.admin_password
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# Container Registry
|
|
73
|
+
resource "azurerm_container_registry" "main" {
|
|
74
|
+
name = replace("${local.project_name}${var.environment}acr", "-", "")
|
|
75
|
+
resource_group_name = azurerm_resource_group.main.name
|
|
76
|
+
location = azurerm_resource_group.main.location
|
|
77
|
+
sku = "Basic"
|
|
78
|
+
admin_enabled = true
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# Log Analytics
|
|
82
|
+
resource "azurerm_log_analytics_workspace" "main" {
|
|
83
|
+
name = "${local.project_name}-logs"
|
|
84
|
+
location = azurerm_resource_group.main.location
|
|
85
|
+
resource_group_name = azurerm_resource_group.main.name
|
|
86
|
+
sku = "PerGB2018"
|
|
87
|
+
retention_in_days = 30
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
# Outputs
|
|
91
|
+
output "container_app_url" {
|
|
92
|
+
description = "Container App URL"
|
|
93
|
+
value = azurerm_container_app.app.latest_revision_fqdn
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
output "container_registry" {
|
|
97
|
+
description = "Container Registry login server"
|
|
98
|
+
value = azurerm_container_registry.main.login_server
|
|
99
|
+
}
|