Skip to content

Storage (server-storage)

The Storage service manages file and object storage backed by MinIO (S3-compatible). It provides bucket and file CRUD operations with streaming support.

Running

bash
# Development
npm run dev --workspace=apps/server-storage

# CLI
npm run cli --workspace=apps/server-storage -- start

# Docker
docker run -e ... privateaim/hub storage cli start

Dependencies

  • Database — MySQL, PostgreSQL, or SQLite
  • Authup — OAuth2 identity provider
  • MinIO — S3-compatible object storage (required)
  • RabbitMQ — AMQP message bus

Environment Variables

Service-Specific

VariableDefaultDescription
MINIO_CONNECTION_STRINGhttp://admin:start123@127.0.0.1:9000MinIO connection (required)

Inherited

See Shared Configuration and Database Configuration.

Key Endpoints

MethodEndpointDescription
GET/bucketsList buckets
POST/bucketsCreate bucket
GET/buckets/:idGet bucket
POST/buckets/:idUpdate bucket
DELETE/buckets/:idDelete bucket
POST/buckets/:id/uploadUpload files into a bucket
GET/buckets/:id/streamStream the bucket contents as a tar
GET/bucket-filesList files
GET/bucket-files/:idGet file
DELETE/bucket-files/:idDelete file
GET/bucket-files/:id/streamStream file contents
GET/docsSwagger/OpenAPI documentation

Response Shapes

Every bucket and bucket-file endpoint answers with a { data, meta } envelope — the record (or the record array) under data. Query-capable GETs advertise the endpoint's queryable vocabulary at meta.schema; mutations carry meta: {}.

Three surfaces stay outside the record envelope:

EndpointShape
GET /{ version, timestamp } — service metadata, flat
GET /buckets/:id/stream, GET /bucket-files/:id/streamflat binary streams with attachment headers
POST /buckets/:id/uploada collection ({ data: files, meta: { total } }), because it uploads many files — no schema

See API Reference for the full contract and the meta.schema reading rules.

Architecture

  • BucketEntity / BucketFileEntity — TypeORM entities tracking storage metadata
  • MinioModule — creates and registers the S3 client in the DI container
  • BucketComponent — AMQP consumer for asynchronous bucket operations
  • Subscribers — publish domain events on bucket/file changes