@phila/cli 0.0.1
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/dist/commands/config.d.ts +30 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +135 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/deploy.d.ts +2 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +224 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/destroy.d.ts +3 -0
- package/dist/commands/destroy.d.ts.map +1 -0
- package/dist/commands/destroy.js +110 -0
- package/dist/commands/destroy.js.map +1 -0
- package/dist/commands/init.d.ts +25 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +513 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/map.d.ts +8 -0
- package/dist/commands/map.d.ts.map +1 -0
- package/dist/commands/map.js +186 -0
- package/dist/commands/map.js.map +1 -0
- package/dist/commands/ship.d.ts +20 -0
- package/dist/commands/ship.d.ts.map +1 -0
- package/dist/commands/ship.js +445 -0
- package/dist/commands/ship.js.map +1 -0
- package/dist/commands/templates.d.ts +3 -0
- package/dist/commands/templates.d.ts.map +1 -0
- package/dist/commands/templates.js +120 -0
- package/dist/commands/templates.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/_shared/city.config.json.tmpl +24 -0
- package/dist/templates/_shared/dotnet-api/Api.csproj +17 -0
- package/dist/templates/_shared/dotnet-api/Program.cs +58 -0
- package/dist/templates/_shared/dotnet-api/aws-lambda-tools-defaults.json +10 -0
- package/dist/templates/_shared/dotnet-api/obj/Api.csproj.nuget.dgspec.json +80 -0
- package/dist/templates/_shared/dotnet-api/obj/Api.csproj.nuget.g.props +15 -0
- package/dist/templates/_shared/dotnet-api/obj/Api.csproj.nuget.g.targets +2 -0
- package/dist/templates/_shared/dotnet-api/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +4 -0
- package/dist/templates/_shared/dotnet-api/obj/Debug/net8.0/Api.AssemblyInfo.cs +22 -0
- package/dist/templates/_shared/dotnet-api/obj/Debug/net8.0/Api.AssemblyInfoInputs.cache +1 -0
- package/dist/templates/_shared/dotnet-api/obj/Debug/net8.0/Api.GeneratedMSBuildEditorConfig.editorconfig +19 -0
- package/dist/templates/_shared/dotnet-api/obj/Debug/net8.0/Api.GlobalUsings.g.cs +17 -0
- package/dist/templates/_shared/dotnet-api/obj/Debug/net8.0/Api.assets.cache +0 -0
- package/dist/templates/_shared/dotnet-api/obj/Debug/net8.0/Api.csproj.AssemblyReference.cache +0 -0
- package/dist/templates/_shared/dotnet-api/obj/project.assets.json +708 -0
- package/dist/templates/_shared/dotnet-api/obj/project.nuget.cache +35 -0
- package/dist/templates/_shared/dotnet-api-postgres/Api.csproj +19 -0
- package/dist/templates/_shared/dotnet-api-postgres/Program.cs +167 -0
- package/dist/templates/_shared/dotnet-api-postgres/aws-lambda-tools-defaults.json +10 -0
- package/dist/templates/_shared/dotnet-api-postgres/obj/Api.csproj.nuget.dgspec.json +88 -0
- package/dist/templates/_shared/dotnet-api-postgres/obj/Api.csproj.nuget.g.props +15 -0
- package/dist/templates/_shared/dotnet-api-postgres/obj/Api.csproj.nuget.g.targets +2 -0
- package/dist/templates/_shared/dotnet-api-postgres/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +4 -0
- package/dist/templates/_shared/dotnet-api-postgres/obj/Debug/net8.0/Api.AssemblyInfo.cs +22 -0
- package/dist/templates/_shared/dotnet-api-postgres/obj/Debug/net8.0/Api.AssemblyInfoInputs.cache +1 -0
- package/dist/templates/_shared/dotnet-api-postgres/obj/Debug/net8.0/Api.GeneratedMSBuildEditorConfig.editorconfig +19 -0
- package/dist/templates/_shared/dotnet-api-postgres/obj/Debug/net8.0/Api.GlobalUsings.g.cs +17 -0
- package/dist/templates/_shared/dotnet-api-postgres/obj/Debug/net8.0/Api.assets.cache +0 -0
- package/dist/templates/_shared/dotnet-api-postgres/obj/project.assets.json +106 -0
- package/dist/templates/_shared/dotnet-api-postgres/obj/project.nuget.cache +15 -0
- package/dist/templates/_shared/nuxt-frontend/app.vue +3 -0
- package/dist/templates/_shared/nuxt-frontend/nuxt.config.ts +25 -0
- package/dist/templates/_shared/nuxt-frontend/package.json.tmpl +19 -0
- package/dist/templates/_shared/nuxt-frontend/pages/index.vue +6 -0
- package/dist/templates/_shared/nuxt-frontend/public/.gitkeep +0 -0
- package/dist/templates/_shared/nuxt-frontend/tsconfig.json +3 -0
- package/dist/templates/_shared/webapp-cdk-package.json.tmpl +23 -0
- package/dist/templates/_shared/webapp-frontend/app.vue +3 -0
- package/dist/templates/_shared/webapp-frontend/nuxt.config.ts +25 -0
- package/dist/templates/_shared/webapp-frontend/package.json.tmpl +19 -0
- package/dist/templates/_shared/webapp-frontend/pages/index.vue +7 -0
- package/dist/templates/_shared/webapp-frontend/public/.gitkeep +0 -0
- package/dist/templates/_shared/webapp-frontend/tsconfig.json +3 -0
- package/dist/templates/lambda-api-nodejs/README.md.tmpl +203 -0
- package/dist/templates/lambda-api-nodejs/apps/__lambdaName__/index.ts +89 -0
- package/dist/templates/lambda-api-nodejs/apps/__lambdaName__/package.json +17 -0
- package/dist/templates/lambda-api-nodejs/apps/__lambdaName__/tsconfig.json +8 -0
- package/dist/templates/lambda-api-nodejs/cdk/app.ts.tmpl +53 -0
- package/dist/templates/lambda-api-nodejs/cdk/cdk.json +68 -0
- package/dist/templates/lambda-api-nodejs/cdk/package.json +23 -0
- package/dist/templates/lambda-api-nodejs/cdk/tsconfig.json +9 -0
- package/dist/templates/lambda-api-nodejs/package.json.tmpl +20 -0
- package/dist/templates/lambda-api-nodejs/tsconfig.json +27 -0
- package/dist/templates/lambda-dynamo-api/README.md.tmpl +184 -0
- package/dist/templates/lambda-dynamo-api/apps/__lambdaName__/index.ts +109 -0
- package/dist/templates/lambda-dynamo-api/apps/__lambdaName__/package.json +19 -0
- package/dist/templates/lambda-dynamo-api/apps/__lambdaName__/tsconfig.json +24 -0
- package/dist/templates/lambda-dynamo-api/cdk/app.ts.tmpl +59 -0
- package/dist/templates/lambda-dynamo-api/cdk/cdk.json +73 -0
- package/dist/templates/lambda-dynamo-api/cdk/package.json +23 -0
- package/dist/templates/lambda-dynamo-api/cdk/tsconfig.json +14 -0
- package/dist/templates/lambda-dynamo-api/package.json.tmpl +20 -0
- package/dist/templates/lambda-dynamo-api/tsconfig.json +27 -0
- package/dist/templates/lambda-postgres-api/README.md.tmpl +234 -0
- package/dist/templates/lambda-postgres-api/apps/__lambdaName__/index.ts +76 -0
- package/dist/templates/lambda-postgres-api/apps/__lambdaName__/package.json +18 -0
- package/dist/templates/lambda-postgres-api/apps/__lambdaName__/tsconfig.json +26 -0
- package/dist/templates/lambda-postgres-api/cdk/app.ts.tmpl +55 -0
- package/dist/templates/lambda-postgres-api/cdk/cdk.json +4 -0
- package/dist/templates/lambda-postgres-api/cdk/package.json +23 -0
- package/dist/templates/lambda-postgres-api/cdk/tsconfig.json +25 -0
- package/dist/templates/lambda-postgres-api/package.json.tmpl +20 -0
- package/dist/templates/lambda-postgres-api/tsconfig.json +11 -0
- package/dist/templates/static-site/README.md.tmpl +72 -0
- package/dist/templates/static-site/cdk/app.ts.tmpl +50 -0
- package/dist/templates/static-site/cdk/cdk.json +68 -0
- package/dist/templates/static-site/cdk/package.json +23 -0
- package/dist/templates/static-site/cdk/tsconfig.json +9 -0
- package/dist/templates/static-site/frontend/.gitkeep +0 -0
- package/dist/templates/static-site/frontend/README.md +41 -0
- package/dist/templates/static-site/frontend/package.json +9 -0
- package/dist/templates/static-site/package.json.tmpl +19 -0
- package/dist/templates/static-site/tsconfig.json +27 -0
- package/dist/templates/webapp-ecs-dotnet/README.md.tmpl +213 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/Api.csproj +12 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/Dockerfile +30 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/Program.cs +85 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/obj/Api.csproj.nuget.dgspec.json +70 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/obj/Api.csproj.nuget.g.props +15 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/obj/Api.csproj.nuget.g.targets +2 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +4 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/obj/Debug/net8.0/Api.AssemblyInfo.cs +22 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/obj/Debug/net8.0/Api.AssemblyInfoInputs.cache +1 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/obj/Debug/net8.0/Api.GeneratedMSBuildEditorConfig.editorconfig +19 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/obj/Debug/net8.0/Api.GlobalUsings.g.cs +17 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/obj/Debug/net8.0/Api.assets.cache +0 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/obj/project.assets.json +75 -0
- package/dist/templates/webapp-ecs-dotnet/apps/api/obj/project.nuget.cache +8 -0
- package/dist/templates/webapp-ecs-dotnet/cdk/app.ts.tmpl +60 -0
- package/dist/templates/webapp-ecs-dotnet/cdk/cdk.json +38 -0
- package/dist/templates/webapp-ecs-dotnet/cdk/tsconfig.json +25 -0
- package/dist/templates/webapp-ecs-dotnet/package.json.tmpl +23 -0
- package/dist/templates/webapp-ecs-dotnet/tsconfig.json +26 -0
- package/dist/templates/webapp-ecs-node/README.md.tmpl +207 -0
- package/dist/templates/webapp-ecs-node/apps/api/Dockerfile +33 -0
- package/dist/templates/webapp-ecs-node/apps/api/index.ts +74 -0
- package/dist/templates/webapp-ecs-node/apps/api/package.json +22 -0
- package/dist/templates/webapp-ecs-node/apps/api/tsconfig.json +18 -0
- package/dist/templates/webapp-ecs-node/cdk/app.ts.tmpl +60 -0
- package/dist/templates/webapp-ecs-node/cdk/cdk.json +38 -0
- package/dist/templates/webapp-ecs-node/cdk/tsconfig.json +25 -0
- package/dist/templates/webapp-ecs-node/package.json.tmpl +25 -0
- package/dist/templates/webapp-ecs-node/tsconfig.json +26 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/README.md.tmpl +271 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/Api.csproj +17 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/Dockerfile +30 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/Program.cs +194 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/obj/Api.csproj.nuget.dgspec.json +80 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/obj/Api.csproj.nuget.g.props +19 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/obj/Api.csproj.nuget.g.targets +6 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +4 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/obj/Debug/net8.0/Api.AssemblyInfo.cs +22 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/obj/Debug/net8.0/Api.AssemblyInfoInputs.cache +1 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/obj/Debug/net8.0/Api.GeneratedMSBuildEditorConfig.editorconfig +19 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/obj/Debug/net8.0/Api.GlobalUsings.g.cs +17 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/obj/Debug/net8.0/Api.assets.cache +0 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/obj/Debug/net8.0/Api.csproj.AssemblyReference.cache +0 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/obj/project.assets.json +395 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/apps/api/obj/project.nuget.cache +49 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/cdk/app.ts.tmpl +62 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/cdk/cdk.json +38 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/cdk/tsconfig.json +25 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/package.json.tmpl +23 -0
- package/dist/templates/webapp-ecs-postgres-dotnet/tsconfig.json +26 -0
- package/dist/templates/webapp-ecs-postgres-node/README.md.tmpl +261 -0
- package/dist/templates/webapp-ecs-postgres-node/apps/api/Dockerfile +33 -0
- package/dist/templates/webapp-ecs-postgres-node/apps/api/index.ts +160 -0
- package/dist/templates/webapp-ecs-postgres-node/apps/api/package.json +25 -0
- package/dist/templates/webapp-ecs-postgres-node/apps/api/tsconfig.json +18 -0
- package/dist/templates/webapp-ecs-postgres-node/cdk/app.ts.tmpl +62 -0
- package/dist/templates/webapp-ecs-postgres-node/cdk/cdk.json +38 -0
- package/dist/templates/webapp-ecs-postgres-node/cdk/tsconfig.json +25 -0
- package/dist/templates/webapp-ecs-postgres-node/package.json.tmpl +25 -0
- package/dist/templates/webapp-ecs-postgres-node/tsconfig.json +26 -0
- package/dist/templates/webapp-lambda-dotnet/README.md.tmpl +188 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/Api.csproj +17 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/Program.cs +58 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/aws-lambda-tools-defaults.json +10 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/obj/Api.csproj.nuget.dgspec.json +80 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/obj/Api.csproj.nuget.g.props +15 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/obj/Api.csproj.nuget.g.targets +2 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +4 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/obj/Debug/net8.0/Api.AssemblyInfo.cs +22 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/obj/Debug/net8.0/Api.AssemblyInfoInputs.cache +1 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/obj/Debug/net8.0/Api.GeneratedMSBuildEditorConfig.editorconfig +19 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/obj/Debug/net8.0/Api.GlobalUsings.g.cs +17 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/obj/Debug/net8.0/Api.assets.cache +0 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/obj/Debug/net8.0/Api.csproj.AssemblyReference.cache +0 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/obj/project.assets.json +708 -0
- package/dist/templates/webapp-lambda-dotnet/apps/api/obj/project.nuget.cache +35 -0
- package/dist/templates/webapp-lambda-dotnet/cdk/app.ts.tmpl +59 -0
- package/dist/templates/webapp-lambda-dotnet/cdk/cdk.json +68 -0
- package/dist/templates/webapp-lambda-dotnet/cdk/tsconfig.json +9 -0
- package/dist/templates/webapp-lambda-dotnet/package.json.tmpl +23 -0
- package/dist/templates/webapp-lambda-dotnet/tsconfig.json +27 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/README.md.tmpl +223 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/Api.csproj +18 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/Program.cs +155 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/aws-lambda-tools-defaults.json +10 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/obj/Api.csproj.nuget.dgspec.json +84 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/obj/Api.csproj.nuget.g.props +19 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/obj/Api.csproj.nuget.g.targets +2 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +4 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/obj/Debug/net8.0/Api.AssemblyInfo.cs +22 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/obj/Debug/net8.0/Api.AssemblyInfoInputs.cache +1 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/obj/Debug/net8.0/Api.GeneratedMSBuildEditorConfig.editorconfig +19 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/obj/Debug/net8.0/Api.GlobalUsings.g.cs +17 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/obj/Debug/net8.0/Api.assets.cache +0 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/obj/Debug/net8.0/Api.csproj.AssemblyReference.cache +0 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/obj/project.assets.json +989 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/apps/api/obj/project.nuget.cache +223 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/cdk/app.ts.tmpl +65 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/cdk/cdk.json +68 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/cdk/tsconfig.json +9 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/package.json.tmpl +23 -0
- package/dist/templates/webapp-lambda-dynamo-dotnet/tsconfig.json +27 -0
- package/dist/templates/webapp-lambda-dynamo-node/README.md.tmpl +189 -0
- package/dist/templates/webapp-lambda-dynamo-node/apps/api/index.ts +109 -0
- package/dist/templates/webapp-lambda-dynamo-node/apps/api/package.json +19 -0
- package/dist/templates/webapp-lambda-dynamo-node/apps/api/tsconfig.json +8 -0
- package/dist/templates/webapp-lambda-dynamo-node/cdk/app.ts.tmpl +65 -0
- package/dist/templates/webapp-lambda-dynamo-node/cdk/cdk.json +68 -0
- package/dist/templates/webapp-lambda-dynamo-node/cdk/tsconfig.json +9 -0
- package/dist/templates/webapp-lambda-dynamo-node/package.json.tmpl +24 -0
- package/dist/templates/webapp-lambda-dynamo-node/tsconfig.json +27 -0
- package/dist/templates/webapp-lambda-node/README.md.tmpl +179 -0
- package/dist/templates/webapp-lambda-node/apps/api/index.ts +100 -0
- package/dist/templates/webapp-lambda-node/apps/api/package.json +17 -0
- package/dist/templates/webapp-lambda-node/apps/api/tsconfig.json +8 -0
- package/dist/templates/webapp-lambda-node/cdk/app.ts.tmpl +59 -0
- package/dist/templates/webapp-lambda-node/cdk/cdk.json +68 -0
- package/dist/templates/webapp-lambda-node/cdk/tsconfig.json +9 -0
- package/dist/templates/webapp-lambda-node/package.json.tmpl +24 -0
- package/dist/templates/webapp-lambda-node/tsconfig.json +27 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/README.md.tmpl +240 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/Api.csproj +19 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/Program.cs +167 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/aws-lambda-tools-defaults.json +10 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/obj/Api.csproj.nuget.dgspec.json +88 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/obj/Api.csproj.nuget.g.props +15 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/obj/Api.csproj.nuget.g.targets +2 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +4 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/obj/Debug/net8.0/Api.AssemblyInfo.cs +22 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/obj/Debug/net8.0/Api.AssemblyInfoInputs.cache +1 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/obj/Debug/net8.0/Api.GeneratedMSBuildEditorConfig.editorconfig +19 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/obj/Debug/net8.0/Api.GlobalUsings.g.cs +17 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/obj/Debug/net8.0/Api.assets.cache +0 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/obj/project.assets.json +106 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/apps/api/obj/project.nuget.cache +15 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/cdk/app.ts.tmpl +61 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/cdk/cdk.json +68 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/cdk/tsconfig.json +9 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/package.json.tmpl +23 -0
- package/dist/templates/webapp-lambda-postgres-dotnet/tsconfig.json +27 -0
- package/dist/templates/webapp-lambda-postgres-node/README.md.tmpl +190 -0
- package/dist/templates/webapp-lambda-postgres-node/apps/api/index.ts +76 -0
- package/dist/templates/webapp-lambda-postgres-node/apps/api/package.json +18 -0
- package/dist/templates/webapp-lambda-postgres-node/apps/api/tsconfig.json +8 -0
- package/dist/templates/webapp-lambda-postgres-node/cdk/app.ts.tmpl +61 -0
- package/dist/templates/webapp-lambda-postgres-node/cdk/cdk.json +68 -0
- package/dist/templates/webapp-lambda-postgres-node/cdk/tsconfig.json +9 -0
- package/dist/templates/webapp-lambda-postgres-node/package.json.tmpl +24 -0
- package/dist/templates/webapp-lambda-postgres-node/tsconfig.json +27 -0
- package/dist/utils/aws.d.ts +4 -0
- package/dist/utils/aws.d.ts.map +1 -0
- package/dist/utils/aws.js +90 -0
- package/dist/utils/aws.js.map +1 -0
- package/dist/utils/dependencies.d.ts +27 -0
- package/dist/utils/dependencies.d.ts.map +1 -0
- package/dist/utils/dependencies.js +267 -0
- package/dist/utils/dependencies.js.map +1 -0
- package/dist/utils/template.d.ts +23 -0
- package/dist/utils/template.d.ts.map +1 -0
- package/dist/utils/template.js +115 -0
- package/dist/utils/template.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"dgSpecHash": "kyKwgyS6RRM=",
|
|
4
|
+
"success": true,
|
|
5
|
+
"projectFilePath": "/Users/alejandro.lopez/code/phila-ctl/templates/webapp-lambda-dotnet/apps/api/Api.csproj",
|
|
6
|
+
"expectedPackageFiles": [
|
|
7
|
+
"/Users/alejandro.lopez/.nuget/packages/amazon.lambda.apigatewayevents/2.7.1/amazon.lambda.apigatewayevents.2.7.1.nupkg.sha512",
|
|
8
|
+
"/Users/alejandro.lopez/.nuget/packages/amazon.lambda.applicationloadbalancerevents/2.2.0/amazon.lambda.applicationloadbalancerevents.2.2.0.nupkg.sha512",
|
|
9
|
+
"/Users/alejandro.lopez/.nuget/packages/amazon.lambda.aspnetcoreserver/9.0.2/amazon.lambda.aspnetcoreserver.9.0.2.nupkg.sha512",
|
|
10
|
+
"/Users/alejandro.lopez/.nuget/packages/amazon.lambda.aspnetcoreserver.hosting/1.7.2/amazon.lambda.aspnetcoreserver.hosting.1.7.2.nupkg.sha512",
|
|
11
|
+
"/Users/alejandro.lopez/.nuget/packages/amazon.lambda.core/2.5.0/amazon.lambda.core.2.5.0.nupkg.sha512",
|
|
12
|
+
"/Users/alejandro.lopez/.nuget/packages/amazon.lambda.logging.aspnetcore/3.1.1/amazon.lambda.logging.aspnetcore.3.1.1.nupkg.sha512",
|
|
13
|
+
"/Users/alejandro.lopez/.nuget/packages/amazon.lambda.runtimesupport/1.12.0/amazon.lambda.runtimesupport.1.12.0.nupkg.sha512",
|
|
14
|
+
"/Users/alejandro.lopez/.nuget/packages/amazon.lambda.serialization.systemtextjson/2.4.4/amazon.lambda.serialization.systemtextjson.2.4.4.nupkg.sha512",
|
|
15
|
+
"/Users/alejandro.lopez/.nuget/packages/microsoft.extensions.configuration/2.1.0/microsoft.extensions.configuration.2.1.0.nupkg.sha512",
|
|
16
|
+
"/Users/alejandro.lopez/.nuget/packages/microsoft.extensions.configuration.abstractions/2.1.0/microsoft.extensions.configuration.abstractions.2.1.0.nupkg.sha512",
|
|
17
|
+
"/Users/alejandro.lopez/.nuget/packages/microsoft.extensions.configuration.binder/2.1.0/microsoft.extensions.configuration.binder.2.1.0.nupkg.sha512",
|
|
18
|
+
"/Users/alejandro.lopez/.nuget/packages/microsoft.extensions.dependencyinjection.abstractions/2.1.0/microsoft.extensions.dependencyinjection.abstractions.2.1.0.nupkg.sha512",
|
|
19
|
+
"/Users/alejandro.lopez/.nuget/packages/microsoft.extensions.logging/2.1.0/microsoft.extensions.logging.2.1.0.nupkg.sha512",
|
|
20
|
+
"/Users/alejandro.lopez/.nuget/packages/microsoft.extensions.logging.abstractions/2.1.0/microsoft.extensions.logging.abstractions.2.1.0.nupkg.sha512",
|
|
21
|
+
"/Users/alejandro.lopez/.nuget/packages/microsoft.extensions.options/2.1.0/microsoft.extensions.options.2.1.0.nupkg.sha512",
|
|
22
|
+
"/Users/alejandro.lopez/.nuget/packages/microsoft.extensions.primitives/2.1.0/microsoft.extensions.primitives.2.1.0.nupkg.sha512",
|
|
23
|
+
"/Users/alejandro.lopez/.nuget/packages/snapshotrestore.registry/1.0.0/snapshotrestore.registry.1.0.0.nupkg.sha512",
|
|
24
|
+
"/Users/alejandro.lopez/.nuget/packages/system.memory/4.5.0/system.memory.4.5.0.nupkg.sha512",
|
|
25
|
+
"/Users/alejandro.lopez/.nuget/packages/system.runtime.compilerservices.unsafe/4.5.0/system.runtime.compilerservices.unsafe.4.5.0.nupkg.sha512"
|
|
26
|
+
],
|
|
27
|
+
"logs": [
|
|
28
|
+
{
|
|
29
|
+
"code": "NU1900",
|
|
30
|
+
"level": "Warning",
|
|
31
|
+
"warningLevel": 1,
|
|
32
|
+
"message": "Error occurred while getting package vulnerability data: Unable to load the service index for source https://philagov-102658671810.d.codeartifact.us-east-1.amazonaws.com/nuget/se-team/v3/index.json."
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import 'source-map-support/register';
|
|
3
|
+
import { App, Aspects, Stack } from 'aws-cdk-lib';
|
|
4
|
+
import { AwsSolutionsChecks, NIST80053R5Checks } from 'cdk-nag';
|
|
5
|
+
import { StaticSite, LambdaApi, Confidentiality, Environment } from '@phila/constructs';
|
|
6
|
+
|
|
7
|
+
const app = new App();
|
|
8
|
+
|
|
9
|
+
// Environment is determined by CDK context
|
|
10
|
+
const environment = app.node.tryGetContext('environment') as Environment;
|
|
11
|
+
|
|
12
|
+
if (!environment) {
|
|
13
|
+
throw new Error('Environment must be specified via context. Use: cdk deploy -c environment=dev');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Read compliance frameworks from context
|
|
17
|
+
const compliance = app.node.tryGetContext('compliance');
|
|
18
|
+
const complianceFrameworks = compliance ? compliance.split(',') : [];
|
|
19
|
+
|
|
20
|
+
// Application context with governance metadata
|
|
21
|
+
const context = {
|
|
22
|
+
appName: '{{appName}}',
|
|
23
|
+
environment,
|
|
24
|
+
department: '{{department}}',
|
|
25
|
+
team: '{{team}}',
|
|
26
|
+
contact: '{{contact}}',
|
|
27
|
+
compliance: complianceFrameworks,
|
|
28
|
+
confidentiality: Confidentiality.{{CONFIDENTIALITY}},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Stack name follows pattern: {appName}-{environment}
|
|
32
|
+
const stack = new Stack(app, '{{appName}}-' + environment, {
|
|
33
|
+
env: {
|
|
34
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
35
|
+
region: process.env.CDK_DEFAULT_REGION || 'us-east-1',
|
|
36
|
+
},
|
|
37
|
+
stackName: '{{appName}}-' + environment,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Create the StaticSite construct for the Nuxt frontend
|
|
41
|
+
new StaticSite(stack, '{{appName}}Site', {
|
|
42
|
+
...context,
|
|
43
|
+
assetDir: '../frontend/dist',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Create the LambdaApi construct for the .NET API backend
|
|
47
|
+
new LambdaApi(stack, '{{appName}}Api', {
|
|
48
|
+
...context,
|
|
49
|
+
apiId: 'api',
|
|
50
|
+
runtime: 'dotnet8',
|
|
51
|
+
handler: 'Api',
|
|
52
|
+
codeDir: '../apps/api',
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Apply compliance checks
|
|
56
|
+
Aspects.of(app).add(new NIST80053R5Checks({ verbose: true }));
|
|
57
|
+
Aspects.of(app).add(new AwsSolutionsChecks({ verbose: true }));
|
|
58
|
+
|
|
59
|
+
app.synth();
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"app": "npx ts-node --prefer-ts-exts app.ts",
|
|
3
|
+
"watch": {
|
|
4
|
+
"include": ["**"],
|
|
5
|
+
"exclude": [
|
|
6
|
+
"README.md",
|
|
7
|
+
"cdk*.json",
|
|
8
|
+
"**/*.d.ts",
|
|
9
|
+
"**/*.js",
|
|
10
|
+
"tsconfig.json",
|
|
11
|
+
"package*.json",
|
|
12
|
+
"yarn.lock",
|
|
13
|
+
"node_modules",
|
|
14
|
+
"test"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"context": {
|
|
18
|
+
"@aws-cdk/aws-lambda:recognizeLayerVersion": true,
|
|
19
|
+
"@aws-cdk/core:checkSecretUsage": true,
|
|
20
|
+
"@aws-cdk/core:target-partitions": ["aws", "aws-cn"],
|
|
21
|
+
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
|
|
22
|
+
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
|
|
23
|
+
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
|
|
24
|
+
"@aws-cdk/aws-iam:minimizePolicies": true,
|
|
25
|
+
"@aws-cdk/core:validateSnapshotRemovalPolicy": true,
|
|
26
|
+
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
|
|
27
|
+
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true,
|
|
28
|
+
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true,
|
|
29
|
+
"@aws-cdk/aws-apigateway:disableCloudWatchRole": false,
|
|
30
|
+
"@aws-cdk/core:enablePartitionLiterals": true,
|
|
31
|
+
"@aws-cdk/aws-events:eventsTargetQueueSameAccount": true,
|
|
32
|
+
"@aws-cdk/aws-iam:standardizedServicePrincipals": true,
|
|
33
|
+
"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true,
|
|
34
|
+
"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true,
|
|
35
|
+
"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true,
|
|
36
|
+
"@aws-cdk/aws-route53-patters:useCertificate": true,
|
|
37
|
+
"@aws-cdk/customresources:installLatestAwsSdkDefault": false,
|
|
38
|
+
"@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true,
|
|
39
|
+
"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true,
|
|
40
|
+
"@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true,
|
|
41
|
+
"@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true,
|
|
42
|
+
"@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true,
|
|
43
|
+
"@aws-cdk/aws-redshift:columnId": true,
|
|
44
|
+
"@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true,
|
|
45
|
+
"@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true,
|
|
46
|
+
"@aws-cdk/aws-apigateway:requestValidatorUniqueId": true,
|
|
47
|
+
"@aws-cdk/aws-kms:aliasNameRef": true,
|
|
48
|
+
"@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true,
|
|
49
|
+
"@aws-cdk/core:includePrefixInUniqueNameGeneration": true,
|
|
50
|
+
"@aws-cdk/aws-efs:denyAnonymousAccess": true,
|
|
51
|
+
"@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true,
|
|
52
|
+
"@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": true,
|
|
53
|
+
"@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": true,
|
|
54
|
+
"@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": true,
|
|
55
|
+
"@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": true,
|
|
56
|
+
"@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": true,
|
|
57
|
+
"@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": true,
|
|
58
|
+
"@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction": true,
|
|
59
|
+
"@aws-cdk/aws-codepipeline:crossAccountKeysDefaultValueToFalse": true,
|
|
60
|
+
"@aws-cdk/aws-codepipeline:defaultPipelineTypeToV2": true,
|
|
61
|
+
"@aws-cdk/aws-kms:reduceCrossAccountRegionPolicyScope": true,
|
|
62
|
+
"@aws-cdk/aws-eks:nodegroupNameAttribute": true,
|
|
63
|
+
"@aws-cdk/aws-ec2:ebsDefaultGp3Volume": true,
|
|
64
|
+
"@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm": true,
|
|
65
|
+
"@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": false,
|
|
66
|
+
"@aws-cdk/aws-s3:keepNotificationInImportedBucket": false
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{appName}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Web application with Nuxt frontend and .NET Lambda API backend",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "npm run build:frontend && npm run build:api",
|
|
8
|
+
"build:frontend": "cd frontend && npm run build",
|
|
9
|
+
"build:api": "cd apps/api && dotnet publish -c Release -o publish",
|
|
10
|
+
"dev": "cd frontend && npm run dev",
|
|
11
|
+
"test": "npm test --workspaces --if-present",
|
|
12
|
+
"synth": "cd cdk && cdk synth",
|
|
13
|
+
"deploy": "cd cdk && cdk deploy",
|
|
14
|
+
"diff": "cd cdk && cdk diff"
|
|
15
|
+
},
|
|
16
|
+
"workspaces": [
|
|
17
|
+
"cdk",
|
|
18
|
+
"frontend"
|
|
19
|
+
],
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "^5.3.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noImplicitAny": true,
|
|
9
|
+
"strictNullChecks": true,
|
|
10
|
+
"noImplicitThis": true,
|
|
11
|
+
"alwaysStrict": true,
|
|
12
|
+
"noUnusedLocals": false,
|
|
13
|
+
"noUnusedParameters": false,
|
|
14
|
+
"noImplicitReturns": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": false,
|
|
16
|
+
"inlineSourceMap": true,
|
|
17
|
+
"inlineSources": true,
|
|
18
|
+
"experimentalDecorators": true,
|
|
19
|
+
"strictPropertyInitialization": false,
|
|
20
|
+
"typeRoots": ["./node_modules/@types"],
|
|
21
|
+
"skipLibCheck": true,
|
|
22
|
+
"esModuleInterop": true,
|
|
23
|
+
"forceConsistentCasingInFileNames": true,
|
|
24
|
+
"resolveJsonModule": true
|
|
25
|
+
},
|
|
26
|
+
"exclude": ["node_modules", "cdk.out", "frontend"]
|
|
27
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# {{appName}}
|
|
2
|
+
|
|
3
|
+
Web application with Nuxt SSG frontend, .NET Lambda API backend, and DynamoDB using Philadelphia constructs.
|
|
4
|
+
|
|
5
|
+
Generated on {{timestamp}}
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
View the [architecture diagram](https://github.com/CityOfPhiladelphia/phila-ctl/blob/main/packages/constructs/docs/diagrams/webapp-lambda-dynamo.drawio) in draw.io or VS Code with the Draw.io extension.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Prerequisites
|
|
16
|
+
|
|
17
|
+
- Node.js 20+
|
|
18
|
+
- .NET 8 SDK
|
|
19
|
+
- AWS CLI configured with SSO
|
|
20
|
+
- AWS profile named `phila-{{appName}}`
|
|
21
|
+
|
|
22
|
+
### Setup
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Install frontend and CDK dependencies
|
|
26
|
+
npm install
|
|
27
|
+
|
|
28
|
+
# Restore .NET dependencies
|
|
29
|
+
cd apps/api && dotnet restore && cd ../..
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Development
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Run frontend dev server
|
|
36
|
+
npm run dev
|
|
37
|
+
|
|
38
|
+
# Build frontend for production
|
|
39
|
+
npm run build:frontend
|
|
40
|
+
|
|
41
|
+
# Build API
|
|
42
|
+
npm run build:api
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Deployment
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Configure AWS profile
|
|
49
|
+
export AWS_PROFILE=phila-{{appName}}
|
|
50
|
+
|
|
51
|
+
# Deploy to dev environment
|
|
52
|
+
city deploy dev
|
|
53
|
+
|
|
54
|
+
# Deploy to test environment
|
|
55
|
+
city deploy test
|
|
56
|
+
|
|
57
|
+
# Deploy to production (requires confirmation)
|
|
58
|
+
city deploy prod
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Shipping Updates
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Ship frontend changes to S3/CloudFront
|
|
65
|
+
city ship dev --web
|
|
66
|
+
|
|
67
|
+
# Ship API changes to Lambda
|
|
68
|
+
city ship dev --lambda api
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Project Structure
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
.
|
|
75
|
+
├── cdk/ # CDK infrastructure code
|
|
76
|
+
│ └── app.ts # Main CDK application
|
|
77
|
+
├── frontend/ # Nuxt 3 SSG frontend
|
|
78
|
+
│ ├── pages/ # File-based routing
|
|
79
|
+
│ ├── app.vue # Root component
|
|
80
|
+
│ └── nuxt.config.ts # Nuxt configuration
|
|
81
|
+
├── apps/ # Backend code
|
|
82
|
+
│ └── api/ # .NET Minimal API with DynamoDB
|
|
83
|
+
│ ├── Program.cs # API entry point and routes
|
|
84
|
+
│ └── Api.csproj # Project file
|
|
85
|
+
└── city.config.json # City CLI configuration
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Frontend
|
|
89
|
+
|
|
90
|
+
The frontend uses [Nuxt 3](https://nuxt.com) with Static Site Generation (SSG):
|
|
91
|
+
|
|
92
|
+
- Pre-renders to static HTML for S3/CloudFront
|
|
93
|
+
- File-based routing in `pages/` directory
|
|
94
|
+
- TypeScript support enabled
|
|
95
|
+
|
|
96
|
+
### Adding Pages
|
|
97
|
+
|
|
98
|
+
Create Vue files in `frontend/pages/`:
|
|
99
|
+
|
|
100
|
+
```vue
|
|
101
|
+
<!-- frontend/pages/about.vue -->
|
|
102
|
+
<template>
|
|
103
|
+
<div>
|
|
104
|
+
<h1>About</h1>
|
|
105
|
+
</div>
|
|
106
|
+
</template>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This automatically creates a route at `/about`.
|
|
110
|
+
|
|
111
|
+
## API
|
|
112
|
+
|
|
113
|
+
The API uses [.NET Minimal API](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis) with AWS Lambda hosting and DynamoDB.
|
|
114
|
+
|
|
115
|
+
### Adding Endpoints
|
|
116
|
+
|
|
117
|
+
Edit `apps/api/Program.cs`:
|
|
118
|
+
|
|
119
|
+
```csharp
|
|
120
|
+
// Get all items (requires implementing scan/query)
|
|
121
|
+
app.MapGet("/items", async (DynamoDbService db) =>
|
|
122
|
+
{
|
|
123
|
+
// Implement query logic
|
|
124
|
+
return Results.Ok(new { items = new List<object>() });
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Update item
|
|
128
|
+
app.MapPut("/items/{id}", async (string id, ItemRequest request, DynamoDbService db) =>
|
|
129
|
+
{
|
|
130
|
+
var item = new Dictionary<string, object>
|
|
131
|
+
{
|
|
132
|
+
["pk"] = id,
|
|
133
|
+
["name"] = request.Name,
|
|
134
|
+
["updatedAt"] = DateTime.UtcNow.ToString("o")
|
|
135
|
+
};
|
|
136
|
+
await db.PutItemAsync(tableName, item);
|
|
137
|
+
return Results.Ok(item);
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Environment Variables
|
|
142
|
+
|
|
143
|
+
Lambda functions automatically receive:
|
|
144
|
+
- `APP_NAME` - Application name ({{appName}})
|
|
145
|
+
- `ENVIRONMENT` - Current environment (dev/test/prod)
|
|
146
|
+
- `TABLE_NAME` - DynamoDB table name
|
|
147
|
+
- `TABLE_ARN` - DynamoDB table ARN
|
|
148
|
+
|
|
149
|
+
### Building the API
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Debug build
|
|
153
|
+
cd apps/api && dotnet build
|
|
154
|
+
|
|
155
|
+
# Release build for deployment
|
|
156
|
+
cd apps/api && dotnet publish -c Release -o publish
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## DynamoDB
|
|
160
|
+
|
|
161
|
+
The template creates a DynamoDB table with:
|
|
162
|
+
- **Partition key**: `pk` (String)
|
|
163
|
+
- **Billing mode**: PAY_PER_REQUEST (on-demand)
|
|
164
|
+
- **Point-in-time recovery**: Enabled
|
|
165
|
+
- **Encryption**: AWS managed KMS key
|
|
166
|
+
|
|
167
|
+
### Table Schema
|
|
168
|
+
|
|
169
|
+
The default schema uses a single partition key. For complex access patterns, consider:
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
// In cdk/app.ts, add a sort key:
|
|
173
|
+
partitionKey: { name: 'pk', type: 'S' },
|
|
174
|
+
sortKey: { name: 'sk', type: 'S' },
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### DynamoDB Best Practices
|
|
178
|
+
|
|
179
|
+
- Design your access patterns first
|
|
180
|
+
- Use composite keys for hierarchical data
|
|
181
|
+
- Consider single-table design for related entities
|
|
182
|
+
- Use GSIs sparingly (additional cost)
|
|
183
|
+
|
|
184
|
+
## Resources Created
|
|
185
|
+
|
|
186
|
+
This application creates:
|
|
187
|
+
|
|
188
|
+
**Frontend:**
|
|
189
|
+
- **S3 Bucket** - Static asset storage
|
|
190
|
+
- **CloudFront Distribution** - CDN with HTTPS
|
|
191
|
+
- **Origin Access Control** - Secure S3 access
|
|
192
|
+
|
|
193
|
+
**API:**
|
|
194
|
+
- **API Gateway REST API** - HTTP endpoint
|
|
195
|
+
- **Lambda Function** - .NET 8 serverless compute
|
|
196
|
+
- **DynamoDB Table** - NoSQL database
|
|
197
|
+
- **VPC Security Group** - Network security
|
|
198
|
+
- **IAM Role** - Permissions for Lambda and DynamoDB
|
|
199
|
+
|
|
200
|
+
**Shared:**
|
|
201
|
+
- **SSM Parameters** - Resource discovery
|
|
202
|
+
- **CloudWatch Logs** - Application logs
|
|
203
|
+
- **KMS Keys** - Encryption
|
|
204
|
+
|
|
205
|
+
## URLs
|
|
206
|
+
|
|
207
|
+
After deployment, URLs are available via:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Frontend URL
|
|
211
|
+
city config list --env dev | grep cloudfront
|
|
212
|
+
|
|
213
|
+
# API URL
|
|
214
|
+
city config list --env dev | grep api
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Support
|
|
218
|
+
|
|
219
|
+
For issues or questions:
|
|
220
|
+
- [Philadelphia Infrastructure Library Documentation](https://github.com/CityOfPhiladelphia/phila-ctl)
|
|
221
|
+
- [.NET Minimal APIs Documentation](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis)
|
|
222
|
+
- [AWS DynamoDB Documentation](https://docs.aws.amazon.com/dynamodb/)
|
|
223
|
+
- [Nuxt Documentation](https://nuxt.com/docs)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- ABOUTME: .NET 8 Minimal API project for AWS Lambda with DynamoDB -->
|
|
2
|
+
<!-- ABOUTME: Uses AWS SDK for DynamoDB Document Model API -->
|
|
3
|
+
<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
4
|
+
<PropertyGroup>
|
|
5
|
+
<TargetFramework>net8.0</TargetFramework>
|
|
6
|
+
<Nullable>enable</Nullable>
|
|
7
|
+
<ImplicitUsings>enable</ImplicitUsings>
|
|
8
|
+
<OutputType>Exe</OutputType>
|
|
9
|
+
<AssemblyName>Api</AssemblyName>
|
|
10
|
+
<RootNamespace>Api</RootNamespace>
|
|
11
|
+
</PropertyGroup>
|
|
12
|
+
|
|
13
|
+
<ItemGroup>
|
|
14
|
+
<PackageReference Include="Amazon.Lambda.AspNetCoreServer.Hosting" Version="1.7.2" />
|
|
15
|
+
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
|
|
16
|
+
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.400" />
|
|
17
|
+
</ItemGroup>
|
|
18
|
+
</Project>
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// ABOUTME: Minimal API Lambda handler with DynamoDB integration
|
|
2
|
+
// ABOUTME: Provides REST endpoints for CRUD operations on DynamoDB table
|
|
3
|
+
|
|
4
|
+
using System.Text.Json;
|
|
5
|
+
using Amazon.DynamoDBv2;
|
|
6
|
+
using Amazon.DynamoDBv2.DocumentModel;
|
|
7
|
+
|
|
8
|
+
var builder = WebApplication.CreateBuilder(args);
|
|
9
|
+
|
|
10
|
+
// Add AWS Lambda hosting
|
|
11
|
+
builder.Services.AddAWSLambdaHosting(LambdaEventSource.HttpApi);
|
|
12
|
+
|
|
13
|
+
// Register DynamoDB client as singleton
|
|
14
|
+
builder.Services.AddSingleton<IAmazonDynamoDB, AmazonDynamoDBClient>();
|
|
15
|
+
builder.Services.AddSingleton<DynamoDbService>();
|
|
16
|
+
|
|
17
|
+
var app = builder.Build();
|
|
18
|
+
|
|
19
|
+
var tableName = Environment.GetEnvironmentVariable("TABLE_NAME")
|
|
20
|
+
?? throw new InvalidOperationException("TABLE_NAME environment variable not set");
|
|
21
|
+
|
|
22
|
+
// Health check endpoint
|
|
23
|
+
app.MapGet("/health", () => Results.Ok(new
|
|
24
|
+
{
|
|
25
|
+
Status = "healthy",
|
|
26
|
+
Timestamp = DateTime.UtcNow.ToString("o")
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
// Hello world endpoint
|
|
30
|
+
app.MapGet("/hello", (HttpContext context) =>
|
|
31
|
+
{
|
|
32
|
+
var name = context.Request.Query["name"].FirstOrDefault() ?? "World";
|
|
33
|
+
return Results.Ok(new
|
|
34
|
+
{
|
|
35
|
+
Message = $"Hello, {name}!",
|
|
36
|
+
AppName = Environment.GetEnvironmentVariable("APP_NAME"),
|
|
37
|
+
Environment = Environment.GetEnvironmentVariable("ENVIRONMENT"),
|
|
38
|
+
Timestamp = DateTime.UtcNow.ToString("o")
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Get item by ID
|
|
43
|
+
app.MapGet("/items/{id}", async (string id, DynamoDbService db) =>
|
|
44
|
+
{
|
|
45
|
+
var item = await db.GetItemAsync(tableName, id);
|
|
46
|
+
if (item == null)
|
|
47
|
+
{
|
|
48
|
+
return Results.NotFound(new { Error = "Item not found" });
|
|
49
|
+
}
|
|
50
|
+
return Results.Ok(item);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Create item
|
|
54
|
+
app.MapPost("/items", async (ItemRequest request, DynamoDbService db) =>
|
|
55
|
+
{
|
|
56
|
+
Console.WriteLine($"Creating item: {request.Id}");
|
|
57
|
+
|
|
58
|
+
var item = new Dictionary<string, object>
|
|
59
|
+
{
|
|
60
|
+
["pk"] = request.Id,
|
|
61
|
+
["id"] = request.Id,
|
|
62
|
+
["name"] = request.Name,
|
|
63
|
+
["description"] = request.Description ?? "",
|
|
64
|
+
["createdAt"] = DateTime.UtcNow.ToString("o"),
|
|
65
|
+
["updatedAt"] = DateTime.UtcNow.ToString("o")
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
await db.PutItemAsync(tableName, item);
|
|
69
|
+
|
|
70
|
+
return Results.Created($"/items/{request.Id}", new
|
|
71
|
+
{
|
|
72
|
+
Message = "Item created",
|
|
73
|
+
Item = item
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Delete item by ID
|
|
78
|
+
app.MapDelete("/items/{id}", async (string id, DynamoDbService db) =>
|
|
79
|
+
{
|
|
80
|
+
await db.DeleteItemAsync(tableName, id);
|
|
81
|
+
return Results.Ok(new { Message = "Item deleted" });
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
app.Run();
|
|
85
|
+
|
|
86
|
+
/// <summary>
|
|
87
|
+
/// Request model for creating items
|
|
88
|
+
/// </summary>
|
|
89
|
+
public record ItemRequest(string Id, string Name, string? Description);
|
|
90
|
+
|
|
91
|
+
/// <summary>
|
|
92
|
+
/// Service for DynamoDB operations using the Document Model API.
|
|
93
|
+
/// Provides simple key-value access to DynamoDB tables.
|
|
94
|
+
/// </summary>
|
|
95
|
+
public class DynamoDbService
|
|
96
|
+
{
|
|
97
|
+
private readonly IAmazonDynamoDB _client;
|
|
98
|
+
|
|
99
|
+
public DynamoDbService(IAmazonDynamoDB client)
|
|
100
|
+
{
|
|
101
|
+
_client = client;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public async Task<Dictionary<string, object>?> GetItemAsync(string tableName, string id)
|
|
105
|
+
{
|
|
106
|
+
var table = Table.LoadTable(_client, tableName);
|
|
107
|
+
var doc = await table.GetItemAsync(id);
|
|
108
|
+
|
|
109
|
+
if (doc == null)
|
|
110
|
+
{
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return DocumentToDict(doc);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public async Task PutItemAsync(string tableName, Dictionary<string, object> item)
|
|
118
|
+
{
|
|
119
|
+
var table = Table.LoadTable(_client, tableName);
|
|
120
|
+
var doc = new Document();
|
|
121
|
+
|
|
122
|
+
foreach (var kvp in item)
|
|
123
|
+
{
|
|
124
|
+
doc[kvp.Key] = kvp.Value switch
|
|
125
|
+
{
|
|
126
|
+
string s => s,
|
|
127
|
+
int i => i,
|
|
128
|
+
long l => l,
|
|
129
|
+
double d => d,
|
|
130
|
+
bool b => b,
|
|
131
|
+
DateTime dt => dt.ToString("o"),
|
|
132
|
+
_ => kvp.Value?.ToString() ?? ""
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
await table.PutItemAsync(doc);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
public async Task DeleteItemAsync(string tableName, string id)
|
|
140
|
+
{
|
|
141
|
+
var table = Table.LoadTable(_client, tableName);
|
|
142
|
+
await table.DeleteItemAsync(id);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
private static Dictionary<string, object> DocumentToDict(Document doc)
|
|
146
|
+
{
|
|
147
|
+
var result = new Dictionary<string, object>();
|
|
148
|
+
foreach (var key in doc.Keys)
|
|
149
|
+
{
|
|
150
|
+
var entry = doc[key];
|
|
151
|
+
result[key] = entry.AsString();
|
|
152
|
+
}
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Information": ["Configuration used by AWS Lambda .NET tooling when deploying"],
|
|
3
|
+
"profile": "",
|
|
4
|
+
"region": "",
|
|
5
|
+
"configuration": "Release",
|
|
6
|
+
"function-runtime": "dotnet8",
|
|
7
|
+
"function-memory-size": 256,
|
|
8
|
+
"function-timeout": 30,
|
|
9
|
+
"function-handler": "Api"
|
|
10
|
+
}
|