Skip to content

Commit 850af42

Browse files
committed
docs: update infra paths for multi-cloud layout
- add apps/infra overview readme with gcp/aws/az service mapping - point mise infra tasks and tf paths at apps/infra/gcp in root and locale readmes and agent rules - ignore oma docs generated artifacts
1 parent d2d8c21 commit 850af42

13 files changed

Lines changed: 134 additions & 59 deletions

File tree

.agents/rules/GEMINI.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ Modern fullstack monorepo template with Next.js 16, FastAPI, Flutter, and GCP in
3939
- **CI/CD**: Fastlane
4040
- **Lint**: very_good_analysis
4141

42-
### Infrastructure (apps/infra)
42+
### Infrastructure (apps/infra/gcp, apps/infra/aws)
4343
- **IaC**: Terraform
44-
- **Cloud**: GCP (Cloud Run, Cloud SQL, Memorystore, GCS, Cloud Tasks, Pub/Sub, CDN)
44+
- **Cloud**: GCP (Cloud Run, Cloud SQL, Memorystore, GCS, Cloud Tasks, Pub/Sub, CDN) or AWS (ECS Fargate, Aurora, ElastiCache, S3, SQS/SNS, CloudFront)
4545
- **CI/CD**: GitHub Actions with Workload Identity Federation
4646
- **Security**: CodeQL SAST
4747

@@ -170,5 +170,6 @@ apps/mobile/lib/core/theme/generated_theme.dart (Flutter Theme - auto-generated)
170170
- `apps/mobile/lib/firebase_options.dart` - Firebase config
171171

172172
### Infrastructure
173-
- `apps/infra/variables.tf` - Infrastructure configuration
173+
- `apps/infra/gcp/variables.tf` - GCP infrastructure configuration
174+
- `apps/infra/aws/variables.tf` - AWS infrastructure configuration
174175
- `.github/workflows/codeql.yml` - Security scanning

.agents/rules/build-guide.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,23 +177,23 @@ bundle exec fastlane ios build # Build iOS (no codesign)
177177
bundle exec fastlane ios testflight_deploy # Deploy to TestFlight
178178
```
179179

180-
### Infrastructure (apps/infra)
180+
### Infrastructure (apps/infra/gcp, apps/infra/aws)
181181

182182
```bash
183183
# Initialize Terraform
184-
mise //apps/infra:init
184+
mise //apps/infra/gcp:init
185185

186186
# Preview changes
187-
mise //apps/infra:plan
187+
mise //apps/infra/gcp:plan
188188

189189
# Apply changes
190-
mise //apps/infra:apply
190+
mise //apps/infra/gcp:apply
191191

192192
# Preview production changes
193-
mise //apps/infra:plan:prod
193+
mise //apps/infra/gcp:plan:prod
194194

195195
# Apply production changes
196-
mise //apps/infra:apply:prod
196+
mise //apps/infra/gcp:apply:prod
197197
```
198198

199199
### i18n (packages/i18n)
@@ -286,7 +286,7 @@ dart run build_runner build --delete-conflicting-outputs
286286
### Terraform State Issues
287287

288288
```bash
289-
cd apps/infra
289+
cd apps/infra/gcp # or apps/infra/aws
290290

291291
# Refresh state from cloud
292292
terraform refresh -var-file="terraform.tfvars"

.agents/rules/lint-format-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ poe format:check # Ruff format check
3030
# Flutter (in apps/mobile)
3131
flutter analyze
3232

33-
# Terraform (in apps/infra)
33+
# Terraform (in apps/infra/gcp or apps/infra/aws)
3434
terraform fmt -check -recursive
3535
```
3636

@@ -217,7 +217,7 @@ GitHub Actions runs linting on every PR:
217217
218218
- name: Check Terraform format
219219
run: |
220-
cd apps/infra
220+
cd apps/infra/gcp
221221
terraform fmt -check -recursive
222222
```
223223

