@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,109 @@
|
|
|
1
|
+
// ABOUTME: Lambda API handler with DynamoDB database connection
|
|
2
|
+
// ABOUTME: Uses philaroute for routing with DynamoDB DocumentClient
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* HTTP routing using @phila/philaroute
|
|
6
|
+
* @see https://github.com/CityOfPhiladelphia/philaroute
|
|
7
|
+
*
|
|
8
|
+
* DynamoDB integration using AWS SDK v3 DocumentClient
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { APIGWV1Payload } from '@phila/philaroute/dist/types';
|
|
12
|
+
import type { RestAccumulator } from '@phila/philaroute/dist/types';
|
|
13
|
+
import { Router, http, validate } from '@phila/philaroute';
|
|
14
|
+
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
|
|
15
|
+
import {
|
|
16
|
+
DynamoDBDocumentClient,
|
|
17
|
+
GetCommand,
|
|
18
|
+
PutCommand,
|
|
19
|
+
DeleteCommand,
|
|
20
|
+
} from '@aws-sdk/lib-dynamodb';
|
|
21
|
+
|
|
22
|
+
const client = new DynamoDBClient({});
|
|
23
|
+
const docClient = DynamoDBDocumentClient.from(client);
|
|
24
|
+
|
|
25
|
+
const TABLE_NAME = process.env.TABLE_NAME!;
|
|
26
|
+
|
|
27
|
+
const router = Router({
|
|
28
|
+
cors: {
|
|
29
|
+
'Access-Control-Allow-Origin': '*',
|
|
30
|
+
'Access-Control-Allow-Method': 'GET,POST,PUT,DELETE,OPTIONS',
|
|
31
|
+
'Access-Control-Allow-Headers': 'Content-Type,Authorization',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const health = {
|
|
36
|
+
check: async (acc: RestAccumulator) => {
|
|
37
|
+
acc.data.status = 'healthy';
|
|
38
|
+
acc.data.timestamp = new Date().toISOString();
|
|
39
|
+
return acc;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const items = {
|
|
44
|
+
get: async (acc: RestAccumulator) => {
|
|
45
|
+
const id = acc.data.valid.parameters.id;
|
|
46
|
+
const result = await docClient.send(
|
|
47
|
+
new GetCommand({
|
|
48
|
+
TableName: TABLE_NAME,
|
|
49
|
+
Key: { pk: id },
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
validate.assert(result.Item, 'Item not found', 404);
|
|
54
|
+
|
|
55
|
+
acc.data.item = result.Item;
|
|
56
|
+
return acc;
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
create: async (acc: RestAccumulator) => {
|
|
60
|
+
const body = acc.data.valid.body;
|
|
61
|
+
const item = {
|
|
62
|
+
pk: body.id,
|
|
63
|
+
...body,
|
|
64
|
+
createdAt: new Date().toISOString(),
|
|
65
|
+
updatedAt: new Date().toISOString(),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
await docClient.send(
|
|
69
|
+
new PutCommand({
|
|
70
|
+
TableName: TABLE_NAME,
|
|
71
|
+
Item: item,
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
acc.data.message = 'Item created';
|
|
76
|
+
acc.data.item = item;
|
|
77
|
+
return acc;
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
delete: async (acc: RestAccumulator) => {
|
|
81
|
+
const id = acc.data.valid.parameters.id;
|
|
82
|
+
|
|
83
|
+
await docClient.send(
|
|
84
|
+
new DeleteCommand({
|
|
85
|
+
TableName: TABLE_NAME,
|
|
86
|
+
Key: { pk: id },
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
acc.data.message = 'Item deleted';
|
|
91
|
+
return acc;
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// Route definitions
|
|
96
|
+
// The router automatically responds with 200 and acc.data as body.
|
|
97
|
+
// Use http.response({ statusCode }) only when overriding (e.g., 201 for POST).
|
|
98
|
+
|
|
99
|
+
router.path('/health').get([health.check]);
|
|
100
|
+
|
|
101
|
+
router.path('/items/:id').get([validate.parameters(['id']), items.get]);
|
|
102
|
+
|
|
103
|
+
router
|
|
104
|
+
.path('/items')
|
|
105
|
+
.post([validate.body({ id: 'string' }), items.create, http.response({ statusCode: 201 })]);
|
|
106
|
+
|
|
107
|
+
router.path('/items/:id').delete([validate.parameters(['id']), items.delete]);
|
|
108
|
+
|
|
109
|
+
export const handler = async (event: APIGWV1Payload) => router.routeToPath(event);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "api",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Lambda API handler with DynamoDB",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"watch": "tsc -w"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@phila/philaroute": "^1.0.12",
|
|
12
|
+
"@aws-sdk/client-dynamodb": "^3.0.0",
|
|
13
|
+
"@aws-sdk/lib-dynamodb": "^3.0.0",
|
|
14
|
+
"@types/aws-lambda": "^8.10.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"typescript": "^5.3.0"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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, LambdaDynamoApi, 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 LambdaDynamoApi construct for the API backend with DynamoDB
|
|
47
|
+
new LambdaDynamoApi(stack, '{{appName}}Api', {
|
|
48
|
+
...context,
|
|
49
|
+
apiId: 'api',
|
|
50
|
+
runtime: 'nodejs20',
|
|
51
|
+
handler: 'index.handler',
|
|
52
|
+
codeDir: '../apps/api',
|
|
53
|
+
// DynamoDB table configuration
|
|
54
|
+
partitionKey: { name: 'pk', type: 'S' },
|
|
55
|
+
// Uncomment for composite key (partition + sort):
|
|
56
|
+
// sortKey: { name: 'sk', type: 'S' },
|
|
57
|
+
// Uncomment to enable DynamoDB streams:
|
|
58
|
+
// enableStream: true,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Apply compliance checks
|
|
62
|
+
Aspects.of(app).add(new NIST80053R5Checks({ verbose: true }));
|
|
63
|
+
Aspects.of(app).add(new AwsSolutionsChecks({ verbose: true }));
|
|
64
|
+
|
|
65
|
+
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,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{appName}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Web application with Nuxt frontend and Lambda API backend",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "npm run build --workspaces",
|
|
8
|
+
"build:frontend": "cd frontend && npm run build",
|
|
9
|
+
"build:api": "cd apps/api && npm run build",
|
|
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
|
+
"apps/*",
|
|
19
|
+
"frontend"
|
|
20
|
+
],
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"typescript": "^5.3.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -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,179 @@
|
|
|
1
|
+
# {{appName}}
|
|
2
|
+
|
|
3
|
+
Web application with Nuxt SSG frontend and Lambda API backend 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.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
|
+
- AWS CLI configured with SSO
|
|
19
|
+
- AWS profile named `phila-{{appName}}`
|
|
20
|
+
|
|
21
|
+
### Setup
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Install dependencies
|
|
25
|
+
npm install
|
|
26
|
+
|
|
27
|
+
# Build all packages
|
|
28
|
+
npm run build
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Development
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Run frontend dev server
|
|
35
|
+
npm run dev
|
|
36
|
+
|
|
37
|
+
# Build frontend for production
|
|
38
|
+
npm run build:frontend
|
|
39
|
+
|
|
40
|
+
# Build API
|
|
41
|
+
npm run build:api
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Deployment
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Configure AWS profile
|
|
48
|
+
export AWS_PROFILE=phila-{{appName}}
|
|
49
|
+
|
|
50
|
+
# Deploy to dev environment
|
|
51
|
+
city deploy dev
|
|
52
|
+
|
|
53
|
+
# Deploy to test environment
|
|
54
|
+
city deploy test
|
|
55
|
+
|
|
56
|
+
# Deploy to production (requires confirmation)
|
|
57
|
+
city deploy prod
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Shipping Updates
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Ship frontend changes to S3/CloudFront
|
|
64
|
+
city ship dev --web
|
|
65
|
+
|
|
66
|
+
# Ship API changes to Lambda
|
|
67
|
+
city ship dev --lambda api
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Project Structure
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
.
|
|
74
|
+
├── cdk/ # CDK infrastructure code
|
|
75
|
+
│ └── app.ts # Main CDK application
|
|
76
|
+
├── frontend/ # Nuxt 3 SSG frontend
|
|
77
|
+
│ ├── pages/ # File-based routing
|
|
78
|
+
│ ├── app.vue # Root component
|
|
79
|
+
│ └── nuxt.config.ts # Nuxt configuration
|
|
80
|
+
├── apps/ # Backend code
|
|
81
|
+
│ └── api/ # Lambda API handler
|
|
82
|
+
│ └── index.ts # API routes
|
|
83
|
+
└── city.config.json # City CLI configuration
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Frontend
|
|
87
|
+
|
|
88
|
+
The frontend uses [Nuxt 3](https://nuxt.com) with Static Site Generation (SSG):
|
|
89
|
+
|
|
90
|
+
- Pre-renders to static HTML for S3/CloudFront
|
|
91
|
+
- File-based routing in `pages/` directory
|
|
92
|
+
- TypeScript support enabled
|
|
93
|
+
|
|
94
|
+
### Adding Pages
|
|
95
|
+
|
|
96
|
+
Create Vue files in `frontend/pages/`:
|
|
97
|
+
|
|
98
|
+
```vue
|
|
99
|
+
<!-- frontend/pages/about.vue -->
|
|
100
|
+
<template>
|
|
101
|
+
<div>
|
|
102
|
+
<h1>About</h1>
|
|
103
|
+
</div>
|
|
104
|
+
</template>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
This automatically creates a route at `/about`.
|
|
108
|
+
|
|
109
|
+
## API
|
|
110
|
+
|
|
111
|
+
The API uses [@phila/philaroute](https://www.npmjs.com/package/@phila/philaroute) for HTTP routing.
|
|
112
|
+
|
|
113
|
+
### Adding Endpoints
|
|
114
|
+
|
|
115
|
+
Edit `apps/api/index.ts`:
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
const users = router.path('/users');
|
|
119
|
+
users.get([
|
|
120
|
+
async (acc) => ({
|
|
121
|
+
...acc,
|
|
122
|
+
response: {
|
|
123
|
+
statusCode: 200,
|
|
124
|
+
body: { users: [] },
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
]);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Environment Variables
|
|
131
|
+
|
|
132
|
+
Lambda functions automatically receive:
|
|
133
|
+
- `APP_NAME` - Application name ({{appName}})
|
|
134
|
+
- `ENVIRONMENT` - Current environment (dev/test/prod)
|
|
135
|
+
|
|
136
|
+
## Resources Created
|
|
137
|
+
|
|
138
|
+
This application creates:
|
|
139
|
+
|
|
140
|
+
**Frontend:**
|
|
141
|
+
- **S3 Bucket** - Static asset storage
|
|
142
|
+
- **CloudFront Distribution** - CDN with HTTPS
|
|
143
|
+
- **Origin Access Control** - Secure S3 access
|
|
144
|
+
|
|
145
|
+
**API:**
|
|
146
|
+
- **API Gateway REST API** - HTTP endpoint
|
|
147
|
+
- **Lambda Function** - Serverless compute
|
|
148
|
+
- **VPC Security Group** - Network security
|
|
149
|
+
- **IAM Role** - Permissions for Lambda execution
|
|
150
|
+
|
|
151
|
+
**Shared:**
|
|
152
|
+
- **SSM Parameters** - Resource discovery
|
|
153
|
+
- **CloudWatch Logs** - Application logs
|
|
154
|
+
- **KMS Keys** - Encryption
|
|
155
|
+
|
|
156
|
+
## URLs
|
|
157
|
+
|
|
158
|
+
After deployment, URLs are available via:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Frontend URL
|
|
162
|
+
city config list --env dev | grep cloudfront
|
|
163
|
+
|
|
164
|
+
# API URL
|
|
165
|
+
city config list --env dev | grep api
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Adding a Database
|
|
169
|
+
|
|
170
|
+
To add a database, use one of these templates instead:
|
|
171
|
+
- `webapp-lambda-dynamo-node` - For DynamoDB
|
|
172
|
+
- `webapp-lambda-postgres-node` - For PostgreSQL
|
|
173
|
+
|
|
174
|
+
## Support
|
|
175
|
+
|
|
176
|
+
For issues or questions:
|
|
177
|
+
- [Philadelphia Infrastructure Library Documentation](https://github.com/CityOfPhiladelphia/phila-ctl)
|
|
178
|
+
- [philaroute Documentation](https://www.npmjs.com/package/@phila/philaroute)
|
|
179
|
+
- [Nuxt Documentation](https://nuxt.com/docs)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// ABOUTME: Lambda API handler using philaroute HTTP router
|
|
2
|
+
// ABOUTME: Provides REST endpoint scaffolding for web application backend
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* HTTP routing using @phila/philaroute
|
|
6
|
+
* @see https://github.com/CityOfPhiladelphia/philaroute
|
|
7
|
+
*
|
|
8
|
+
* Database connections (when needed):
|
|
9
|
+
*
|
|
10
|
+
* PostgreSQL using @phila/db-postgres
|
|
11
|
+
* @see https://github.com/CityOfPhiladelphia/db-postgres
|
|
12
|
+
*
|
|
13
|
+
* import { getPool } from '@phila/db-postgres';
|
|
14
|
+
*
|
|
15
|
+
* const items = {
|
|
16
|
+
* list: async (acc: RestAccumulator) => {
|
|
17
|
+
* const pool = await getPool();
|
|
18
|
+
* const result = await pool.query('SELECT * FROM items');
|
|
19
|
+
* acc.data.items = result.rows;
|
|
20
|
+
* return acc;
|
|
21
|
+
* }
|
|
22
|
+
* };
|
|
23
|
+
*
|
|
24
|
+
* Oracle using @phila/db-oracle
|
|
25
|
+
* @see https://github.com/CityOfPhiladelphia/db-oracle
|
|
26
|
+
*
|
|
27
|
+
* import { getConnection } from '@phila/db-oracle';
|
|
28
|
+
*
|
|
29
|
+
* const items = {
|
|
30
|
+
* list: async (acc: RestAccumulator) => {
|
|
31
|
+
* const conn = await getConnection();
|
|
32
|
+
* const result = await conn.execute('SELECT * FROM items');
|
|
33
|
+
* acc.data.items = result.rows;
|
|
34
|
+
* return acc;
|
|
35
|
+
* }
|
|
36
|
+
* };
|
|
37
|
+
*
|
|
38
|
+
* Environment variables (DB_SECRET_ARN, DB_NAME) are set automatically
|
|
39
|
+
* by the CDK construct when a database is attached to the stack.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
import type { APIGWV1Payload } from '@phila/philaroute/dist/types';
|
|
43
|
+
import type { RestAccumulator } from '@phila/philaroute/dist/types';
|
|
44
|
+
import { Router, http, validate } from '@phila/philaroute';
|
|
45
|
+
|
|
46
|
+
const router = Router({
|
|
47
|
+
cors: {
|
|
48
|
+
'Access-Control-Allow-Origin': '*',
|
|
49
|
+
'Access-Control-Allow-Method': 'GET,POST,PUT,DELETE,OPTIONS',
|
|
50
|
+
'Access-Control-Allow-Headers': 'Content-Type,Authorization',
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const health = {
|
|
55
|
+
check: async (acc: RestAccumulator) => {
|
|
56
|
+
acc.data.status = 'healthy';
|
|
57
|
+
acc.data.timestamp = new Date().toISOString();
|
|
58
|
+
return acc;
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const hello = {
|
|
63
|
+
greet: async (acc: RestAccumulator) => {
|
|
64
|
+
acc.data.message = `Hello, ${acc.data.valid.parameters.name}!`;
|
|
65
|
+
acc.data.appName = process.env.APP_NAME;
|
|
66
|
+
acc.data.environment = process.env.ENVIRONMENT;
|
|
67
|
+
acc.data.timestamp = new Date().toISOString();
|
|
68
|
+
return acc;
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const items = {
|
|
73
|
+
create: async (acc: RestAccumulator) => {
|
|
74
|
+
acc.data.item = { id: '123', ...acc.data.valid.body };
|
|
75
|
+
acc.data.message = 'Item created';
|
|
76
|
+
return acc;
|
|
77
|
+
},
|
|
78
|
+
get: async (acc: RestAccumulator) => {
|
|
79
|
+
const { id } = acc.data.valid.parameters;
|
|
80
|
+
acc.data.id = id;
|
|
81
|
+
acc.data.message = `Retrieved item ${id}`;
|
|
82
|
+
return acc;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Route definitions
|
|
87
|
+
// The router automatically responds with 200 and acc.data as body.
|
|
88
|
+
// Use http.response({ statusCode }) only when overriding (e.g., 201 for POST).
|
|
89
|
+
|
|
90
|
+
router.path('/health').get([health.check]);
|
|
91
|
+
|
|
92
|
+
router.path('/hello').get([validate.parameters(['name']), hello.greet]);
|
|
93
|
+
|
|
94
|
+
router
|
|
95
|
+
.path('/items')
|
|
96
|
+
.post([validate.body({ name: 'string' }), items.create, http.response({ statusCode: 201 })]);
|
|
97
|
+
|
|
98
|
+
router.path('/items/:id').get([validate.parameters(['id']), items.get]);
|
|
99
|
+
|
|
100
|
+
export const handler = async (event: APIGWV1Payload) => router.routeToPath(event);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "api",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Lambda API handler",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"watch": "tsc -w"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@phila/philaroute": "^1.0.12",
|
|
12
|
+
"@types/aws-lambda": "^8.10.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^5.3.0"
|
|
16
|
+
}
|
|
17
|
+
}
|