@thunder-so/thunder 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/.agents/CLI.md +0 -65
- package/.agents/METADATA.md +0 -75
- package/.agents/PRD.md +0 -537
- package/.agents/SKILLS.md +0 -543
- package/thunder-so-thunder-1.1.0.tgz +0 -0
package/package.json
CHANGED
package/.agents/CLI.md
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# Thunder CLI Scope
|
|
2
|
-
|
|
3
|
-
The Thunder CLI (`th`) is the primary interface for developing, deploying, and managing applications built with `@thunder-so/thunder`. It is designed to be a thin, context-aware wrapper around the AWS CDK, providing a developer experience similar to SST but tailored for the Thunder ecosystem.
|
|
4
|
-
|
|
5
|
-
## Core Mandates
|
|
6
|
-
|
|
7
|
-
1. **Context-Awareness:** [x] **DONE**: The CLI automatically detects the current environment, application, and service from the repository structure or configuration, minimizing repetitive flag usage.
|
|
8
|
-
2. **Zero-Config Defaults:** [x] **DONE**: "It just works" out of the box with sensible defaults for AWS regions, accounts, and resource sizing.
|
|
9
|
-
3. **Local Dev Parity:** [ ] **TODO**: Enables a local development loop that closely mirrors production, including live Lambda iteration (future scope) and local emulation of static sites.
|
|
10
|
-
|
|
11
|
-
## Command Reference
|
|
12
|
-
|
|
13
|
-
### `th init`
|
|
14
|
-
- [ ] **TODO**: Scaffolds a new Thunder project or adds a new service to an existing monorepo.
|
|
15
|
-
|
|
16
|
-
- **Usage:** `th init [template] [name]`
|
|
17
|
-
- **Features:**
|
|
18
|
-
- Detects if running in an existing workspace (monorepo).
|
|
19
|
-
- Prompts for project type: `static`, `lambda`, `fargate`, `nuxt`, `astro`, `ec2`, `template`.
|
|
20
|
-
- Generates `thunder.config.ts` (or updates it).
|
|
21
|
-
- Creates necessary `bin/*.ts` entry points.
|
|
22
|
-
- Sets up `.gitignore` and `package.json` scripts.
|
|
23
|
-
|
|
24
|
-
### `th deploy`
|
|
25
|
-
- [ ] **TODO**: Deploys the application to AWS.
|
|
26
|
-
|
|
27
|
-
- **Usage:** `th deploy [--stage <stage>] [--filter <service>]`
|
|
28
|
-
- **Features:**
|
|
29
|
-
- **Stage Management:** defaults to `dev` for local, but supports `prod`, `staging`, `pr-*`.
|
|
30
|
-
- **Context-Driven:** [x] **DONE**: Reads `bin/*.ts` files to determine which stacks to deploy.
|
|
31
|
-
- **Metadata Push:** [x] **DONE**: Updates the `thunder-discovery` bucket with new resource ARNs and endpoints after successful deployment.
|
|
32
|
-
- **Output:** Prints critical URLs (CloudFront, API Gateway, ALB) to the console.
|
|
33
|
-
|
|
34
|
-
### `th destroy`
|
|
35
|
-
- [ ] **TODO**: Tears down resources.
|
|
36
|
-
|
|
37
|
-
- **Usage:** `th remove [--stage <stage>] [--filter <service>]`
|
|
38
|
-
- **Features:**
|
|
39
|
-
- **Safety Checks:** Prompts for confirmation, especially for `prod` stages or stateful resources (RDS, S3).
|
|
40
|
-
- **Metadata Cleanup:** Removes entries from the `thunder-discovery` bucket.
|
|
41
|
-
|
|
42
|
-
## Implementation Details
|
|
43
|
-
|
|
44
|
-
### Context Resolution (`bin/*.ts`)
|
|
45
|
-
- [x] **DONE**: The CLI relies on the convention of `bin/<type>.ts` files.
|
|
46
|
-
- `th deploy` scans `bin/` directory.
|
|
47
|
-
- It executes these scripts using `ts-node` or `tsx`.
|
|
48
|
-
- The scripts instantiate the Stacks (e.g., `NuxtStack`, `FargateStack`).
|
|
49
|
-
- The CLI injects context (app, env, service, account, region) via environment variables or context context keys.
|
|
50
|
-
|
|
51
|
-
### CLI Architecture
|
|
52
|
-
- [ ] **TODO**:
|
|
53
|
-
- **Runtime:** Node.js
|
|
54
|
-
- **Core Libs:** `aws-cdk` (programmatic), `aws-sdk` (v3), `inquirer` (prompts), `commander` (args), `ink` (TUI).
|
|
55
|
-
- **Build:** `esbuild` for fast bundling of Lambda code during `th dev`.
|
|
56
|
-
|
|
57
|
-
## Comparison with SST
|
|
58
|
-
|
|
59
|
-
| Feature | SST CLI | Thunder CLI |
|
|
60
|
-
| :--- | :--- | :--- |
|
|
61
|
-
| **Engine** | Pulumi / Terraform (v3) | AWS CDK (Native) |
|
|
62
|
-
| **Language** | TypeScript / Python / Go | TypeScript (Strict) |
|
|
63
|
-
| **State** | Cloud State Backend | CloudFormation + S3 Metadata |
|
|
64
|
-
| **Local Dev** | Live Lambda (Multiplexing) | Hotswap + Local Framework Server |
|
|
65
|
-
| **Constructs** | Broad (150+ providers) | Focused (AWS Web patterns) |
|
package/.agents/METADATA.md
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# Metadata Discovery
|
|
2
|
-
|
|
3
|
-
Thunder implements an "SST-style" discovery mechanism to enable the Thunder CLI and potential future Thunder Console to automatically identify and interact with deployed resources without relying on manual tagging or complex CloudFormation stack queries.
|
|
4
|
-
|
|
5
|
-
## How Thunder Tags Deployments
|
|
6
|
-
|
|
7
|
-
- [x] **DONE**: Thunder uses a state-based approach rather than traditional AWS resource tags for discovery.
|
|
8
|
-
|
|
9
|
-
### State Storage
|
|
10
|
-
When you deploy a Thunder service, it automatically stores its deployment state in a centralized S3 bucket named `thunder-discovery-<account>-<region>`.
|
|
11
|
-
|
|
12
|
-
### Key Structure
|
|
13
|
-
Metadata files are stored with the following hierarchy:
|
|
14
|
-
`apps/<application>/<environment>/<service>/metadata.json`
|
|
15
|
-
|
|
16
|
-
### Metadata Content
|
|
17
|
-
The `metadata.json` file contains a standardized set of properties that align with the service's `CfnOutput` names:
|
|
18
|
-
```json
|
|
19
|
-
{
|
|
20
|
-
"id": "myapp-prod-web",
|
|
21
|
-
"application": "myapp",
|
|
22
|
-
"service": "web",
|
|
23
|
-
"environment": "prod",
|
|
24
|
-
"region": "us-east-1",
|
|
25
|
-
"timestamp": "2026-03-04T12:00:00.000Z",
|
|
26
|
-
"type": "Nuxt",
|
|
27
|
-
"DistributionId": "E1234567890",
|
|
28
|
-
"DistributionUrl": "https://d123.cloudfront.net",
|
|
29
|
-
"Route53Domain": "https://myapp.com",
|
|
30
|
-
"CodePipelineName": "myapp-prod-web-pipeline"
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## How the CLI/Console Discovers Apps
|
|
35
|
-
|
|
36
|
-
1. **Bucket Resolution**: The tool determines the discovery bucket name based on the current AWS account and region.
|
|
37
|
-
2. **S3 Scanning**: It lists the objects in the bucket under the `apps/` prefix.
|
|
38
|
-
3. **Metadata Parsing**: It reads the `metadata.json` files to discover:
|
|
39
|
-
- All deployed Thunder apps.
|
|
40
|
-
- Their environments/stages.
|
|
41
|
-
- Their individual services and associated resource IDs/URLs.
|
|
42
|
-
4. **Automatic Discovery**: Because the `DiscoveryConstruct` is embedded in every Thunder stack, new services and updates are automatically reflected in S3 upon successful deployment.
|
|
43
|
-
|
|
44
|
-
## Implementation Details
|
|
45
|
-
|
|
46
|
-
- [x] **DONE**: **`DiscoveryConstruct`**: A shared construct located in `lib/constructs/discovery.ts`.
|
|
47
|
-
- [x] **DONE**: **`BucketDeployment`**: Uses `aws-s3-deployment` to upload `Source.jsonData` during the CDK deployment phase.
|
|
48
|
-
- [x] **DONE**: **Standardization**: Metadata field names are strictly aligned with `CfnOutput` logical IDs (e.g., `DistributionId`, `ServiceUrl`).
|
|
49
|
-
- [x] **DONE**: Each deployment stores its metadata in a centralized S3 bucket (`thunder-discovery-<account>-<region>`).
|
|
50
|
-
|
|
51
|
-
Metadata includes:
|
|
52
|
-
- [x] App identity (application, service, environment)
|
|
53
|
-
- [x] Resource ARNs, IDs and URLs (Aligned with `CfnOutput` names)
|
|
54
|
-
- [x] Deployment timestamps
|
|
55
|
-
- [x] Framework-specific metadata
|
|
56
|
-
- [x] Route53 domain integration
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## ISSUES:
|
|
60
|
-
|
|
61
|
-
7:11:10 PM | CREATE_FAILED | Custom::CDKBucketDeployment | Discovery/StoreMet...omResource/Default
|
|
62
|
-
Received response status [FAILED] from custom resource. Message returned: Command '['/opt/awscli/aws', 's3', 'sync', '/tmp/tmpxgahyp87/contents', 's3://thunder-discovery-047719662375-us-east
|
|
63
|
-
-1/apps/nuxt3/dev/fargate']' returned non-zero exit status 1. (RequestId: afc6bb52-d373-4b97-9a7d-36d0ab9b9425)
|
|
64
|
-
7:11:10 PM | ROLLBACK_IN_PROGRESS | AWS::CloudFormation::Stack | nuxt3-fargate-dev-stack
|
|
65
|
-
The following resource(s) failed to create: [DiscoveryStoreMetadataCustomResource5F6695DB, FargateFargateService7449B65B]. Rollback requested by user.
|
|
66
|
-
7:11:10 PM | ROLLBACK_IN_PROGRESS | AWS::CloudFormation::Stack | nuxt3-fargate-dev-stack
|
|
67
|
-
The following resource(s) failed to create: [DiscoveryStoreMetadataCustomResource5F6695DB, FargateFargateService7449B65B]. Rollback requested by user.
|
|
68
|
-
7:11:37 PM | DELETE_FAILED | Custom::CDKBucketDeployment | Discovery/StoreMet...omResource/Default
|
|
69
|
-
Received response status [FAILED] from custom resource. Message returned: Command '['/opt/awscli/aws', 's3', 'rm', 's3://thunder-discovery-047719662375-us-east-1/apps/nuxt3/dev/fargate', '--
|
|
70
|
-
recursive']' returned non-zero exit status 1. (RequestId: f9383113-0976-4fe3-af60-bcefbf14d514)
|
|
71
|
-
|
|
72
|
-
❌ nuxt3-fargate-dev-stack failed: ToolkitError: The stack named nuxt3-fargate-dev-stack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_FAILED (The following resource(s) failed to delete: [DiscoveryStoreMetadataCustomResource5F6695DB]. ): Received response status [FAILED] from custom resource. Message returned: Command '['/opt/awscli/aws', 's3', 'sync', '/tmp/tmpxgahyp87/contents', 's3://thunder-discovery-047719662375-us-east-1/apps/nuxt3/dev/fargate']' returned non-zero exit status 1. (RequestId: afc6bb52-d373-4b97-9a7d-36d0ab9b9425), Received response status [FAILED] from custom resource. Message returned: Command '['/opt/awscli/aws', 's3', 'rm', 's3://thunder-discovery-047719662375-us-east-1/apps/nuxt3/dev/fargate', '--recursive']' returned non-zero exit status 1. (RequestId: f9383113-0976-4fe3-af60-bcefbf14d514)
|
|
73
|
-
|
|
74
|
-
The following resource(s) failed to delete: [DiscoveryStoreMetadataCustomResource5F6695DB].
|
|
75
|
-
Received response status [FAILED] from custom resource. Message returned: Command '['/opt/awscli/aws', 's3', 'rm', 's3://thunder-discovery-047719662375-us-east-1/apps/nuxt3/dev/fargate', '--recursive']' returned non-zero exit status 1. (RequestId: f9383113-0976-4fe3-af60-bcefbf14d514)
|
package/.agents/PRD.md
DELETED
|
@@ -1,537 +0,0 @@
|
|
|
1
|
-
# Thunder - CDK Library for AWS Deployments
|
|
2
|
-
|
|
3
|
-
## Executive Summary
|
|
4
|
-
|
|
5
|
-
Thunder (`@thunder-so/thunder`) is an AWS CDK library for deploying modern web applications. It provides opinionated, production-ready infrastructure patterns for one-line deployment of common web application architectures.
|
|
6
|
-
|
|
7
|
-
**One library to rule them all**: Static SPAs, Lambda Functions, Containers (Fargate/EC2), and Full-stack Frameworks (Nuxt/Astro).
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Project Overview
|
|
12
|
-
|
|
13
|
-
Thunder provides high-level abstractions over AWS CDK, enabling developers to deploy complete infrastructure stacks with minimal configuration. The library covers the full spectrum of web deployment patterns from static sites to full-stack serverless applications.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Stacks
|
|
18
|
-
|
|
19
|
-
| Stack | Description | Use Cases | Status |
|
|
20
|
-
|-----------|-------------|-----------|--------|
|
|
21
|
-
| `Static` | S3 + CloudFront for static SPAs | React, Vue, Svelte, Next.js (SSG), Gatsby | **DONE** |
|
|
22
|
-
| `Lambda` | Lambda + API Gateway for serverless | API endpoints, background jobs, microservices | **DONE** |
|
|
23
|
-
| `Fargate` | ECS Fargate + ALB for containers | Long-running containers, microservices | **DONE** |
|
|
24
|
-
| `EC2` | EC2 instance with Docker + Elastic IP | Single containers, dev environments | **DONE** |
|
|
25
|
-
| `Template` | Coolify One-Click Service Template on EC2 | Pre-built apps (n8n, Plausible, etc.) | **DONE** |
|
|
26
|
-
| `Nuxt` | Full-stack Nuxt.js (Lambda + S3 + CloudFront) | SSR Nuxt applications | **DONE** |
|
|
27
|
-
| `Astro` | Full-stack Astro SSR (with Edge fallback) | SSR Astro applications | **DONE** |
|
|
28
|
-
| `VPC` | Shared VPC with public/private subnets | Shared networking infrastructure | **DONE** |
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Stack Details
|
|
33
|
-
|
|
34
|
-
### 1. Static Stack
|
|
35
|
-
**Purpose**: Static SPA hosting
|
|
36
|
-
**Resources**: S3 + CloudFront (OAC) + Route53 + Lambda@Edge
|
|
37
|
-
**Key Features**:
|
|
38
|
-
- Zero-downtime deployment without bucket pruning
|
|
39
|
-
- Origin Access Control (OAC) for secure S3 access
|
|
40
|
-
- Lambda@Edge for redirects/rewrites
|
|
41
|
-
- Custom security headers policy
|
|
42
|
-
- CI/CD pipeline support
|
|
43
|
-
|
|
44
|
-
**Entry Point**: `bin/static.ts`
|
|
45
|
-
**Stack File**: `stacks/StaticStack.ts`
|
|
46
|
-
**Constructs**:
|
|
47
|
-
- `HostingConstruct` (S3 + CloudFront + Route53)
|
|
48
|
-
- `DeployConstruct` (direct local deployment)
|
|
49
|
-
- `PipelineConstruct` (CodePipeline CI/CD)
|
|
50
|
-
|
|
51
|
-
### 2. Lambda Stack
|
|
52
|
-
**Purpose**: Serverless functions
|
|
53
|
-
**Resources**: Lambda (Zip or Container) + API Gateway v2 + ECR + Route53
|
|
54
|
-
**Key Features**:
|
|
55
|
-
- Bun runtime support via Lambda Layer
|
|
56
|
-
- Keep-warm scheduling (EventBridge)
|
|
57
|
-
- Provisioned concurrency support
|
|
58
|
-
- X-Ray tracing
|
|
59
|
-
- VPC integration
|
|
60
|
-
|
|
61
|
-
**Entry Point**: `bin/lambda.ts`
|
|
62
|
-
**Stack File**: `stacks/LambdaStack.ts`
|
|
63
|
-
**Constructs**:
|
|
64
|
-
- `FunctionsConstruct` (Lambda + API Gateway)
|
|
65
|
-
- `PipelineConstruct` (ECR-based CI/CD)
|
|
66
|
-
|
|
67
|
-
### 3. Fargate Stack
|
|
68
|
-
**Purpose**: Container orchestration
|
|
69
|
-
**Resources**: ECS Fargate + ALB + VPC + ECR + Route53
|
|
70
|
-
**Key Features**:
|
|
71
|
-
- ARM64 or X86_64 architecture support
|
|
72
|
-
- Auto-scaling capabilities
|
|
73
|
-
- Health checks with customizable paths
|
|
74
|
-
- Circuit breaker deployments
|
|
75
|
-
- Nixpacks integration for Dockerfile generation
|
|
76
|
-
- Rolling updates
|
|
77
|
-
|
|
78
|
-
**Entry Point**: `bin/fargate.ts`
|
|
79
|
-
**Stack File**: `stacks/FargateStack.ts`
|
|
80
|
-
**Constructs**:
|
|
81
|
-
- `ServiceConstruct` (ECS service + ALB + VPC)
|
|
82
|
-
- `PipelineConstruct` (ECR-based CI/CD)
|
|
83
|
-
|
|
84
|
-
### 4. EC2 Stack
|
|
85
|
-
**Purpose**: Single EC2 container hosting
|
|
86
|
-
**Resources**: EC2 + Elastic IP + Route53 + CloudWatch Agent
|
|
87
|
-
**Key Features**:
|
|
88
|
-
- Docker-on-EC2 deployment
|
|
89
|
-
- Elastic IP assignment
|
|
90
|
-
- Let's Encrypt SSL (via acmeEmail)
|
|
91
|
-
- SSH access with authorized keys
|
|
92
|
-
- CloudWatch monitoring
|
|
93
|
-
- Nixpacks support
|
|
94
|
-
|
|
95
|
-
**Entry Point**: `bin/ec2.ts`
|
|
96
|
-
**Stack File**: `stacks/Ec2Stack.ts`
|
|
97
|
-
**Constructs**:
|
|
98
|
-
- `ComputeConstruct` (EC2 instance + Docker)
|
|
99
|
-
- `PipelineConstruct` (CI/CD)
|
|
100
|
-
- `Ec2Instance` (instance provisioning)
|
|
101
|
-
- `UserData` (EC2 bootstrap scripts)
|
|
102
|
-
- `CloudwatchAgent` (monitoring)
|
|
103
|
-
|
|
104
|
-
### 5. Template Stack
|
|
105
|
-
**Purpose**: Coolify one-click templates
|
|
106
|
-
**Resources**: EC2 + Docker Compose + Traefik
|
|
107
|
-
**Key Features**:
|
|
108
|
-
- Fetches templates from Coolify GitHub repo
|
|
109
|
-
- Hydrates SERVICE_FQDN, SERVICE_PASSWORD variables
|
|
110
|
-
- Traefik reverse proxy with Let's Encrypt
|
|
111
|
-
- Multi-service Docker Compose support
|
|
112
|
-
|
|
113
|
-
**Entry Point**: `bin/template.ts`
|
|
114
|
-
**Stack File**: `stacks/TemplateStack.ts`
|
|
115
|
-
**Constructs**:
|
|
116
|
-
- `TemplateConstruct` (template deployment)
|
|
117
|
-
- `TemplateFetcher` (fetches from GitHub)
|
|
118
|
-
- `TemplateHydrator` (variable substitution)
|
|
119
|
-
|
|
120
|
-
### 6. Nuxt Stack
|
|
121
|
-
**Purpose**: Full-stack Nuxt.js deployment
|
|
122
|
-
**Resources**: Lambda (SSR) + S3 (Assets) + CloudFront (Dual Origin) + API Gateway
|
|
123
|
-
**Key Features**:
|
|
124
|
-
- Nitro preset optimized for AWS Lambda
|
|
125
|
-
- Static assets served from S3
|
|
126
|
-
- SSR via Lambda function
|
|
127
|
-
- API routes support
|
|
128
|
-
- Unified CloudFront distribution
|
|
129
|
-
|
|
130
|
-
**Entry Point**: `bin/nuxt.ts`
|
|
131
|
-
**Stack File**: `stacks/NuxtStack.ts`
|
|
132
|
-
**Constructs**:
|
|
133
|
-
- `NuxtConstruct` (SSR server + client)
|
|
134
|
-
- `ServerConstruct` (Lambda SSR)
|
|
135
|
-
- `ClientConstruct` (S3 + CloudFront)
|
|
136
|
-
- `FrameworkPipeline` (CI/CD)
|
|
137
|
-
|
|
138
|
-
### 7. Astro Stack
|
|
139
|
-
**Purpose**: Full-stack Astro SSR deployment
|
|
140
|
-
**Resources**: Lambda (SSR) + S3 + CloudFront + Edge Function fallback
|
|
141
|
-
**Key Features**:
|
|
142
|
-
- Same architecture as Nuxt (Lambda + S3 + CloudFront)
|
|
143
|
-
- Lambda@Edge fallback for 404/403 handling
|
|
144
|
-
- Edge-optimized for global distribution
|
|
145
|
-
- Astro-specific optimizations
|
|
146
|
-
|
|
147
|
-
**Entry Point**: `bin/astro.ts`
|
|
148
|
-
**Stack File**: `stacks/AstroStack.ts`
|
|
149
|
-
**Constructs**:
|
|
150
|
-
- `AstroConstruct` (SSR server + client)
|
|
151
|
-
- `ClientConstruct` (S3 + CloudFront + Edge fallback)
|
|
152
|
-
- `FrameworkPipeline` (CI/CD)
|
|
153
|
-
|
|
154
|
-
### 8. VPC Stack
|
|
155
|
-
**Purpose**: Shared VPC infrastructure
|
|
156
|
-
**Resources**: VPC with public/private subnets, NAT gateways
|
|
157
|
-
**Key Features**:
|
|
158
|
-
- Shared networking for multiple services
|
|
159
|
-
- Implements IVpcLink interface
|
|
160
|
-
- Configurable CIDR, AZs, NAT gateways
|
|
161
|
-
- Can be linked to other stacks
|
|
162
|
-
|
|
163
|
-
**Entry Point**: `bin/vpc.ts`
|
|
164
|
-
**Stack File**: `stacks/VpcStack.ts`
|
|
165
|
-
**Constructs**:
|
|
166
|
-
- `VPC` (shared VPC construct)
|
|
167
|
-
|
|
168
|
-
---
|
|
169
|
-
|
|
170
|
-
## Architecture
|
|
171
|
-
|
|
172
|
-
### Project Structure
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
@thunder-so/thunder/
|
|
176
|
-
├── bin/ # CDK entry points
|
|
177
|
-
│ ├── static.ts # Static SPA deployment
|
|
178
|
-
│ ├── lambda.ts # Lambda deployment
|
|
179
|
-
│ ├── fargate.ts # Fargate deployment
|
|
180
|
-
│ ├── ec2.ts # EC2 deployment
|
|
181
|
-
│ ├── template.ts # Coolify template deployment
|
|
182
|
-
│ ├── nuxt.ts # Nuxt deployment
|
|
183
|
-
│ ├── astro.ts # Astro deployment
|
|
184
|
-
│ └── vpc.ts # VPC deployment
|
|
185
|
-
│
|
|
186
|
-
├── cli/ # Thunder CLI
|
|
187
|
-
│ ├── th.mjs # Main CLI entry
|
|
188
|
-
│ ├── th-init.mjs # Init command
|
|
189
|
-
│ ├── th-deploy.mjs # Deploy command
|
|
190
|
-
│ └── th-destroy.mjs # Destroy command
|
|
191
|
-
│
|
|
192
|
-
├── lib/ # CDK constructs
|
|
193
|
-
│ ├── astro/ # Astro framework support
|
|
194
|
-
│ │ ├── index.ts # AstroConstruct
|
|
195
|
-
│ │ └── client.ts # Astro client (S3 + CloudFront + Edge)
|
|
196
|
-
│ │
|
|
197
|
-
│ ├── constructs/ # Shared constructs
|
|
198
|
-
│ │ ├── vpc.ts # VPC construct
|
|
199
|
-
│ │ └── discovery.ts # SST-style metadata discovery
|
|
200
|
-
│ │
|
|
201
|
-
│ ├── ec2/ # EC2 implementation
|
|
202
|
-
│ │ ├── compute.ts # EC2 compute
|
|
203
|
-
│ │ ├── pipeline.ts # EC2 pipeline
|
|
204
|
-
│ │ └── constructs/
|
|
205
|
-
│ │ ├── cloudwatch-agent.ts
|
|
206
|
-
│ │ ├── ec2-instance.ts
|
|
207
|
-
│ │ └── user-data.ts
|
|
208
|
-
│ │
|
|
209
|
-
│ ├── fargate/ # Fargate implementation
|
|
210
|
-
│ │ ├── service.ts # ECS Fargate service
|
|
211
|
-
│ │ └── pipeline.ts # Fargate pipeline
|
|
212
|
-
│ │
|
|
213
|
-
│ ├── frameworks/ # Framework pipeline
|
|
214
|
-
│ │ └── pipeline.ts # Shared framework CI/CD
|
|
215
|
-
│ │
|
|
216
|
-
│ ├── lambda/ # Lambda implementation
|
|
217
|
-
│ │ ├── functions.ts # Lambda + API Gateway
|
|
218
|
-
│ │ └── pipeline.ts # Lambda pipeline
|
|
219
|
-
│ │
|
|
220
|
-
│ ├── nuxt/ # Nuxt implementation
|
|
221
|
-
│ │ ├── index.ts # NuxtConstruct
|
|
222
|
-
│ │ ├── server.ts # Nuxt server (Lambda)
|
|
223
|
-
│ │ └── client.ts # Nuxt client (S3 + CloudFront)
|
|
224
|
-
│ │
|
|
225
|
-
│ ├── static/ # Static implementation
|
|
226
|
-
│ │ ├── hosting.ts # S3 + CloudFront + Route53
|
|
227
|
-
│ │ ├── pipeline.ts # Static CI/CD
|
|
228
|
-
│ │ └── deploy.ts # Direct S3 deployment
|
|
229
|
-
│ │
|
|
230
|
-
│ ├── template/ # Coolify template implementation
|
|
231
|
-
│ │ ├── index.ts # TemplateConstruct
|
|
232
|
-
│ │ ├── template/
|
|
233
|
-
│ │ │ ├── fetch.ts # Fetch from GitHub
|
|
234
|
-
│ │ │ └── hydrate.ts # Variable hydration
|
|
235
|
-
│ │ └── constructs/
|
|
236
|
-
│ │ ├── cloudwatch-agent.ts
|
|
237
|
-
│ │ ├── ec2-instance.ts
|
|
238
|
-
│ │ └── user-data.ts
|
|
239
|
-
│ │
|
|
240
|
-
│ └── utils/ # Shared utilities
|
|
241
|
-
│ ├── index.ts # Main exports
|
|
242
|
-
│ ├── naming.ts # Resource naming
|
|
243
|
-
│ ├── paths.ts # Path sanitization
|
|
244
|
-
│ ├── nixpacks.ts # Nixpacks integration
|
|
245
|
-
│ └── vpc-link.ts # VPC linking
|
|
246
|
-
│
|
|
247
|
-
├── stacks/ # Stack definitions
|
|
248
|
-
│ ├── StaticStack.ts
|
|
249
|
-
│ ├── LambdaStack.ts
|
|
250
|
-
│ ├── FargateStack.ts
|
|
251
|
-
│ ├── Ec2Stack.ts
|
|
252
|
-
│ ├── TemplateStack.ts
|
|
253
|
-
│ ├── NuxtStack.ts
|
|
254
|
-
│ ├── AstroStack.ts
|
|
255
|
-
│ └── VpcStack.ts
|
|
256
|
-
│
|
|
257
|
-
├── types/ # TypeScript interfaces
|
|
258
|
-
│ ├── AppProps.ts # Base props
|
|
259
|
-
│ ├── StaticProps.ts
|
|
260
|
-
│ ├── LambdaProps.ts
|
|
261
|
-
│ ├── FargateProps.ts
|
|
262
|
-
│ ├── Ec2Props.ts
|
|
263
|
-
│ ├── TemplateProps.ts
|
|
264
|
-
│ ├── NuxtProps.ts
|
|
265
|
-
│ ├── VpcProps.ts
|
|
266
|
-
│ ├── CloudFrontProps.ts
|
|
267
|
-
│ └── PipelineProps.ts
|
|
268
|
-
│
|
|
269
|
-
├── .agents/ # Documentation
|
|
270
|
-
│ ├── PRD.md # This file
|
|
271
|
-
│ ├── CLI.md # CLI scope
|
|
272
|
-
│ ├── SKILLS.md # Claude skills plan
|
|
273
|
-
│ └── METADATA.md # Discovery mechanism
|
|
274
|
-
│
|
|
275
|
-
├── index.ts # Main exports
|
|
276
|
-
└── package.json
|
|
277
|
-
```
|
|
278
|
-
---
|
|
279
|
-
|
|
280
|
-
## Shared Infrastructure Patterns
|
|
281
|
-
|
|
282
|
-
### VPC Link Pattern
|
|
283
|
-
All compute stacks (Lambda, Fargate, EC2, Template) support a `link` pattern for VPC integration:
|
|
284
|
-
|
|
285
|
-
- Implemented via `resolveVpc()` utility
|
|
286
|
-
- Accepts `IVpc` directly or `IVpcLink` implementing construct
|
|
287
|
-
- Provides consistent VPC connectivity across stacks
|
|
288
|
-
|
|
289
|
-
```typescript
|
|
290
|
-
// Explicit VPC passing
|
|
291
|
-
const vpc = new VpcStack(this, 'MyVPC', { ... });
|
|
292
|
-
|
|
293
|
-
new FargateStack(this, 'MyService', {
|
|
294
|
-
vpc: vpc,
|
|
295
|
-
// ...
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
// Via link property
|
|
299
|
-
new FargateStack(this, 'MyService', {
|
|
300
|
-
link: vpc, // IVpcLink interface
|
|
301
|
-
// ...
|
|
302
|
-
});
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
### Resource Naming
|
|
306
|
-
**Pattern**: 23-character prefix ensuring uniqueness and AWS name limits
|
|
307
|
-
- **Format**: `${app.substring(0,7)}-${service.substring(0,7)}-${env.substring(0,7)}`
|
|
308
|
-
- **Utility**: `getResourceIdPrefix()` in `lib/utils/naming.ts`
|
|
309
|
-
- **Example**: `myapp-t-web-dev` (app="myapplication", service="webfrontend", env="development")
|
|
310
|
-
|
|
311
|
-
### Path Sanitization
|
|
312
|
-
**Purpose**: Ensure valid Unix directory paths for Docker builds and deployments
|
|
313
|
-
- **Utility**: `sanitizePath()` in `lib/utils/paths.ts`
|
|
314
|
-
- **Regex**: Removes invalid characters, normalizes slashes
|
|
315
|
-
- **Use Case**: User-provided rootDir/outputDir sanitization
|
|
316
|
-
|
|
317
|
-
---
|
|
318
|
-
|
|
319
|
-
## Common Features Across Stacks
|
|
320
|
-
|
|
321
|
-
### 1. Monorepo Support
|
|
322
|
-
- **Path-based filters** in CodeBuild webhooks
|
|
323
|
-
- **rootDir/outputDir** resolution for monorepo packages
|
|
324
|
-
- **Context directory** support for taking source from any path
|
|
325
|
-
|
|
326
|
-
### 2. CI/CD Pipeline Integration
|
|
327
|
-
Optional AWS CodePipeline with GitHub support:
|
|
328
|
-
- Triggered by `accessTokenSecretArn` + `sourceProps` + `buildProps`
|
|
329
|
-
- Path-based filtering for monorepos
|
|
330
|
-
- ECR integration for container stacks
|
|
331
|
-
- S3 deployment for static stacks
|
|
332
|
-
|
|
333
|
-
### 3. Nixpacks Integration
|
|
334
|
-
Automatic Dockerfile generation:
|
|
335
|
-
- **Utility**: `generateNixpacksDockerfile()` in `lib/utils/nixpacks.ts`
|
|
336
|
-
- **Supported**: Fargate, EC2, Template stacks
|
|
337
|
-
- **Build system**: Detects language and generates optimized Dockerfile
|
|
338
|
-
|
|
339
|
-
### 4. Framework Fallbacks
|
|
340
|
-
Astro-specific Edge function for 404/403 handling:
|
|
341
|
-
- Implemented in `lib/astro/client.ts`
|
|
342
|
-
- CloudFront origin failover to S3 for SPA routing
|
|
343
|
-
|
|
344
|
-
### 5. Bun Support
|
|
345
|
-
Bun runtime for Lambda:
|
|
346
|
-
- Lambda Layer integration
|
|
347
|
-
- Custom runtime configuration for CodeBuild
|
|
348
|
-
|
|
349
|
-
---
|
|
350
|
-
|
|
351
|
-
## Thunder CLI
|
|
352
|
-
|
|
353
|
-
**Location**: `cli/th.mjs`
|
|
354
|
-
|
|
355
|
-
The Thunder CLI provides context-aware infrastructure management:
|
|
356
|
-
|
|
357
|
-
### Commands
|
|
358
|
-
|
|
359
|
-
| Command | Description | Status |
|
|
360
|
-
|---------|-------------|--------|
|
|
361
|
-
| `th init` | Scaffold new project/service | [ ] **TODO** |
|
|
362
|
-
| `th deploy` | Deploy stacks to AWS | [ ] **TODO** |
|
|
363
|
-
| `th destroy` | Remove resources from AWS | [ ] **TODO** |
|
|
364
|
-
|
|
365
|
-
### CLI Architecture
|
|
366
|
-
- **Runtime**: Node.js
|
|
367
|
-
- **Core Libraries**: `commander`, `inquirer`, `chalk`, `ora`, `shelljs`
|
|
368
|
-
- **Context Resolution**: Reads `bin/*.ts` files
|
|
369
|
-
- **Environment**: Injects CDK context via environment variables
|
|
370
|
-
|
|
371
|
-
### Context Resolution
|
|
372
|
-
1. CLI scans `bin/` directory for stack entry points
|
|
373
|
-
2. Executes via `ts-node` or `tsx`
|
|
374
|
-
3. Injects context: app, env, service, account, region
|
|
375
|
-
4. Delegates to CDK for actual deployment
|
|
376
|
-
|
|
377
|
-
**Status**: Basic CLI structure done, full implementation pending
|
|
378
|
-
|
|
379
|
-
---
|
|
380
|
-
|
|
381
|
-
## CLI Mandates
|
|
382
|
-
|
|
383
|
-
1. **Context-Awareness**: [x] **DONE** - Auto-detects environment from repository
|
|
384
|
-
2. **Zero-Config Defaults**: [x] **DONE** - Sensible defaults for AWS regions, accounts, resource sizing
|
|
385
|
-
3. **Local Dev Parity**: [ ] **TODO** - Local development loop (future scope)
|
|
386
|
-
4. **SST-Style Metadata**: [x] **DONE** - Discovery bucket for deployment state
|
|
387
|
-
|
|
388
|
-
---
|
|
389
|
-
|
|
390
|
-
## Future Extensibility
|
|
391
|
-
|
|
392
|
-
### Framework Support
|
|
393
|
-
|
|
394
|
-
The library should support additional Vite + Nitro-based frameworks:
|
|
395
|
-
- [ ] TanStack Start
|
|
396
|
-
- [ ] Angular AnalogJS
|
|
397
|
-
- [ ] SvelteKit
|
|
398
|
-
- [ ] React Router v7
|
|
399
|
-
- [ ] SolidStart
|
|
400
|
-
|
|
401
|
-
Each framework construct will have preset configurations optimized for that framework.
|
|
402
|
-
|
|
403
|
-
### Console UI
|
|
404
|
-
|
|
405
|
-
Future scope: SST-style Console UI for:
|
|
406
|
-
- Resource visualization
|
|
407
|
-
- Log streaming
|
|
408
|
-
- Real-time monitoring
|
|
409
|
-
- Deployment history
|
|
410
|
-
|
|
411
|
-
**Prerequisite**: Metadata Discovery system (already implemented)
|
|
412
|
-
|
|
413
|
-
---
|
|
414
|
-
|
|
415
|
-
## Status Overview
|
|
416
|
-
|
|
417
|
-
| Feature | Status | Notes |
|
|
418
|
-
|---------|--------|-------|
|
|
419
|
-
| **Static Stack** | [x] **DONE** | Production-ready |
|
|
420
|
-
| **Lambda Stack** | [x] **DONE** | Production-ready |
|
|
421
|
-
| **Fargate Stack** | [x] **DONE** | Production-ready |
|
|
422
|
-
| **EC2 Stack** | [x] **DONE** | Production-ready |
|
|
423
|
-
| **Template Stack** | [x] **DONE** | Production-ready |
|
|
424
|
-
| **Nuxt Stack** | [x] **DONE** | Production-ready |
|
|
425
|
-
| **Astro Stack** | [x] **DONE** | Production-ready |
|
|
426
|
-
| **VPC Stack** | [x] **DONE** | Production-ready |
|
|
427
|
-
| **VPC Link Pattern** | [x] **DONE** | All compute stacks |
|
|
428
|
-
| **Monorepo Support** | [x] **DONE** | Path filters, rootDir |
|
|
429
|
-
| **Nixpacks Integration** | [x] **DONE** | Auto Dockerfile gen |
|
|
430
|
-
| **Metadata Discovery** | [x] **DONE** | SST-style in S3 |
|
|
431
|
-
| **CI/CD Pipelines** | [x] **DONE** | CodePipeline + GitHub |
|
|
432
|
-
| **Bun Support** | [x] **DONE** | Lambda layer |
|
|
433
|
-
| **CLI Framework** | [x] **DONE** | Basic structure |
|
|
434
|
-
| **th init Command** | [ ] **TODO** | Scaffold projects |
|
|
435
|
-
| **th deploy Command** | [ ] **TODO** | Deploy stacks |
|
|
436
|
-
| **th destroy Command** | [ ] **TODO** | Remove resources |
|
|
437
|
-
| **Console UI** | [ ] **TODO** | Future scope |
|
|
438
|
-
| **Additional Frameworks** | [ ] **TODO** | TanStack, SvelteKit, etc. |
|
|
439
|
-
| **Claude Skills** | [ ] **TODO** | See SKILLS.md |
|
|
440
|
-
|
|
441
|
-
---
|
|
442
|
-
|
|
443
|
-
## Supported Frameworks & Patterns
|
|
444
|
-
|
|
445
|
-
### Static Sites
|
|
446
|
-
- **Vite-based**: React, Vue, Svelte, Solid
|
|
447
|
-
- **Next.js**: Static Site Generation (SSG)
|
|
448
|
-
- **Astro**: Static Site Generation
|
|
449
|
-
- **Gatsby**: Static site generator
|
|
450
|
-
- **Other**: Any framework outputting to a directory
|
|
451
|
-
|
|
452
|
-
### Serverless
|
|
453
|
-
- **Node.js**: Lambda functions
|
|
454
|
-
- **Bun**: Via Lambda Layer
|
|
455
|
-
- **Containers**: Container-based Lambda
|
|
456
|
-
- **Runtimes**: Node.js 18.x, 20.x
|
|
457
|
-
|
|
458
|
-
### Containers
|
|
459
|
-
- **ECS Fargate**: Serverless containers with ALB
|
|
460
|
-
- **EC2 Docker**: Single-container on EC2
|
|
461
|
-
- **Architectures**: ARM64, X86_64
|
|
462
|
-
- **Orchestration**: Supports docker-compose (Template)
|
|
463
|
-
|
|
464
|
-
### Full-Stack SSR
|
|
465
|
-
- **Nuxt.js**: Universal Vue applications
|
|
466
|
-
- **Astro**: Content-focused websites with SSR
|
|
467
|
-
- **Extensible**: TanStack Start, SvelteKit, AnalogJS (planned)
|
|
468
|
-
|
|
469
|
-
---
|
|
470
|
-
|
|
471
|
-
## Key Design Principles
|
|
472
|
-
|
|
473
|
-
1. **One-Line Deployment**: Minimal configuration for common patterns
|
|
474
|
-
2. **Convention over Configuration**: Sensible defaults, customization when needed
|
|
475
|
-
3. **Framework Agnostic**: Works with any framework, optimized for popular ones
|
|
476
|
-
4. **Production Ready**: Security, monitoring, CI/CD included
|
|
477
|
-
5. **Cost Optimized**: Uses most cost-effective AWS services for each pattern
|
|
478
|
-
6. **Developer Experience**: Fast feedback loops, clear errors, helpful defaults
|
|
479
|
-
7. **Composable**: Stacks can be combined for complex architectures
|
|
480
|
-
|
|
481
|
-
---
|
|
482
|
-
|
|
483
|
-
## Quick Start
|
|
484
|
-
|
|
485
|
-
### Installation
|
|
486
|
-
```bash
|
|
487
|
-
bun add @thunder-so/thunder -d
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
### Basic Usage
|
|
491
|
-
```typescript
|
|
492
|
-
// stack/dev.ts
|
|
493
|
-
import { Cdk, Static, type StaticProps } from '@thunder-so/thunder';
|
|
494
|
-
|
|
495
|
-
const myApp: StaticProps = {
|
|
496
|
-
env: {
|
|
497
|
-
account: '123456789012',
|
|
498
|
-
region: 'us-east-1'
|
|
499
|
-
},
|
|
500
|
-
application: 'myapp',
|
|
501
|
-
service: 'web',
|
|
502
|
-
environment: 'prod',
|
|
503
|
-
rootDir: '.',
|
|
504
|
-
outputDir: 'dist',
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
new Static(
|
|
508
|
-
new Cdk.App(),
|
|
509
|
-
`${myApp.application}-${myApp.service}-${myApp.environment}-stack`,
|
|
510
|
-
myApp
|
|
511
|
-
);
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
### Deployment
|
|
515
|
-
```bash
|
|
516
|
-
npx cdk deploy --app "npx tsx stack/dev.ts" --profile default
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
---
|
|
520
|
-
|
|
521
|
-
## Documentation
|
|
522
|
-
|
|
523
|
-
- **This PRD**: Project overview and architecture
|
|
524
|
-
- **CLI.md**: CLI command reference and scope
|
|
525
|
-
- **SKILLS.md**: Claude Code skills implementation plan
|
|
526
|
-
- **METADATA.md**: Discovery/metadata mechanism details
|
|
527
|
-
|
|
528
|
-
---
|
|
529
|
-
|
|
530
|
-
## License
|
|
531
|
-
|
|
532
|
-
Apache-2.0
|
|
533
|
-
|
|
534
|
-
---
|
|
535
|
-
|
|
536
|
-
**Last Updated**: 2026-03-08
|
|
537
|
-
**Status**: Production-ready stacks, CLI implementation in progress
|
package/.agents/SKILLS.md
DELETED
|
@@ -1,543 +0,0 @@
|
|
|
1
|
-
# Claude Skills Implementation Plan for Thunder
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This document outlines the comprehensive plan for implementing Claude Code skills in the Thunder AWS CDK library to enable intelligent stack selection and configuration generation.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Current State Analysis
|
|
10
|
-
|
|
11
|
-
### Project: `@thunder-so/thunder`
|
|
12
|
-
A unified AWS CDK library for deploying web applications with multiple deployment patterns.
|
|
13
|
-
|
|
14
|
-
### Available Stacks
|
|
15
|
-
|
|
16
|
-
| Stack | Purpose | Resources |
|
|
17
|
-
|-------|---------|-----------|
|
|
18
|
-
| **Static** | Static SPA hosting | S3 + CloudFront + Route53 |
|
|
19
|
-
| **Lambda** | Serverless functions | Lambda + API Gateway + ECR |
|
|
20
|
-
| **Fargate** | Container orchestration | ECS Fargate + ALB + VPC |
|
|
21
|
-
| **EC2** | Single container hosting | EC2 + Elastic IP + Docker |
|
|
22
|
-
| **Template** | Coolify one-click templates | EC2 + Docker Compose |
|
|
23
|
-
| **Nuxt** | Full-stack Nuxt.js | Lambda SSR + S3 + CloudFront |
|
|
24
|
-
| **Astro** | Full-stack Astro SSR | Lambda SSR + S3 + CloudFront + Edge |
|
|
25
|
-
| **VPC** | Shared infrastructure | VPC with public/private subnets |
|
|
26
|
-
|
|
27
|
-
### Current CLI
|
|
28
|
-
- `th init` - Initialize project
|
|
29
|
-
- `th deploy` - Deploy services
|
|
30
|
-
- `th destroy` - Remove resources
|
|
31
|
-
|
|
32
|
-
### Missing Infrastructure
|
|
33
|
-
- No `.claude/` directory
|
|
34
|
-
- No intelligent stack selection
|
|
35
|
-
- No automated configuration generation
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## Recommended Architecture
|
|
40
|
-
|
|
41
|
-
### Option A: Project-Level Skills (Immediate Use)
|
|
42
|
-
**Location**: `.claude/skills/` within repo
|
|
43
|
-
- Automatically available in project
|
|
44
|
-
- Version-controlled with code
|
|
45
|
-
- No installation required
|
|
46
|
-
- Best for team collaboration
|
|
47
|
-
|
|
48
|
-
### Option B: Plugin Distribution (Global Distribution)
|
|
49
|
-
**Location**: `thunder-claude-plugin/` directory
|
|
50
|
-
- Install once, use everywhere
|
|
51
|
-
- Distributed via marketplace
|
|
52
|
-
- Namespaced: `/thunder:select-stack`
|
|
53
|
-
- Best for community distribution
|
|
54
|
-
|
|
55
|
-
**Recommendation**: Start with Option A, package as Option B later.
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## Skill System Design
|
|
60
|
-
|
|
61
|
-
### 1. Master Stack Selector Skill (`select-stack`)
|
|
62
|
-
|
|
63
|
-
**Purpose**: Primary entry point for "deploy on AWS" requests
|
|
64
|
-
|
|
65
|
-
**Detection Logic**:
|
|
66
|
-
```
|
|
67
|
-
Framework Detection:
|
|
68
|
-
├── Nuxt.js → NuxtStack
|
|
69
|
-
├── Astro → AstroStack
|
|
70
|
-
├── Next.js (SSG) → StaticStack
|
|
71
|
-
├── React/Vue/Svelte SPA → StaticStack
|
|
72
|
-
│
|
|
73
|
-
Container Detection:
|
|
74
|
-
├── Dockerfile exists → Fargate/EC2
|
|
75
|
-
├── docker-compose.yml → TemplateStack
|
|
76
|
-
│
|
|
77
|
-
Architecture Analysis:
|
|
78
|
-
├── Simple API → LambdaStack
|
|
79
|
-
├── Long-running service → FargateStack
|
|
80
|
-
├── Single container → EC2Stack
|
|
81
|
-
└── Pre-built template → TemplateStack
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
**User Flow**:
|
|
85
|
-
1. Analyze project structure (package.json, configs, Docker files)
|
|
86
|
-
2. Detect framework and architecture patterns
|
|
87
|
-
3. Ask clarifying questions if ambiguous
|
|
88
|
-
4. Present 1-2 recommendations with rationale
|
|
89
|
-
5. Generate configuration files upon confirmation
|
|
90
|
-
|
|
91
|
-
### 2. Individual Stack Skills
|
|
92
|
-
|
|
93
|
-
Each stack has a dedicated skill for:
|
|
94
|
-
- Generating stack-specific configuration
|
|
95
|
-
- Creating bin/*.ts entry points
|
|
96
|
-
- Setting up thunder.config.ts
|
|
97
|
-
- Providing best practice guidance
|
|
98
|
-
- Troubleshooting common issues
|
|
99
|
-
|
|
100
|
-
**Skills Required**:
|
|
101
|
-
- `/select-stack` - Master selector
|
|
102
|
-
- `/static` - Static SPA deployment
|
|
103
|
-
- `/lambda` - Serverless functions
|
|
104
|
-
- `/fargate` - Container orchestration
|
|
105
|
-
- `/ec2` - Single EC2 container
|
|
106
|
-
- `/template` - Coolify templates
|
|
107
|
-
- `/nuxt` - Nuxt.js full-stack
|
|
108
|
-
- `/astro` - Astro full-stack
|
|
109
|
-
- `/vpc` - VPC infrastructure
|
|
110
|
-
- `/troubleshoot` - Issue resolution
|
|
111
|
-
|
|
112
|
-
### 3. Utility Skills
|
|
113
|
-
|
|
114
|
-
- `/config` - Manage thunder.config.ts
|
|
115
|
-
- `/deploy-guide` - Deployment walkthrough
|
|
116
|
-
- `/teardown` - Safe resource cleanup
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## File Structure
|
|
121
|
-
|
|
122
|
-
```
|
|
123
|
-
.claude/
|
|
124
|
-
├── CLAUDE.md # Project context
|
|
125
|
-
└── skills/
|
|
126
|
-
├── select-stack/
|
|
127
|
-
│ ├── SKILL.md # Skill definition
|
|
128
|
-
│ ├── decision-matrix.md # Selection criteria
|
|
129
|
-
│ └── examples/
|
|
130
|
-
│ ├── react-spa.md
|
|
131
|
-
│ ├── nuxt-app.md
|
|
132
|
-
│ └── api-service.md
|
|
133
|
-
│
|
|
134
|
-
├── static/
|
|
135
|
-
│ ├── SKILL.md
|
|
136
|
-
│ └── templates/
|
|
137
|
-
│ ├── bin-static.ts
|
|
138
|
-
│ └── thunder.config.static.ts
|
|
139
|
-
│
|
|
140
|
-
├── lambda/
|
|
141
|
-
│ ├── SKILL.md
|
|
142
|
-
│ └── templates/
|
|
143
|
-
│ ├── bin-lambda.ts
|
|
144
|
-
│ └── thunder.config.lambda.ts
|
|
145
|
-
│
|
|
146
|
-
├── fargate/
|
|
147
|
-
│ ├── SKILL.md
|
|
148
|
-
│ └── templates/
|
|
149
|
-
│ ├── bin-fargate.ts
|
|
150
|
-
│ └── thunder.config.fargate.ts
|
|
151
|
-
│
|
|
152
|
-
├── ec2/
|
|
153
|
-
│ ├── SKILL.md
|
|
154
|
-
│ └── templates/
|
|
155
|
-
│ ├── bin-ec2.ts
|
|
156
|
-
│ └── thunder.config.ec2.ts
|
|
157
|
-
│
|
|
158
|
-
├── nuxt/
|
|
159
|
-
│ ├── SKILL.md
|
|
160
|
-
│ └── templates/
|
|
161
|
-
│ ├── bin-nuxt.ts
|
|
162
|
-
│ └── thunder.config.nuxt.ts
|
|
163
|
-
│
|
|
164
|
-
├── astro/
|
|
165
|
-
│ ├── SKILL.md
|
|
166
|
-
│ └── templates/
|
|
167
|
-
│ ├── bin-astro.ts
|
|
168
|
-
│ └── thunder.config.astro.ts
|
|
169
|
-
│
|
|
170
|
-
├── template/
|
|
171
|
-
│ ├── SKILL.md
|
|
172
|
-
│ └── templates/
|
|
173
|
-
│ ├── bin-template.ts
|
|
174
|
-
│ └── thunder.config.template.ts
|
|
175
|
-
│
|
|
176
|
-
├── vpc/
|
|
177
|
-
│ ├── SKILL.md
|
|
178
|
-
│ └── templates/
|
|
179
|
-
│ └── bin-vpc.ts
|
|
180
|
-
│
|
|
181
|
-
└── troubleshoot/
|
|
182
|
-
├── SKILL.md
|
|
183
|
-
└── common-issues.md
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## Stack Selection Matrix
|
|
189
|
-
|
|
190
|
-
| Use Case | Detection Signals | Primary Stack | Alternative |
|
|
191
|
-
|----------|-------------------|---------------|-------------|
|
|
192
|
-
| React/Vue/Angular SPA | `react`, `vue` in deps | **Static** | - |
|
|
193
|
-
| SSG Framework (Next.js, Gatsby) | `next`, `gatsby` in deps | **Static** | - |
|
|
194
|
-
| Nuxt.js Application | `nuxt` in deps | **Nuxt** | Fargate |
|
|
195
|
-
| Astro Application | `astro` in deps | **Astro** | Static |
|
|
196
|
-
| API-only Backend | No frontend deps | **Lambda** | Fargate |
|
|
197
|
-
| Container w/ Dockerfile | `Dockerfile` present | **Fargate** | EC2 |
|
|
198
|
-
| Simple Container | Single container | **EC2** | Fargate |
|
|
199
|
-
| Coolify Template | `docker-compose.yml` | **Template** | EC2 |
|
|
200
|
-
| Multi-service App | Multiple services | **Fargate** | Multiple stacks |
|
|
201
|
-
| Background Workers | Queue/scheduling needs | **Lambda** | Fargate |
|
|
202
|
-
| Microservices | Service architecture | **Fargate** + VPC | Multiple stacks |
|
|
203
|
-
|
|
204
|
-
---
|
|
205
|
-
|
|
206
|
-
## Skill Content Structure
|
|
207
|
-
|
|
208
|
-
### SKILL.md Format
|
|
209
|
-
|
|
210
|
-
```yaml
|
|
211
|
-
---
|
|
212
|
-
name: thunder:select-stack
|
|
213
|
-
description: |
|
|
214
|
-
Analyzes project and recommends appropriate Thunder AWS deployment stack.
|
|
215
|
-
Use when user asks to deploy on AWS, setup infrastructure, or wants to
|
|
216
|
-
create a new deployment.
|
|
217
|
-
argument-hint: [optional project description or specific stack name]
|
|
218
|
-
disable-model-invocation: false
|
|
219
|
-
allowed-tools: Read, Grep, Glob, Bash
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
## Context
|
|
223
|
-
When a user wants to deploy on AWS, follow this process:
|
|
224
|
-
|
|
225
|
-
### Step 1: Project Analysis
|
|
226
|
-
1. Read package.json to detect frameworks
|
|
227
|
-
2. Check for existing configuration files (thunder.config.ts, bin/*.ts)
|
|
228
|
-
3. Look for Dockerfile or docker-compose.yml
|
|
229
|
-
4. Identify build scripts and entry points
|
|
230
|
-
|
|
231
|
-
### Step 2: Framework Detection
|
|
232
|
-
Common patterns:
|
|
233
|
-
- React/Vue/Svelte SPA → Static stack
|
|
234
|
-
- Nuxt.js → Nuxt stack
|
|
235
|
-
- Astro → Astro stack
|
|
236
|
-
- Next.js (with export) → Static stack
|
|
237
|
-
- Next.js (with server) → Fargate stack
|
|
238
|
-
- Express/Fastify API → Lambda or Fargate
|
|
239
|
-
- Docker container → Fargate or EC2
|
|
240
|
-
|
|
241
|
-
### Step 3: Ask Clarifying Questions
|
|
242
|
-
If multiple options apply:
|
|
243
|
-
- "Do you need server-side rendering (SSR)?"
|
|
244
|
-
- "Do you have a backend API?"
|
|
245
|
-
- "Is this a static site or dynamic application?"
|
|
246
|
-
- "Do you need WebSocket support?"
|
|
247
|
-
- "Do you have a Dockerfile?"
|
|
248
|
-
|
|
249
|
-
### Step 4: Recommendation
|
|
250
|
-
Present best option with:
|
|
251
|
-
- Why this stack fits
|
|
252
|
-
- Key features provided
|
|
253
|
-
- Cost considerations
|
|
254
|
-
- Alternative if applicable
|
|
255
|
-
|
|
256
|
-
### Step 5: Configuration Generation
|
|
257
|
-
Upon confirmation:
|
|
258
|
-
1. Create bin/<stack>.ts entry point
|
|
259
|
-
2. Create/update thunder.config.ts
|
|
260
|
-
3. Add deployment scripts to package.json
|
|
261
|
-
4. Provide next steps
|
|
262
|
-
|
|
263
|
-
## Templates
|
|
264
|
-
Reference files in ./templates/ directory for code generation.
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
---
|
|
268
|
-
|
|
269
|
-
## User Interaction Examples
|
|
270
|
-
|
|
271
|
-
### Example 1: React SPA
|
|
272
|
-
|
|
273
|
-
**User**: "Deploy my React app to AWS"
|
|
274
|
-
|
|
275
|
-
**Claude Analysis**:
|
|
276
|
-
- Detects React in package.json
|
|
277
|
-
- Finds build script (likely `npm run build`)
|
|
278
|
-
- No SSR indicators
|
|
279
|
-
- No Dockerfile
|
|
280
|
-
|
|
281
|
-
**Claude Response**:
|
|
282
|
-
"I see you have a React application. The **Static** stack is perfect for this:
|
|
283
|
-
|
|
284
|
-
**What it provides:**
|
|
285
|
-
- S3 bucket for your built files
|
|
286
|
-
- CloudFront CDN for fast global access
|
|
287
|
-
- SSL certificate and custom domain support
|
|
288
|
-
- Automatic cache invalidation on deploy
|
|
289
|
-
- CI/CD pipeline integration
|
|
290
|
-
|
|
291
|
-
**Next steps:**
|
|
292
|
-
1. Build your app: `npm run build`
|
|
293
|
-
2. Configure output directory (default: `dist` or `build`)
|
|
294
|
-
3. Deploy with `th deploy`
|
|
295
|
-
|
|
296
|
-
Shall I set up the Static stack configuration?"
|
|
297
|
-
|
|
298
|
-
### Example 2: Nuxt.js Full-Stack
|
|
299
|
-
|
|
300
|
-
**User**: "How do I deploy my Nuxt app?"
|
|
301
|
-
|
|
302
|
-
**Claude Analysis**:
|
|
303
|
-
- Detects Nuxt dependency
|
|
304
|
-
- Finds nuxt.config.ts
|
|
305
|
-
- Likely needs SSR support
|
|
306
|
-
|
|
307
|
-
**Claude Response**:
|
|
308
|
-
"I found your Nuxt.js project. For full-stack Nuxt apps, I recommend the **Nuxt** stack:
|
|
309
|
-
|
|
310
|
-
**Architecture:**
|
|
311
|
-
- Lambda functions for server-side rendering (SSR)
|
|
312
|
-
- S3 bucket for static assets (JS, CSS, images)
|
|
313
|
-
- CloudFront distribution with dual origins
|
|
314
|
-
- API routes supported via API Gateway
|
|
315
|
-
- Edge-optimized for global performance
|
|
316
|
-
|
|
317
|
-
**Alternative:** If you need WebSocket support or long-running processes, consider the **Fargate** stack instead.
|
|
318
|
-
|
|
319
|
-
Would you like me to configure the Nuxt stack?"
|
|
320
|
-
|
|
321
|
-
### Example 3: Ambiguous Project
|
|
322
|
-
|
|
323
|
-
**User**: "Deploy my app to AWS"
|
|
324
|
-
|
|
325
|
-
**Claude Analysis**:
|
|
326
|
-
- Limited context, no clear framework detected
|
|
327
|
-
- Need to ask questions
|
|
328
|
-
|
|
329
|
-
**Claude Response**:
|
|
330
|
-
"I'd be happy to help you deploy to AWS! To recommend the best stack, I need to understand your application better:
|
|
331
|
-
|
|
332
|
-
1. **What framework are you using?** (React, Vue, Nuxt, Astro, Express, etc.)
|
|
333
|
-
2. **Does your app need server-side rendering (SSR)?**
|
|
334
|
-
3. **Do you have a backend API?**
|
|
335
|
-
4. **Is this a static site or dynamic application?**
|
|
336
|
-
5. **Do you have a Dockerfile?**
|
|
337
|
-
|
|
338
|
-
Or you can tell me more about your app and I'll analyze your project files."
|
|
339
|
-
|
|
340
|
-
---
|
|
341
|
-
|
|
342
|
-
## Configuration Templates
|
|
343
|
-
|
|
344
|
-
### thunder.config.ts Template
|
|
345
|
-
|
|
346
|
-
```typescript
|
|
347
|
-
export default {
|
|
348
|
-
application: '${application}',
|
|
349
|
-
service: '${service}',
|
|
350
|
-
environment: '${environment}',
|
|
351
|
-
env: {
|
|
352
|
-
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
353
|
-
region: process.env.CDK_DEFAULT_REGION || 'us-east-1',
|
|
354
|
-
},
|
|
355
|
-
|
|
356
|
-
// Stack-specific configuration
|
|
357
|
-
$STACK_CONFIG
|
|
358
|
-
};
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
### bin/<stack>.ts Template
|
|
362
|
-
|
|
363
|
-
```typescript
|
|
364
|
-
#!/usr/bin/env -S npx tsx
|
|
365
|
-
import { App } from 'aws-cdk-lib';
|
|
366
|
-
import { $StackName } from '@thunder-so/thunder';
|
|
367
|
-
import config from '../thunder.config.ts';
|
|
368
|
-
|
|
369
|
-
const app = new App();
|
|
370
|
-
|
|
371
|
-
new $StackName(app, '$StackName', {
|
|
372
|
-
...config,
|
|
373
|
-
$SPECIFIC_PROPS
|
|
374
|
-
});
|
|
375
|
-
|
|
376
|
-
app.synth();
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
---
|
|
380
|
-
|
|
381
|
-
## Implementation Phases
|
|
382
|
-
|
|
383
|
-
### Phase 1: Foundation (Week 1)
|
|
384
|
-
- [ ] Create `.claude/` directory structure
|
|
385
|
-
- [ ] Write CLAUDE.md project context
|
|
386
|
-
- [ ] Implement `select-stack` skill with framework detection
|
|
387
|
-
- [ ] Implement `static` skill (most common use case)
|
|
388
|
-
- [ ] Create templates for Static stack
|
|
389
|
-
- [ ] Test with sample React project
|
|
390
|
-
|
|
391
|
-
### Phase 2: Core Stacks (Week 2)
|
|
392
|
-
- [ ] Implement `lambda` skill
|
|
393
|
-
- [ ] Implement `fargate` skill
|
|
394
|
-
- [ ] Implement `ec2` skill
|
|
395
|
-
- [ ] Create templates for each
|
|
396
|
-
- [ ] Add stack-specific configuration examples
|
|
397
|
-
|
|
398
|
-
### Phase 3: Framework-Specific (Week 3)
|
|
399
|
-
- [ ] Implement `nuxt` skill
|
|
400
|
-
- [ ] Implement `astro` skill
|
|
401
|
-
- [ ] Implement `template` skill
|
|
402
|
-
- [ ] Create framework detection helpers
|
|
403
|
-
- [ ] Add SSR vs SSG detection logic
|
|
404
|
-
|
|
405
|
-
### Phase 4: Utilities & Polish (Week 4)
|
|
406
|
-
- [ ] Implement `troubleshoot` skill
|
|
407
|
-
- [ ] Implement `config` skill
|
|
408
|
-
- [ ] Add comprehensive examples
|
|
409
|
-
- [ ] Write skill documentation
|
|
410
|
-
- [ ] Test with real projects
|
|
411
|
-
|
|
412
|
-
### Phase 5: Plugin Packaging (Week 5)
|
|
413
|
-
- [ ] Create `thunder-claude-plugin` directory
|
|
414
|
-
- [ ] Write plugin.json manifest
|
|
415
|
-
- [ ] Package skills for distribution
|
|
416
|
-
- [ ] Write installation documentation
|
|
417
|
-
- [ ] Publish to marketplace
|
|
418
|
-
|
|
419
|
-
---
|
|
420
|
-
|
|
421
|
-
## Key Design Decisions
|
|
422
|
-
|
|
423
|
-
### 1. Detection Strategy
|
|
424
|
-
- **Automated detection** for clear cases (framework in package.json)
|
|
425
|
-
- **Interactive questions** for ambiguous cases
|
|
426
|
-
- **Confidence scoring** to determine when to ask
|
|
427
|
-
|
|
428
|
-
### 2. Configuration Approach
|
|
429
|
-
- Generate minimal viable configuration
|
|
430
|
-
- Include helpful comments explaining options
|
|
431
|
-
- Reference external docs for advanced settings
|
|
432
|
-
- Allow user customization after generation
|
|
433
|
-
|
|
434
|
-
### 3. Error Handling
|
|
435
|
-
- Validate AWS credentials before generation
|
|
436
|
-
- Check for existing configurations
|
|
437
|
-
- Provide clear error messages with solutions
|
|
438
|
-
- Offer rollback options
|
|
439
|
-
|
|
440
|
-
### 4. Documentation Integration
|
|
441
|
-
- Link to existing `.agents/` documentation
|
|
442
|
-
- Include inline comments in generated code
|
|
443
|
-
- Reference PRD and CLI docs
|
|
444
|
-
- Provide external resource links
|
|
445
|
-
|
|
446
|
-
---
|
|
447
|
-
|
|
448
|
-
## Testing Strategy
|
|
449
|
-
|
|
450
|
-
### Test Scenarios
|
|
451
|
-
1. **React SPA** → Static stack
|
|
452
|
-
2. **Nuxt SSR app** → Nuxt stack
|
|
453
|
-
3. **Express API** → Lambda or Fargate
|
|
454
|
-
4. **Docker app** → Fargate or EC2
|
|
455
|
-
5. **Multi-service app** → Multiple stacks
|
|
456
|
-
6. **Ambiguous project** → Interactive flow
|
|
457
|
-
|
|
458
|
-
### Validation Checklist
|
|
459
|
-
- [ ] Skill triggers on appropriate prompts
|
|
460
|
-
- [ ] Correct stack recommended for project type
|
|
461
|
-
- [ ] Generated files are syntactically correct
|
|
462
|
-
- [ ] Configuration matches project structure
|
|
463
|
-
- [ ] User questions are relevant and helpful
|
|
464
|
-
- [ ] Error messages are clear and actionable
|
|
465
|
-
|
|
466
|
-
---
|
|
467
|
-
|
|
468
|
-
## Future Enhancements
|
|
469
|
-
|
|
470
|
-
### Advanced Features
|
|
471
|
-
- **Multi-stack recommendations** for microservices
|
|
472
|
-
- **Migration skills** (Static → Fargate, etc.)
|
|
473
|
-
- **Cost estimation** before deployment
|
|
474
|
-
- **Performance optimization** suggestions
|
|
475
|
-
- **Security best practices** enforcement
|
|
476
|
-
|
|
477
|
-
### Framework Support
|
|
478
|
-
- TanStack Start
|
|
479
|
-
- Angular AnalogJS
|
|
480
|
-
- SvelteKit
|
|
481
|
-
- React Router v7
|
|
482
|
-
- SolidStart
|
|
483
|
-
|
|
484
|
-
### Integration Points
|
|
485
|
-
- CI/CD pipeline generation
|
|
486
|
-
- Database setup assistance
|
|
487
|
-
- Secrets management
|
|
488
|
-
- Monitoring configuration
|
|
489
|
-
- Custom domain setup
|
|
490
|
-
|
|
491
|
-
---
|
|
492
|
-
|
|
493
|
-
## Success Metrics
|
|
494
|
-
|
|
495
|
-
### User Experience
|
|
496
|
-
- Time to first deployment reduced by 50%
|
|
497
|
-
- Stack selection accuracy >90%
|
|
498
|
-
- User satisfaction with recommendations
|
|
499
|
-
- Reduced support questions
|
|
500
|
-
|
|
501
|
-
### Technical
|
|
502
|
-
- All major framework types covered
|
|
503
|
-
- Generated configs deploy successfully
|
|
504
|
-
- Skills trigger appropriately
|
|
505
|
-
- No false positives in detection
|
|
506
|
-
|
|
507
|
-
### Adoption
|
|
508
|
-
- Skills used in X% of new projects
|
|
509
|
-
- Plugin installations (if distributed)
|
|
510
|
-
- Community contributions
|
|
511
|
-
- Documentation engagement
|
|
512
|
-
|
|
513
|
-
---
|
|
514
|
-
|
|
515
|
-
## Resources
|
|
516
|
-
|
|
517
|
-
### Documentation
|
|
518
|
-
- [Claude Code Skills Documentation](https://docs.anthropic.com/en/docs/claude-code/skills)
|
|
519
|
-
- [Claude Code Plugins](https://docs.anthropic.com/en/docs/claude-code/plugins)
|
|
520
|
-
- [Thunder PRD](./PRD.md)
|
|
521
|
-
- [Thunder CLI Scope](./CLI.md)
|
|
522
|
-
|
|
523
|
-
### References
|
|
524
|
-
- Agent Skills standard: https://agentskills.io
|
|
525
|
-
- AWS CDK patterns: https://docs.aws.amazon.com/cdk/
|
|
526
|
-
- Framework detection: package.json analysis
|
|
527
|
-
|
|
528
|
-
---
|
|
529
|
-
|
|
530
|
-
## Notes
|
|
531
|
-
|
|
532
|
-
- Keep SKILL.md files under 500 lines
|
|
533
|
-
- Use frontmatter for metadata
|
|
534
|
-
- Include examples in separate files
|
|
535
|
-
- Test with real projects before finalizing
|
|
536
|
-
- Document edge cases and limitations
|
|
537
|
-
- Consider monorepo scenarios
|
|
538
|
-
- Support both TypeScript and JavaScript projects
|
|
539
|
-
|
|
540
|
-
---
|
|
541
|
-
|
|
542
|
-
**Last Updated**: 2026-03-08
|
|
543
|
-
**Status**: Planning Complete - Ready for Implementation
|
|
Binary file
|