@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,234 @@
|
|
|
1
|
+
# {{appName}}
|
|
2
|
+
|
|
3
|
+
Lambda API with PostgreSQL database using Philadelphia constructs and philaroute.
|
|
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/lambda-postgres-api.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
|
+
### Deployment
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Configure AWS profile
|
|
35
|
+
export AWS_PROFILE=phila-{{appName}}
|
|
36
|
+
|
|
37
|
+
# Deploy to dev environment
|
|
38
|
+
city deploy dev
|
|
39
|
+
|
|
40
|
+
# Deploy to test environment
|
|
41
|
+
city deploy test
|
|
42
|
+
|
|
43
|
+
# Deploy to production (requires confirmation)
|
|
44
|
+
city deploy prod
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Development
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Build TypeScript
|
|
51
|
+
npm run build
|
|
52
|
+
|
|
53
|
+
# View CDK diff before deploying
|
|
54
|
+
npm run diff
|
|
55
|
+
|
|
56
|
+
# Synthesize CloudFormation template
|
|
57
|
+
npm run synth
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Project Structure
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
.
|
|
64
|
+
├── cdk/ # CDK infrastructure code
|
|
65
|
+
│ └── app.ts # Main CDK application
|
|
66
|
+
├── apps/ # Lambda function code
|
|
67
|
+
│ └── {{lambdaName}}/ # Lambda handler
|
|
68
|
+
│ └── index.ts # Handler implementation
|
|
69
|
+
└── city.config.json # City CLI configuration
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## API Usage
|
|
73
|
+
|
|
74
|
+
After deployment, the API URL is available in SSM Parameter Store:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
aws ssm get-parameter --name "/dev/{{appName}}/api/main/url" --query Parameter.Value --output text
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Or use the City CLI:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
city config list --env dev
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Routing with philaroute
|
|
87
|
+
|
|
88
|
+
This template uses [@phila/philaroute](https://www.npmjs.com/package/@phila/philaroute) for HTTP routing. Routes are defined using a composable pipeline pattern.
|
|
89
|
+
|
|
90
|
+
### Defining Routes
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
import { Router, http } from '@phila/philaroute';
|
|
94
|
+
|
|
95
|
+
const router = Router({ cors: { 'Access-Control-Allow-Origin': '*' } });
|
|
96
|
+
|
|
97
|
+
// Simple response
|
|
98
|
+
const health = router.path('/health');
|
|
99
|
+
health.get([
|
|
100
|
+
http.response({
|
|
101
|
+
statusCode: 200,
|
|
102
|
+
body: { status: 'healthy' },
|
|
103
|
+
}),
|
|
104
|
+
]);
|
|
105
|
+
|
|
106
|
+
// With database query
|
|
107
|
+
const items = router.path('/items');
|
|
108
|
+
items.get([
|
|
109
|
+
async (acc) => {
|
|
110
|
+
const db = await getDbConnection();
|
|
111
|
+
const items = await db.query('SELECT * FROM items');
|
|
112
|
+
return {
|
|
113
|
+
...acc,
|
|
114
|
+
response: { statusCode: 200, body: { items } },
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
]);
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Pipeline Functions
|
|
121
|
+
|
|
122
|
+
Each route handler is an array of pipeline functions. Each function receives an accumulator and returns a modified accumulator:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
type RestAccumulator = {
|
|
126
|
+
request?: {
|
|
127
|
+
params?: { [key: string]: string }; // Path and query parameters
|
|
128
|
+
body?: any; // Parsed request body
|
|
129
|
+
headers?: { [key: string]: string }; // Request headers
|
|
130
|
+
};
|
|
131
|
+
data?: { [key: string]: any }; // Shared data between pipeline steps
|
|
132
|
+
response: {
|
|
133
|
+
statusCode?: number;
|
|
134
|
+
headers?: { [key: string]: string };
|
|
135
|
+
body?: string | Record<string, any> | any[];
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Database Connection
|
|
141
|
+
|
|
142
|
+
The Lambda function receives database connection information via environment variables:
|
|
143
|
+
|
|
144
|
+
| Variable | Description |
|
|
145
|
+
|----------|-------------|
|
|
146
|
+
| `DB_SECRET_ARN` | ARN of Secrets Manager secret with database credentials |
|
|
147
|
+
| `DB_NAME` | Database name |
|
|
148
|
+
|
|
149
|
+
### Retrieving Credentials
|
|
150
|
+
|
|
151
|
+
Use the AWS SDK to retrieve credentials from Secrets Manager:
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
import { SecretsManagerClient, GetSecretValueCommand } from '@aws-sdk/client-secrets-manager';
|
|
155
|
+
|
|
156
|
+
async function getDbCredentials() {
|
|
157
|
+
const client = new SecretsManagerClient({});
|
|
158
|
+
const response = await client.send(
|
|
159
|
+
new GetSecretValueCommand({ SecretId: process.env.DB_SECRET_ARN })
|
|
160
|
+
);
|
|
161
|
+
return JSON.parse(response.SecretString || '{}');
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The secret contains:
|
|
166
|
+
- `username` - Database username
|
|
167
|
+
- `password` - Database password
|
|
168
|
+
- `host` - Database hostname (retrieved from SSM parameters)
|
|
169
|
+
- `port` - Database port (default: 5432)
|
|
170
|
+
|
|
171
|
+
### Connection Options
|
|
172
|
+
|
|
173
|
+
Choose your preferred PostgreSQL client library:
|
|
174
|
+
|
|
175
|
+
- **pg** - Low-level PostgreSQL client
|
|
176
|
+
- **knex** - SQL query builder
|
|
177
|
+
- **TypeORM** - Full ORM
|
|
178
|
+
- **Prisma** - Type-safe ORM
|
|
179
|
+
- **drizzle-orm** - Lightweight ORM
|
|
180
|
+
|
|
181
|
+
Add your chosen library to `apps/{{lambdaName}}/package.json`.
|
|
182
|
+
|
|
183
|
+
## Environment Variables
|
|
184
|
+
|
|
185
|
+
Lambda functions automatically receive:
|
|
186
|
+
- `APP_NAME` - Application name ({{appName}})
|
|
187
|
+
- `ENVIRONMENT` - Current environment (dev/test/prod)
|
|
188
|
+
- `DB_SECRET_ARN` - Database credentials secret ARN
|
|
189
|
+
- `DB_NAME` - Database name
|
|
190
|
+
|
|
191
|
+
## Resources Created
|
|
192
|
+
|
|
193
|
+
This application creates:
|
|
194
|
+
- **API Gateway REST API** - HTTP endpoint for your application
|
|
195
|
+
- **Lambda Function** - Serverless compute for handling requests
|
|
196
|
+
- **RDS PostgreSQL** - Managed database instance
|
|
197
|
+
- **Secrets Manager Secret** - Database credentials
|
|
198
|
+
- **VPC Security Groups** - Network security for Lambda and database
|
|
199
|
+
- **IAM Roles** - Permissions for Lambda and database access
|
|
200
|
+
- **SSM Parameters** - Resource discovery (API URL, database endpoint)
|
|
201
|
+
- **CloudWatch Logs** - Application logs
|
|
202
|
+
|
|
203
|
+
## Serverless Aurora
|
|
204
|
+
|
|
205
|
+
To use Aurora Serverless v2 instead of provisioned RDS, edit `cdk/app.ts`:
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
new LambdaPostgresApi(stack, '{{appName}}Api', {
|
|
209
|
+
...context,
|
|
210
|
+
apiId: 'main',
|
|
211
|
+
runtime: 'nodejs20',
|
|
212
|
+
handler: 'index.handler',
|
|
213
|
+
codeDir: '../apps/{{lambdaName}}',
|
|
214
|
+
serverless: true, // Use Aurora Serverless v2
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Next Steps
|
|
219
|
+
|
|
220
|
+
1. Add a PostgreSQL client library to your Lambda
|
|
221
|
+
2. Implement database connection logic using `DB_SECRET_ARN`
|
|
222
|
+
3. Define your routes using philaroute
|
|
223
|
+
4. Create pipeline functions for validation and business logic
|
|
224
|
+
5. Write tests for your handlers
|
|
225
|
+
6. Set up CI/CD pipeline
|
|
226
|
+
|
|
227
|
+
## Support
|
|
228
|
+
|
|
229
|
+
For issues or questions:
|
|
230
|
+
- [Philadelphia Infrastructure Library Documentation](https://github.com/CityOfPhiladelphia/phila-ctl)
|
|
231
|
+
- [philaroute Documentation](https://www.npmjs.com/package/@phila/philaroute)
|
|
232
|
+
- [AWS CDK Documentation](https://docs.aws.amazon.com/cdk/)
|
|
233
|
+
- [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/)
|
|
234
|
+
- [RDS PostgreSQL Documentation](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// ABOUTME: Lambda API handler with PostgreSQL database connection
|
|
2
|
+
// ABOUTME: Uses philaroute for routing and @phila/db-postgres for database access
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* HTTP routing using @phila/philaroute
|
|
6
|
+
* @see https://github.com/CityOfPhiladelphia/philaroute
|
|
7
|
+
*
|
|
8
|
+
* Database connection using @phila/db-postgres
|
|
9
|
+
* @see https://github.com/CityOfPhiladelphia/db-postgres
|
|
10
|
+
*
|
|
11
|
+
* Environment variables (DB_SECRET_ARN, DB_NAME) are set automatically
|
|
12
|
+
* by the CDK construct.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { APIGWV1Payload } from '@phila/philaroute/dist/types';
|
|
16
|
+
import type { RestAccumulator } from '@phila/philaroute/dist/types';
|
|
17
|
+
import { Router, http, validate } from '@phila/philaroute';
|
|
18
|
+
import { getPool } from '@phila/db-postgres';
|
|
19
|
+
|
|
20
|
+
const router = Router({
|
|
21
|
+
cors: {
|
|
22
|
+
'Access-Control-Allow-Origin': '*',
|
|
23
|
+
'Access-Control-Allow-Method': 'GET,POST,PUT,DELETE,OPTIONS',
|
|
24
|
+
'Access-Control-Allow-Headers': 'Content-Type,Authorization',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const health = {
|
|
29
|
+
check: async (acc: RestAccumulator) => {
|
|
30
|
+
const pool = await getPool();
|
|
31
|
+
await pool.query('SELECT 1');
|
|
32
|
+
acc.data.status = 'healthy';
|
|
33
|
+
acc.data.database = 'connected';
|
|
34
|
+
acc.data.timestamp = new Date().toISOString();
|
|
35
|
+
return acc;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const items = {
|
|
40
|
+
list: async (acc: RestAccumulator) => {
|
|
41
|
+
const pool = await getPool();
|
|
42
|
+
const result = await pool.query('SELECT * FROM items');
|
|
43
|
+
acc.data.items = result.rows;
|
|
44
|
+
return acc;
|
|
45
|
+
},
|
|
46
|
+
create: async (acc: RestAccumulator) => {
|
|
47
|
+
const pool = await getPool();
|
|
48
|
+
const { name } = acc.data.valid.body;
|
|
49
|
+
const result = await pool.query('INSERT INTO items (name) VALUES ($1) RETURNING *', [name]);
|
|
50
|
+
acc.data.item = result.rows[0];
|
|
51
|
+
return acc;
|
|
52
|
+
},
|
|
53
|
+
get: async (acc: RestAccumulator) => {
|
|
54
|
+
const pool = await getPool();
|
|
55
|
+
const { id } = acc.data.valid.parameters;
|
|
56
|
+
const result = await pool.query('SELECT * FROM items WHERE id = $1', [id]);
|
|
57
|
+
acc.data.item = result.rows[0] ?? null;
|
|
58
|
+
return acc;
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// Route definitions
|
|
63
|
+
// The router automatically responds with 200 and acc.data as body.
|
|
64
|
+
// Use http.response({ statusCode }) only when overriding (e.g., 201 for POST).
|
|
65
|
+
|
|
66
|
+
router.path('/health').get([health.check]);
|
|
67
|
+
|
|
68
|
+
router.path('/items').get([items.list]);
|
|
69
|
+
|
|
70
|
+
router
|
|
71
|
+
.path('/items')
|
|
72
|
+
.post([validate.body({ name: 'string' }), items.create, http.response({ statusCode: 201 })]);
|
|
73
|
+
|
|
74
|
+
router.path('/items/:id').get([validate.parameters(['id']), items.get]);
|
|
75
|
+
|
|
76
|
+
export const handler = async (event: APIGWV1Payload) => router.routeToPath(event);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{lambdaName}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Lambda function handler with PostgreSQL database access",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "npx tsc",
|
|
8
|
+
"watch": "npx tsc -w"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@phila/philaroute": "^1.0.12",
|
|
12
|
+
"@phila/db-postgres": "^1.0.0",
|
|
13
|
+
"@types/aws-lambda": "^8.10.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"typescript": "^5.3.0"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2022"],
|
|
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
|
+
"outDir": "./dist",
|
|
21
|
+
"rootDir": ".",
|
|
22
|
+
"skipLibCheck": true
|
|
23
|
+
},
|
|
24
|
+
"include": ["*.ts"],
|
|
25
|
+
"exclude": ["node_modules", "dist"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { LambdaPostgresApi, 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 LambdaPostgresApi construct
|
|
41
|
+
new LambdaPostgresApi(stack, '{{appName}}Api', {
|
|
42
|
+
...context,
|
|
43
|
+
apiId: 'main',
|
|
44
|
+
runtime: 'nodejs20',
|
|
45
|
+
handler: 'index.handler',
|
|
46
|
+
codeDir: '../apps/{{lambdaName}}',
|
|
47
|
+
// Uncomment for serverless Aurora instead of provisioned RDS:
|
|
48
|
+
// serverless: true,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Apply compliance checks
|
|
52
|
+
Aspects.of(app).add(new NIST80053R5Checks({ verbose: true }));
|
|
53
|
+
Aspects.of(app).add(new AwsSolutionsChecks({ verbose: true }));
|
|
54
|
+
|
|
55
|
+
app.synth();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "tsc",
|
|
7
|
+
"watch": "tsc -w",
|
|
8
|
+
"cdk": "cdk"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@phila/constructs": "file:{{constructsPath}}",
|
|
12
|
+
"aws-cdk-lib": "^2.100.0",
|
|
13
|
+
"cdk-nag": "^2.28.0",
|
|
14
|
+
"constructs": "^10.0.0",
|
|
15
|
+
"source-map-support": "^0.5.21"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^20.10.0",
|
|
19
|
+
"aws-cdk": "^2.100.0",
|
|
20
|
+
"ts-node": "^10.9.0",
|
|
21
|
+
"typescript": "^5.3.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2022"],
|
|
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
|
+
"outDir": "./dist",
|
|
21
|
+
"rootDir": ".",
|
|
22
|
+
"skipLibCheck": true
|
|
23
|
+
},
|
|
24
|
+
"exclude": ["node_modules", "dist"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{appName}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Lambda API with PostgreSQL database using Philadelphia constructs",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "npm run build --workspaces",
|
|
8
|
+
"test": "npm test --workspaces",
|
|
9
|
+
"synth": "cd cdk && cdk synth",
|
|
10
|
+
"deploy": "cd cdk && cdk deploy",
|
|
11
|
+
"diff": "cd cdk && cdk diff"
|
|
12
|
+
},
|
|
13
|
+
"workspaces": [
|
|
14
|
+
"cdk",
|
|
15
|
+
"apps/*"
|
|
16
|
+
],
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.3.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# {{appName}}
|
|
2
|
+
|
|
3
|
+
Static site application using Philadelphia constructs.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
View the [architecture diagram](https://github.com/CityOfPhiladelphia/phila-ctl/blob/main/packages/constructs/docs/diagrams/static-site.drawio) in draw.io or VS Code with the Draw.io extension.
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Prerequisites
|
|
14
|
+
|
|
15
|
+
- Node.js 20+
|
|
16
|
+
- AWS CLI configured with SSO
|
|
17
|
+
- AWS profiles configured for each environment (see city.config.json)
|
|
18
|
+
|
|
19
|
+
### Setup
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Install dependencies
|
|
23
|
+
npm install
|
|
24
|
+
|
|
25
|
+
# Set up frontend (replace placeholder with Nuxt)
|
|
26
|
+
cd frontend
|
|
27
|
+
npx nuxi@latest init .
|
|
28
|
+
# Configure nuxt.config.ts for SSG
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Deployment
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Deploy infrastructure to dev
|
|
35
|
+
city deploy dev
|
|
36
|
+
|
|
37
|
+
# Ship frontend updates
|
|
38
|
+
city ship dev --web
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Project Structure
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
.
|
|
45
|
+
├── cdk/ # CDK infrastructure code
|
|
46
|
+
│ └── app.ts # StaticSite construct
|
|
47
|
+
├── frontend/ # Nuxt application
|
|
48
|
+
│ └── ... # Replace with Nuxt project
|
|
49
|
+
└── city.config.json # City CLI configuration
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Resources Created
|
|
53
|
+
|
|
54
|
+
This application creates:
|
|
55
|
+
- **S3 Bucket** - Static asset storage
|
|
56
|
+
- **CloudFront Distribution** - Global CDN
|
|
57
|
+
- **Origin Access Control** - Secure S3 access
|
|
58
|
+
- **SSM Parameters** - URL, distribution ID, bucket name
|
|
59
|
+
|
|
60
|
+
## Shipping Updates
|
|
61
|
+
|
|
62
|
+
After the initial `city deploy`, use `city ship --web` for fast frontend updates:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Build and deploy frontend
|
|
66
|
+
city ship dev --web
|
|
67
|
+
|
|
68
|
+
# Deploy to production
|
|
69
|
+
city ship prod --web
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This syncs files to S3 and invalidates CloudFront cache.
|
|
@@ -0,0 +1,50 @@
|
|
|
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, 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
|
|
41
|
+
new StaticSite(stack, '{{appName}}Site', {
|
|
42
|
+
...context,
|
|
43
|
+
assetDir: '../frontend/dist',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Apply compliance checks
|
|
47
|
+
Aspects.of(app).add(new NIST80053R5Checks({ verbose: true }));
|
|
48
|
+
Aspects.of(app).add(new AwsSolutionsChecks({ verbose: true }));
|
|
49
|
+
|
|
50
|
+
app.synth();
|