.claude/rules/GEMINI.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ Modern fullstack monorepo template with Next.js 16, FastAPI, Flutter, and GCP in
4444
- **CI/CD**: Fastlane
4545
- **Lint**: very_good_analysis
4646

47-
### Infrastructure (apps/infra)
47+
### Infrastructure (apps/infra/gcp, apps/infra/aws)
4848
- **IaC**: Terraform
49-
- **Cloud**: GCP (Cloud Run, Cloud SQL, Memorystore, GCS, Cloud Tasks, Pub/Sub, CDN)
49+
- **Cloud**: GCP (Cloud Run, Cloud SQL, Memorystore, GCS, Cloud Tasks, Pub/Sub, CDN) or AWS (ECS Fargate, Aurora, ElastiCache, S3, SQS/SNS, CloudFront)
5050
- **CI/CD**: GitHub Actions with Workload Identity Federation
5151
- **Security**: CodeQL SAST
5252

@@ -175,5 +175,6 @@ apps/mobile/lib/core/theme/generated_theme.dart (Flutter Theme - auto-generated)
175175
- `apps/mobile/lib/firebase_options.dart` - Firebase config
176176

177177
### Infrastructure
178-
- `apps/infra/variables.tf` - Infrastructure configuration
178+
- `apps/infra/gcp/variables.tf` - GCP infrastructure configuration
179+
- `apps/infra/aws/variables.tf` - AWS infrastructure configuration
179180
- `.github/workflows/codeql.yml` - Security scanning

.claude/rules/build-guide.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,23 +177,23 @@ bundle exec fastlane ios build # Build iOS (no codesign)
177177
bundle exec fastlane ios testflight_deploy # Deploy to TestFlight
178178
```
179179

180-
### Infrastructure (apps/infra)
180+
### Infrastructure (apps/infra/gcp, apps/infra/aws)
181181

182182
```bash
183183
# Initialize Terraform
184-
mise //apps/infra:init
184+
mise //apps/infra/gcp:init
185185

186186
# Preview changes
187-
mise //apps/infra:plan
187+
mise //apps/infra/gcp:plan
188188

189189
# Apply changes
190-
mise //apps/infra:apply
190+
mise //apps/infra/gcp:apply
191191

192192
# Preview production changes
193-
mise //apps/infra:plan:prod
193+
mise //apps/infra/gcp:plan:prod
194194

195195
# Apply production changes
196-
mise //apps/infra:apply:prod
196+
mise //apps/infra/gcp:apply:prod
197197
```
198198

199199
### i18n (packages/i18n)
@@ -286,7 +286,7 @@ dart run build_runner build --delete-conflicting-outputs
286286
### Terraform State Issues
287287

288288
```bash
289-
cd apps/infra
289+
cd apps/infra/gcp # or apps/infra/aws
290290

291291
# Refresh state from cloud
292292
terraform refresh -var-file="terraform.tfvars"

.claude/rules/lint-format-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ poe format:check # Ruff format check
3030
# Flutter (in apps/mobile)
3131
flutter analyze
3232

33-
# Terraform (in apps/infra)
33+
# Terraform (in apps/infra/gcp or apps/infra/aws)
3434
terraform fmt -check -recursive
3535
```
3636

@@ -217,7 +217,7 @@ GitHub Actions runs linting on every PR:
217217
218218
- name: Check Terraform format
219219
run: |
220-
cd apps/infra
220+
cd apps/infra/gcp
221221
terraform fmt -check -recursive
222222
```
223223

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,6 @@ apps/mobile/.packages
8686

8787
# Migration backup (local only — do not commit)
8888
.migration-backup/
89+
90+
# oma docs generated artifacts
91+
docs/generated/

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,15 @@ mise tasks --all
310310
</details>
311311

312312
<details>
313-
<summary>Infrastructure (apps/infra)</summary>
313+
<summary>Infrastructure (apps/infra/gcp, apps/infra/aws)</summary>
314314

