# ronitsachdev/cdk-serverless-template architecture

> Architecture diagram of the GitHub repository ronitsachdev/cdk-serverless-template, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ronitsachdev/cdk-serverless-template
- Repository: https://github.com/ronitsachdev/cdk-serverless-template

## Overview

This repository is an AWS CDK template that turns application configuration into a deployable serverless web-app stack. The principal workflow is: a developer supplies context/configuration, the CDK entry point creates the stack, and the stack provisions API, data, and static-content resources; API Gateway dispatches requests to inline Lambda handlers, while optional monitoring observes API and Lambda metrics. The README documents DynamoDB or Aurora, S3/CloudFront, security, and monitoring. The sampled handlers return demonstration responses rather than implementing database operations, so no runtime Lambda-to-database data flow is shown.

Main entry points: [`lib/constructs/database-construct.ts`](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/database-construct.ts) (Database Construct), [`lib/serverless-webapp-stack.ts`](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/serverless-webapp-stack.ts) (Web App Stack), [`lib/constructs/api-construct.ts`](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/api-construct.ts) (API Construct), [`lib/constructs/s3-construct.ts`](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/s3-construct.ts) (Static Asset Construct)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Configuration and Stack"]
  node_config["App Configuration<br/>[app-config.ts]"]
  node_app["CDK Entry Point<br/>[app.ts]"]
  node_stack["Web App Stack"]
end

subgraph group_api["API Runtime"]
  node_api_construct["API Construct<br/>[api-construct.ts]"]
  node_gateway["API Gateway<br/>[api-construct.ts]"]
  node_lambda_role["Lambda Execution Role<br/>[api-construct.ts]"]
  node_handlers["Lambda Handlers<br/>[api-construct.ts]"]
end

subgraph group_data["Database Options"]
  node_database_construct["Database Construct"]
  node_dynamodb[("DynamoDB Tables")]
  node_aurora[("Aurora Cluster")]
  node_aurora_secret[("Credentials Secret")]
  node_vpc["Aurora VPC"]
end

subgraph group_webops["Web and Monitoring"]
  node_s3_construct["Static Asset Construct<br/>[s3-construct.ts]"]
  node_bucket[("Asset Bucket<br/>[s3-construct.ts]")]
  node_cloudfront["CloudFront Distribution<br/>[s3-construct.ts]"]
  node_site_files["Sample Site Files<br/>[s3-construct.ts]"]
  node_monitoring["Monitoring Construct"]
  node_dashboard["CloudWatch Dashboard"]
end

node_developer(("Application Developer"))

node_developer -->|"edits settings"| node_config
node_config -->|"provides defaults"| node_app
node_developer -->|"starts deployment"| node_app
node_app -->|"instantiates"| node_stack
node_stack -->|"creates"| node_database_construct
node_stack -->|"creates"| node_api_construct
node_stack -->|"creates"| node_s3_construct
node_stack -.->|"optionally creates"| node_monitoring
node_database_construct -->|"creates tables"| node_dynamodb
node_database_construct -->|"creates for Aurora"| node_vpc
node_database_construct -->|"creates credentials"| node_aurora_secret
node_database_construct -->|"creates cluster"| node_aurora
node_aurora_secret -->|"supplies credentials"| node_aurora
node_vpc -->|"hosts cluster"| node_aurora
node_api_construct -->|"creates routes"| node_gateway
node_api_construct -->|"creates role"| node_lambda_role
node_api_construct -->|"creates functions"| node_handlers
node_api_construct -->|"grants database access"| node_database_construct
node_gateway -->|"dispatches requests"| node_handlers
node_s3_construct -->|"creates bucket"| node_bucket
node_s3_construct -.->|"optionally creates"| node_cloudfront
node_s3_construct -->|"defines sample content"| node_site_files
node_site_files -->|"deploys content"| node_bucket
node_cloudfront -->|"serves objects"| node_bucket
node_monitoring -->|"creates dashboard"| node_dashboard
node_monitoring -->|"adds API metrics"| node_gateway
node_monitoring -->|"adds Lambda metrics"| node_handlers

