Asset
@nx/assetis a library/component package, not a standalone service. Host applications (commerce, finance, ledger) mount its IGNIS components to gain S3/Minio-backed file endpoints,MetaLinkmetadata tracking, and Vietnamese bank reference data. It has no application class, port, migrations, or DB schema of its own.
1. Quick Reference
| Property | Value |
|---|---|
| Package | @nx/asset |
| Type | Library / IGNIS component package |
| Runtime | Bun (runs inside a host application) |
| Base Class | N/A — exports BaseComponent subclasses, not an Application |
| Location | packages/asset |
| Base Path | N/A — controllers mount under the host's base path |
| Dev Port | N/A — no standalone entry point |
| Container Port | N/A — library |
| Snowflake ID | N/A — issues no IDs of its own (host's IdGenerator) |
| DB Schema | N/A — reads/writes public.MetaLink defined in @nx/core |
| Binding Namespace | @nx/commerce (value of BindingKeys.BASE; see Configuration) |
| Owner | platform |
2. Purpose & Scope
| Included | Excluded |
|---|---|
| S3/Minio object upload / download / stream / delete / list | Standalone application, port, healthchecks |
MetaLink metadata records for stored objects | Owning the MetaLink schema (lives in @nx/core) |
i18n translation bundle (i18n.json) streaming | Image transforms / thumbnailing |
| Vietnamese bank registry + PNG logos | Presigned-URL StaticAssetComponent path (commented out — not live) |
3. Tech Stack
External:
| Library | Purpose |
|---|---|
@venizia/ignis | DI, BaseComponent, BaseRestController, ControllerFactory, DefaultCRUDRepository |
@venizia/ignis-helpers | BunS3Helper (active S3/Minio client), BaseStorageHelper, multipart + content-disposition helpers |
hono | HTTP route context (via IGNIS) |
drizzle-orm | MetaLink access via PostgresCoreDataSource |
@hono/zod-openapi | Route request/response schemas |
Internal:
| Package | Purpose |
|---|---|
@nx/core | MetaLink model/schema, PostgresCoreDataSource, EnvironmentKeys, BindingKeys, crudPermissions |
4. Project Structure
packages/asset/
├── src/
│ ├── index.ts # Re-exports components + resources (no bootstrap)
│ ├── common/
│ │ ├── keys.ts # BindingKeys (S3 helper binding)
│ │ └── rest-paths.ts # /assets, /meta-links
│ ├── components/
│ │ ├── application-asset.component.ts # ApplicationAssetComponent
│ │ └── banks-vn.component.ts # ApplicationAssetBanksVNComponent
│ ├── controllers/
│ │ ├── asset/ # AssetController (/assets objects + i18n)
│ │ ├── banks-vn/ # BanksVNController (/assets/banks-vn)
│ │ ├── meta-link/ # MetaLinkController (/meta-links CRUD)
│ │ └── permissions.ts # AssetPermissions (= MetaLink CRUD perms)
│ ├── datasources/ # Re-export PostgresCoreDataSource from @nx/core
│ ├── repositories/ # MetaLinkRepository (thin CRUD over core model)
│ ├── resources/ # banks-vn.json + banks-vn/*.png logos
│ └── utilities/ # toAbsoluteUrl
├── package.json
└── tsconfig.json5. Architecture
Detail: see Architecture.
6. Domain Snapshot
Full ERD + entity table: see Domain Model.
7. Surface Summary
REST controllers (full reference rendered live from the host's /doc/openapi.json; asset has no port of its own):
| Controller | Base path | Endpoints | Auth |
|---|---|---|---|
AssetController | /assets | 7 | mixed (read public, mutate JWT/Basic) |
BanksVNController | /assets/banks-vn | 2 | public |
MetaLinkController | /meta-links | 7 (CRUD) | JWT/Basic (authorize skipped today) |
Async topics (full reference in API Events):
| Direction | Count |
|---|---|
| Inbound (Kafka) | 0 |
| Outbound (Kafka) | 0 |
| WebSocket out | 0 |
| BullMQ jobs in | 0 |
| BullMQ jobs out | 0 |
N/A — asset has no async surface. It is a synchronous REST + S3 library.
8. Components
| Component | File | Purpose |
|---|---|---|
ApplicationAssetComponent | src/components/application-asset.component.ts | Constructs BunS3Helper, binds it under APPLICATION_S3_STORAGE_HELPER, registers AssetController + MetaLinkController |
ApplicationAssetBanksVNComponent | src/components/banks-vn.component.ts | Registers BanksVNController (VN bank registry + logos) |
9. Services
| Service | File | One-liner |
|---|---|---|
| — | — | N/A — no service layer; logic lives directly in controllers + BunS3Helper |
10. Repositories
| Repository | Table | Source | Custom Methods |
|---|---|---|---|
MetaLinkRepository | public.MetaLink | model from @nx/core; thin DefaultCRUDRepository | — |
11. Entry Points
| File | Purpose |
|---|---|
src/index.ts | Re-exports components + resources for host apps; no bootstrapApplication() |
src/components/*.component.ts | The two mountable IGNIS components |
N/A — no
application.ts,migrate.ts, or service entry. Mounted viahost.component(ApplicationAssetComponent).
12. Configuration
Env vars (
APP_ENV_S3_*,APP_ENV_S3_BUCKET,APP_ENV_APPLICATION_EXPLORER_URL) + bindings: see Configuration.
13. Operations
Deployment (lib — no pod), observability, security, runbook: see Operations.
14. Related Pages
- Architecture
- Domain Model
- API Events
- Integration
- Configuration
- Operations
- Storage — S3/Minio object lifecycle (feature)
- MetaLinks — metadata model + CRUD (feature)
- Decisions
- REST endpoints — live OpenAPI on the host service (e.g.
/v1/api/commerce/doc/openapi.json)