315315
| Command | Description |
316316
|---------|-------------|
317-
| `mise //apps/infra:init` | Initialize Terraform |
318-
| `mise //apps/infra:plan` | Preview changes |
319-
| `mise //apps/infra:apply` | Apply changes |
320-
| `mise //apps/infra:plan:prod` | Preview production |
321-
| `mise //apps/infra:apply:prod` | Apply production |
317+
| `mise //apps/infra/gcp:init` | Initialize Terraform |
318+
| `mise //apps/infra/gcp:plan` | Preview changes |
319+
| `mise //apps/infra/gcp:apply` | Apply changes |
320+
| `mise //apps/infra/gcp:plan:prod` | Preview production |
321+
| `mise //apps/infra/gcp:apply:prod` | Apply production |
322322

323323
</details>
324324

@@ -392,7 +392,7 @@ cp apps/api/.env.example apps/api/.env
392392
cp apps/web/.env.example apps/web/.env
393393

394394
# Infra
395-
cp apps/infra/terraform.tfvars.example apps/infra/terraform.tfvars
395+
cp apps/infra/gcp/terraform.tfvars.example apps/infra/gcp/terraform.tfvars
396396
```
397397

398398
### GitHub Actions Secrets

apps/infra/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Infrastructure
2+
3+
Terraform configurations for provisioning the fullstack-starter stack. Each cloud target lives in its own self-contained root module — pick one (or run several side by side for different environments).
4+
5+
## Stacks
6+
7+
| Directory | Target | Best for |
8+
|-----------|--------|----------|
9+
| [`gcp/`](./gcp/) | GCP — Cloud Run, Cloud SQL, Memorystore, Cloud Tasks, Pub/Sub, GCS, Cloud CDN | Serverless-first, scale-to-zero workloads |
10+
| [`aws/`](./aws/) | AWS — ECS Fargate, Aurora PostgreSQL, ElastiCache, SQS/SNS, S3, CloudFront, SES | Container-first, AWS-native shops |
11+
| [`az/`](./az/) | Azure — Container Apps, PostgreSQL Flexible Server, Azure Cache for Redis, Service Bus, Blob Storage, Front Door | Azure-native shops, KEDA-based scaling |
12+
| [`freemium/`](./freemium/) | Vercel + Supabase + Backblaze B2 | Zero-cost prototypes and side projects |
13+
14+
### Service mapping
15+
16+
| Component | `gcp/` | `aws/` | `az/` |
17+
|-----------|--------|--------|-------|
18+
| API / Web / Worker | Cloud Run | ECS Fargate | Container Apps |
19+
| Container registry | Artifact Registry | ECR | ACR |
20+
| Database (PostgreSQL 16) | Cloud SQL | Aurora | PostgreSQL Flexible Server |
21+
| Cache (Redis 7) | Memorystore | ElastiCache | Azure Cache for Redis |
22+
| Task queues | Cloud Tasks (default / high / low priority) | SQS (default / high-priority / low-priority + DLQ) | Service Bus subscriptions (SQL filter + DLQ) |
23+
| Event bus | Pub/Sub | SNS → SQS fan-out | Service Bus topic fan-out |
24+
| Scheduled jobs | Cloud Scheduler → Pub/Sub (`schedules` var) | EventBridge Scheduler → SNS (`schedules` var) | Container Apps Jobs cron (`schedules` var) |
25+
| Uploads / static assets | GCS + Cloud CDN | S3 + CloudFront (OAC) | Blob Storage + Front Door |
26+
| WAF / rate limiting | Cloud Armor | WAFv2 (rate limit + AWS managed rules) | Front Door WAF (rate limit; managed rules need Premium) |
27+
| Email || SES (opt-in via `ses_domain`) ||
28+
| CI/CD auth | Workload Identity Federation | GitHub Actions OIDC role | Entra ID federated credential |
29+
30+
## Shared conventions
31+
32+
- **Secrets via Infisical.** Every `plan`/`apply` task is wrapped with `infisical run --env=<env> --path=/infra`, which injects secrets as `TF_VAR_*` environment variables (`DATABASE_PASSWORD`, `JWT_SECRET`, `BETTER_AUTH_SECRET`, OAuth and AI keys). Nothing sensitive is committed; `*.tfvars` is gitignored.
33+
- **Remote state.** GCS backend for `gcp/`, S3 + DynamoDB locking for `aws/`, Azure Storage (`azurerm` backend) for `az/`. All are configured at `terraform init` time via `-backend-config`.
34+
- **Naming.** Resources are prefixed with `${app_name}-${environment}` (default `fullstack-starter-dev`).
35+
- **Environment sizing.** `terraform.tfvars` for dev, `terraform.prod.tfvars` for production. Copy from the `.example` files in each stack.
36+
- **API availability.** The API service keeps a minimum of 1 instance/task in every stack (no cold starts).
37+
- **Cron via scheduler services.** Recurring jobs are declared in the `schedules` variable (Cloud Scheduler / EventBridge Scheduler) and flow through the task queue, so each tick runs exactly once regardless of worker count — workers never run in-process cron.
38+
39+
## Usage
40+
41+
All stacks expose the same mise tasks:
42+
43+
```bash
44+
# GCP
45+
mise //apps/infra/gcp:init
46+
mise //apps/infra/gcp:plan
47+
mise //apps/infra/gcp:apply
48+
mise //apps/infra/gcp:plan:prod
49+
mise //apps/infra/gcp:apply:prod
50+
51+
# AWS
52+
mise //apps/infra/aws:init
53+
mise //apps/infra/aws:plan
54+
mise //apps/infra/aws:apply
55+
mise //apps/infra/aws:plan:prod
56+
mise //apps/infra/aws:apply:prod
57+
58+
# Azure
59+
mise //apps/infra/az:init
60+
mise //apps/infra/az:plan
61+
mise //apps/infra/az:apply
62+
mise //apps/infra/az:plan:prod
63+
mise //apps/infra/az:apply:prod
64+
65+
# Formatting / validation (either stack)
66+
mise //apps/infra/gcp:fmt
67+
mise //apps/infra/aws:validate
68+
```
69+
70+
See each stack's README for prerequisites (API enablement, state bucket setup, certificates) and stack-specific notes.

docs/README.cn.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,15 @@ mise tasks --all
310310
</details>
311311

312312
<details>
313-
<summary>基础设施 (apps/infra)</summary>
313+
<summary>基础设施 (apps/infra/gcp, apps/infra/aws)</summary>
314314

315315
| 命令 | 说明 |
316316
|---------|-------------|
317-
| `mise //apps/infra:init` | 初始化 Terraform |
318-
| `mise //apps/infra:plan` | 预览变更 |
319-
| `mise //apps/infra:apply` | 应用变更 |
320-
| `mise //apps/infra:plan:prod` | 预览生产环境 |
321-
| `mise //apps/infra:apply:prod` | 应用生产环境 |
317+
| `mise //apps/infra/gcp:init` | 初始化 Terraform |
318+
| `mise //apps/infra/gcp:plan` | 预览变更 |
319+
| `mise //apps/infra/gcp:apply` | 应用变更 |
320+
| `mise //apps/infra/gcp:plan:prod` | 预览生产环境 |
321+
| `mise //apps/infra/gcp:apply:prod` | 应用生产环境 |
322322

323323
</details>
324324

@@ -392,7 +392,7 @@ cp apps/api/.env.example apps/api/.env
392392
cp apps/web/.env.example apps/web/.env
393393

394394
# Infra
395-
cp apps/infra/terraform.tfvars.example apps/infra/terraform.tfvars
395+
cp apps/infra/gcp/terraform.tfvars.example apps/infra/gcp/terraform.tfvars
396396
```
397397

398398
### GitHub Actions Secrets

0 commit comments

Comments
 (0)