Skip to content

feat(infra): provision MinIO object storage for local S3-compatible dev#250

Open
Zeemnew wants to merge 1 commit into
codebestia:mainfrom
Zeemnew:fix/223-provision-minio-object-storage
Open

feat(infra): provision MinIO object storage for local S3-compatible dev#250
Zeemnew wants to merge 1 commit into
codebestia:mainfrom
Zeemnew:fix/223-provision-minio-object-storage

Conversation

@Zeemnew

@Zeemnew Zeemnew commented Jun 27, 2026

Copy link
Copy Markdown

Overview

This PR provisions S3-compatible object storage for local development by adding MinIO to infra/docker-compose.yml and wiring the backend to read storage configuration from environment variables. The same S3 client code path works against local MinIO, AWS S3, and Cloudflare R2 by changing env values only.

Related Issue

Closes #223

Changes

🐳 Infrastructure

  • [MODIFY] infra/docker-compose.yml
  • Added a minio service exposing the S3 API on port 9000 and console on 9001.
  • Added a minio-init sidecar that creates the clicked bucket on startup with a private ACL (mc anonymous set none).
  • Added a persistent minio_data volume.

⚙️ Backend Object Storage

  • [ADD] apps/backend/src/lib/objectStore.ts

  • Added an S3-compatible ObjectStore wrapper using @aws-sdk/client-s3.

  • Configured the client from OBJECT_STORE_* env vars with support for custom endpoints and path-style addressing.

  • Exposed putObject, getObject, deleteObject, and ensureBucketReachable helpers.

  • [MODIFY] apps/backend/src/config.ts

  • Added required env validation for:

    • OBJECT_STORE_ENDPOINT
    • OBJECT_STORE_BUCKET
    • OBJECT_STORE_ACCESS_KEY
    • OBJECT_STORE_SECRET_KEY
    • OBJECT_STORE_REGION
    • OBJECT_STORE_FORCE_PATH_STYLE
  • [MODIFY] apps/backend/src/index.ts

  • Bootstraps the object store from validated env and checks bucket reachability on startup.

🧪 Tests

  • [ADD] apps/backend/src/__tests__/objectStore.test.ts

  • Added coverage for S3 client configuration (MinIO path-style and AWS/R2 virtual-hosted style).

  • Added coverage for bucket reachability checks and object put/get/delete operations.

  • [MODIFY] apps/backend/src/__tests__/config.test.ts

  • Added coverage for new OBJECT_STORE_* env parsing and boolean coercion for OBJECT_STORE_FORCE_PATH_STYLE.

  • [MODIFY] apps/backend/src/__tests__/setup.ts

  • Seeded test env defaults for object storage configuration.

🔧 Configuration

  • [MODIFY] .env.example
  • Documented local MinIO defaults aligned with docker-compose.yml.
  • [MODIFY] apps/backend/package.json / pnpm-lock.yaml
  • Added @aws-sdk/client-s3 dependency.

Verification Results

pnpm --filter backend lint ✅ passed
pnpm --filter backend test ✅ passed (130/130)
pnpm --filter backend build ⚠️ existing repo TypeScript errors in unrelated files (conversations.ts, treasury.ts); object store changes compile cleanly
docker compose -f infra/docker-compose.yml up -d --wait ⏳ verify locally (Docker not available in CI sandbox)
Acceptance Criteria Status
docker compose up brings up MinIO with a private bucket ✅ Implemented (minio + minio-init)
Backend reads storage config from env
Same code path works against AWS S3 / R2 by env change only
Backend lint passes
Backend tests pass ✅ (130/130)

Add MinIO to docker-compose with private bucket bootstrap, wire backend
OBJECT_STORE_* env config, and implement a shared S3 client path for MinIO,
AWS S3, and Cloudflare R2.

Closes codebestia#223
@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Zeemnew Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Provision S3-compatible object storage (MinIO local default)

1 participant