click node_config "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/config/app-config.ts"
click node_app "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/bin/app.ts"
click node_stack "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/serverless-webapp-stack.ts"
click node_database_construct "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/database-construct.ts"
click node_dynamodb "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/database-construct.ts"
click node_aurora "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/database-construct.ts"
click node_aurora_secret "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/database-construct.ts"
click node_vpc "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/database-construct.ts"
click node_api_construct "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/api-construct.ts"
click node_gateway "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/api-construct.ts"
click node_lambda_role "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/api-construct.ts"
click node_handlers "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/api-construct.ts"
click node_s3_construct "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/s3-construct.ts"
click node_bucket "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/s3-construct.ts"
click node_cloudfront "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/s3-construct.ts"
click node_site_files "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/s3-construct.ts"
click node_monitoring "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/monitoring-construct.ts"
click node_dashboard "https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/monitoring-construct.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_config,node_app,node_stack toneBlue
class node_api_construct,node_gateway,node_lambda_role,node_handlers toneAmber
class node_database_construct,node_dynamodb,node_aurora,node_aurora_secret,node_vpc toneMint
class node_s3_construct,node_bucket,node_cloudfront,node_site_files,node_monitoring,node_dashboard toneRose
class node_developer toneIndigo
```

## Components

### Configuration and Stack

- [App Configuration](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/config/app-config.ts): `config/app-config.ts`
- [CDK Entry Point](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/bin/app.ts): `bin/app.ts`
- [Web App Stack](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/serverless-webapp-stack.ts): `lib/serverless-webapp-stack.ts`

### API Runtime

- [API Construct](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/api-construct.ts): `lib/constructs/api-construct.ts`
- [API Gateway](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/api-construct.ts): `lib/constructs/api-construct.ts`
- [Lambda Execution Role](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/api-construct.ts): `lib/constructs/api-construct.ts`
- [Lambda Handlers](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/api-construct.ts): `lib/constructs/api-construct.ts`

### Database Options

- [Database Construct](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/database-construct.ts): `lib/constructs/database-construct.ts`
- [DynamoDB Tables](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/database-construct.ts): `lib/constructs/database-construct.ts`
- [Aurora Cluster](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/database-construct.ts): `lib/constructs/database-construct.ts`
- [Credentials Secret](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/database-construct.ts): `lib/constructs/database-construct.ts`
- [Aurora VPC](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/database-construct.ts): `lib/constructs/database-construct.ts`

### Web and Monitoring

- [Static Asset Construct](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/s3-construct.ts): `lib/constructs/s3-construct.ts`
- [Asset Bucket](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/s3-construct.ts): `lib/constructs/s3-construct.ts`
- [CloudFront Distribution](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/s3-construct.ts): `lib/constructs/s3-construct.ts`
- [Sample Site Files](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/s3-construct.ts): `lib/constructs/s3-construct.ts`
- [Monitoring Construct](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/monitoring-construct.ts): `lib/constructs/monitoring-construct.ts`
- [CloudWatch Dashboard](https://github.com/ronitsachdev/cdk-serverless-template/blob/main/lib/constructs/monitoring-construct.ts): `lib/constructs/monitoring-construct.ts`

### Other components

- **Application Developer**

## Connections

- Application Developer → App Configuration: edits settings
- App Configuration → CDK Entry Point: provides defaults
- Application Developer → CDK Entry Point: starts deployment
- CDK Entry Point → Web App Stack: instantiates
- Web App Stack → Database Construct: creates
- Web App Stack → API Construct: creates
- Web App Stack → Static Asset Construct: creates
- Web App Stack → Monitoring Construct: optionally creates
- Database Construct → DynamoDB Tables: creates tables
- Database Construct → Aurora VPC: creates for Aurora
- Database Construct → Credentials Secret: creates credentials
- Database Construct → Aurora Cluster: creates cluster
- Credentials Secret → Aurora Cluster: supplies credentials
- Aurora VPC → Aurora Cluster: hosts cluster
- API Construct → API Gateway: creates routes
- API Construct → Lambda Execution Role: creates role
- API Construct → Lambda Handlers: creates functions
- API Construct → Database Construct: grants database access
- API Gateway → Lambda Handlers: dispatches requests
- Static Asset Construct → Asset Bucket: creates bucket
- Static Asset Construct → CloudFront Distribution: optionally creates
- Static Asset Construct → Sample Site Files: defines sample content
- Sample Site Files → Asset Bucket: deploys content
- CloudFront Distribution → Asset Bucket: serves objects
- Monitoring Construct → CloudWatch Dashboard: creates dashboard
- Monitoring Construct → API Gateway: adds API metrics
- Monitoring Construct → Lambda Handlers: adds Lambda metrics
