Skip to content

Storage

1. Overview

PropertyValue
StatusStable
Ownerplatform
Depends onBunS3Helper (@venizia/ignis-helpers/bun-s3), APP_ENV_S3_*
ControllersAssetController (/assets), BanksVNController (/assets/banks-vn)

Object storage is S3/Minio-only via a single BunS3Helper bound at component init. There is no local-disk backend (ADR-0001).

2. Entity Model

Storage operations produce a MetaLink row per uploaded object (see Domain Model). Objects themselves live in S3, keyed by bucketName + objectName.

3. Lifecycle

FromEventToGuards
*uploadStoredfolderPath ≤2 segments, each isValidName
Storedget/downloadstreamedisValidPath(name, maxDepth:2)
StoreddeleteRemovedisValidPath; MetaLink rows deleteAll'd (async)

Object names are a fresh crypto.randomUUID().slice(0,8) per upload — the literal i18n.json is the only preserved name. Uploads are not idempotent.

4. Operations

HandlerPurposeInputsOutput
AssetController UPLOADStore files in S3 + create MetaLinksmultipart body, query principalType/principalId/variant/folderPath[{ objectName, link, metaLink }]
AssetController GET_OBJECT_BY_NAMEStream object inlinepath objectNamebinary stream
AssetController DOWNLOAD_OBJECT_BY_NAMEStream as attachmentpath objectNamebinary + Content-Disposition
AssetController GET_I18N / DOWNLOAD_I18NStream i18n.json from APP_ENV_S3_BUCKETbinary stream
AssetController DELETE_OBJECTRemove S3 object + MetaLinkspath objectName{ success: true }
AssetController LIST_OBJECTSList bucket objectsquery prefix/recursive/maxKeys[{ name, size, lastModified, etag, prefix }]
BanksVNController GET_BANKS_VN_REGISTRYVN bank registry JSON (absolutized logo URLs)JSON map (cache 1h)
BanksVNController GET_BANK_VN_LOGOStream a bank PNG from diskpath filename (^[A-Za-z0-9]+\.png$)image/png (cache 7d immutable)

5. REST Endpoints

Full schemas render live from the host's /doc/openapi.json. Source: controllers/asset/definition.ts, controllers/banks-vn/definition.ts.

VerbPathAuthHandler
POST/assets/uploadBASIC / JWTAssetController UPLOAD
GET/assets/objectsBASIC / JWTLIST_OBJECTS
GET/assets/objects/i18npublicGET_I18N
GET/assets/download/i18npublicDOWNLOAD_I18N
GET/assets/objects/{objectName}publicGET_OBJECT_BY_NAME
GET/assets/download/{objectName}publicDOWNLOAD_OBJECT_BY_NAME
DELETE/assets/objects/{objectName}BASIC / JWTDELETE_OBJECT
GET/assets/banks-vnpublicGET_BANKS_VN_REGISTRY
GET/assets/banks-vn/{filename}publicGET_BANK_VN_LOGO

Paths shown relative to the asset controllers; the actual prefix is the host base path (e.g. /v1/api/commerce/assets/upload).

6. Events

Inbound / Outbound: none. Storage is synchronous REST + S3 only (see API Events).

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.