Skip to content

feat(infra): Auto-provision shared S3 bucket per generated app#16

Open
liuxing wants to merge 1 commit into
mainfrom
feat/s3-infra-provisioning
Open

feat(infra): Auto-provision shared S3 bucket per generated app#16
liuxing wants to merge 1 commit into
mainfrom
feat/s3-infra-provisioning

Conversation

@liuxing

@liuxing liuxing commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds S3 object storage to the kickoff infra auto-provisioning flow, alongside the existing Postgres/Redis support.

Unlike Postgres/Redis (one Dokploy container per app), S3 uses one shared bucket configured once on the Agentic Builder server. Every generated app gets an isolated folder inside it (key prefix = app slug) — ideal for throwaway test projects. No Dokploy call is involved; S3 provisioning is fully decoupled.

How it works

  1. Configure the shared bucket once in .env.local (BLUEPRINT_S3_BUCKET + credentials; AWS / Cloudflare R2 / MinIO compatible).
  2. When the PRD/TRD implies file/image/media upload, the service detector (regex + LLM) flags needsS3.
  3. Kickoff allocates a per-app prefix (app-slug/) and injects the AWS_S3_* bundle into the generated app's backend/.env, and into the deployed compose env at deploy time.

Changes

  • types: InfraServiceKind += "s3"; RequiredServices += needsS3; InfraServiceInfo += optional env map (S3 needs multiple keys, not a single URL)
  • detect / service-detector: classify S3 from upload / object-storage / presigned-URL hints
  • kickoff-infra/s3.ts (new): reads shared config, derives per-app prefix, builds AWS_S3_* env
  • index: S3 provisioning runs independently of Dokploy; adds s3EnvFrom()
  • coding/route + deploy/pipeline: wire S3 env into backend/.env and the deployed container
  • generated-code-env: generic upsertEnvVars for multi-key sets
  • InfraSection UI: 🪣 S3 chip (skips ping / port display)
  • .env.example: documents BLUEPRINT_S3_*

Security

Secrets land only in gitignored .blueprint/kickoff-infra.json and the generated .env. UI/metadata expose only the s3://bucket/prefix display string — never the keys.

Test plan

  • detect unit suite — S3 regex + orchestration (incl. negative case for text-only CRUD)
  • s3 unit suite — prefix derivation, env bundle, config reading, provisioning (34 tests passing)
  • deploy/pipeline regression suite updated (s3EnvFrom mock) — passing
  • tsc --noEmit clean for all touched files; next lint clean
  • Manual: set BLUEPRINT_S3_*, run a kickoff for an app with image upload, verify AWS_S3_* in generated backend/.env

🤖 Generated with Claude Code

Add S3 to the kickoff-infra auto-provisioning flow alongside Postgres
and Redis. Unlike PG/Redis (one Dokploy container each), S3 uses a
single shared bucket configured once on the server; every generated app
gets an isolated folder (key prefix = app slug).

- types: InfraServiceKind gains "s3"; RequiredServices gains needsS3;
  InfraServiceInfo gains optional `env` map for multi-key services
- detect: regex + LLM service-detector now classify S3 (file/image/media
  upload, object storage, presigned URLs)
- s3.ts: reads BLUEPRINT_S3_* shared-bucket config, allocates per-app
  prefix, emits the AWS_S3_* env bundle (no Dokploy call)
- index: S3 provisioning runs independently of Dokploy; adds s3EnvFrom()
- coding/route + deploy/pipeline: inject S3 env into backend/.env and the
  deployed compose env
- generated-code-env: add generic upsertEnvVars for multi-key sets
- InfraSection UI: S3 chip (skips ping / port display)
- .env.example: document BLUEPRINT_S3_* (AWS / R2 / MinIO compatible)

Secrets only land in gitignored .blueprint/kickoff-infra.json and the
generated .env; UI/metadata expose only the s3://bucket/prefix string.

Tests: detect + s3 unit suites (34 passing).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant