Skip to content

Commit de295ed

Browse files
feat(infra): add hackathon infrastructure provisioning
Terraform + mise hybrid setup for Vercel (API + Web), Supabase, Backblaze B2, and Weaviate Cloud. TF manages services with official providers; bun scripts handle WCD CRUD and env sync where no TF provider exists. Generated with oh-my-agent Co-Authored-By: First Fluke <our.first.fluke@gmail.com>
1 parent cad8b90 commit de295ed

21 files changed

Lines changed: 1656 additions & 0 deletions

apps/api/.env.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,16 @@ GCS_BUCKET_NAME=
3535
MINIO_ENDPOINT=localhost:9000
3636
MINIO_ACCESS_KEY=minioadmin
3737
MINIO_SECRET_KEY=minioadmin
38+
39+
# Supabase (optional)
40+
SUPABASE_URL=
41+
SUPABASE_ANON_KEY=
42+
43+
# Weaviate (optional)
44+
WEAVIATE_URL=
45+
WEAVIATE_API_KEY=
46+
47+
# Backblaze B2 (optional)
48+
B2_KEY_ID=
49+
B2_APPLICATION_KEY=
50+
B2_BUCKET_NAME=

apps/infra/hackathon/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Terraform
2+
*.tfstate
3+
*.tfstate.backup
4+
.terraform/
5+
*.tfvars
6+
!terraform.tfvars.example
7+
8+
# Weaviate state
9+
.weaviate-state.json
10+
11+
# Scripts
12+
scripts/node_modules/
13+
14+
# Secrets
15+
.env

apps/infra/hackathon/b2.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resource "b2_bucket" "main" {
2+
bucket_name = "${var.project_prefix}-storage"
3+
bucket_type = "allPrivate"
4+
}
5+
6+
resource "b2_application_key" "main" {
7+
key_name = "${var.project_prefix}-key"
8+
bucket_id = b2_bucket.main.bucket_id
9+
capabilities = ["readFiles", "writeFiles", "listFiles", "deleteFiles"]
10+
}

apps/infra/hackathon/locals.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
locals {
2+
supabase_url = "https://${supabase_project.main.id}.supabase.co"
3+
4+
api_env_vars = {
5+
SUPABASE_URL = local.supabase_url
6+
B2_KEY_ID = b2_application_key.main.application_key_id
7+
B2_APPLICATION_KEY = b2_application_key.main.application_key
8+
B2_BUCKET_NAME = b2_bucket.main.bucket_name
9+
}
10+
11+
web_env_vars = {
12+
NEXT_PUBLIC_SUPABASE_URL = local.supabase_url
13+
}
14+
}

apps/infra/hackathon/mise.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[tasks]
2+
# Lifecycle
3+
[tasks.setup]
4+
description = "Provision everything"
5+
run = ["mise run apply", "mise run weaviate:up", "mise run env:sync"]
6+
7+
[tasks.teardown]
8+
description = "Destroy everything"
9+
run = ["mise run weaviate:down", "mise run destroy"]
10+
11+
# Terraform
12+
init = { run = "terraform init", description = "Initialize Terraform" }
13+
plan = { run = "terraform plan", description = "Plan infrastructure" }
14+
apply = { run = "terraform apply", description = "Apply infrastructure" }
15+
destroy = { run = "terraform destroy", description = "Destroy infrastructure" }
16+
fmt = { run = "terraform fmt -recursive", description = "Format Terraform" }
17+
validate = { run = "terraform validate", description = "Validate Terraform" }
18+
output = { run = "terraform output -json", description = "Show Terraform outputs" }
19+
20+
# Weaviate Cloud
21+
"weaviate:up" = { run = "bun run scripts/weaviate.ts up", description = "Create WCD cluster" }
22+
"weaviate:down" = { run = "bun run scripts/weaviate.ts down", description = "Delete WCD cluster" }
23+
"weaviate:status" = { run = "bun run scripts/weaviate.ts status", description = "Check WCD cluster" }
24+
25+
# Ops
26+
"env:sync" = { run = "bun run scripts/env-sync.ts", description = "Sync env vars to Vercel + .env.example" }
27+
status = { run = "bun run scripts/status.ts", description = "Check all provisioned resources" }

apps/infra/hackathon/outputs.tf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
output "vercel_api_project_id" {
2+
value = vercel_project.api.id
3+
description = "Vercel API project ID"
4+
}
5+
6+
output "vercel_web_project_id" {
7+
value = vercel_project.web.id
8+
description = "Vercel Web project ID"
9+
}
10+
11+
output "supabase_project_id" {
12+
value = supabase_project.main.id
13+
description = "Supabase project ID"
14+
}
15+
16+
output "supabase_url" {
17+
value = local.supabase_url
18+
description = "Supabase project URL"
19+
}
20+
21+
output "b2_bucket_name" {
22+
value = b2_bucket.main.bucket_name
23+
description = "B2 bucket name"
24+
}
25+
26+
output "b2_key_id" {
27+
value = b2_application_key.main.application_key_id
28+
description = "B2 application key ID"
29+
}
30+
31+
output "b2_app_key" {
32+
value = b2_application_key.main.application_key
33+
sensitive = true
34+
description = "B2 application key"
35+
}

apps/infra/hackathon/provider.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
provider "vercel" {
2+
# VERCEL_API_TOKEN env var
3+
}
4+
5+
provider "supabase" {
6+
# SUPABASE_ACCESS_TOKEN env var
7+
}
8+
9+
provider "b2" {
10+
# B2_APPLICATION_KEY_ID + B2_APPLICATION_KEY env vars
11+
}

apps/infra/hackathon/scripts/bun.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)