Skip to content

Asset

@nx/asset is a library/component package, not a standalone service. Host applications (commerce, finance, ledger) mount its IGNIS components to gain S3/Minio-backed file endpoints, MetaLink metadata tracking, and Vietnamese bank reference data. It has no application class, port, migrations, or DB schema of its own.

1. Quick Reference

PropertyValue
Package@nx/asset
TypeLibrary / IGNIS component package
RuntimeBun (runs inside a host application)
Base ClassN/A — exports BaseComponent subclasses, not an Application
Locationpackages/asset
Base PathN/A — controllers mount under the host's base path
Dev PortN/A — no standalone entry point
Container PortN/A — library
Snowflake IDN/A — issues no IDs of its own (host's IdGenerator)
DB SchemaN/A — reads/writes public.MetaLink defined in @nx/core
Binding Namespace@nx/commerce (value of BindingKeys.BASE; see Configuration)
Ownerplatform

2. Purpose & Scope

IncludedExcluded
S3/Minio object upload / download / stream / delete / listStandalone application, port, healthchecks
MetaLink metadata records for stored objectsOwning the MetaLink schema (lives in @nx/core)
i18n translation bundle (i18n.json) streamingImage transforms / thumbnailing
Vietnamese bank registry + PNG logosPresigned-URL StaticAssetComponent path (commented out — not live)

3. Tech Stack

External:

LibraryPurpose
@venizia/ignisDI, BaseComponent, BaseRestController, ControllerFactory, DefaultCRUDRepository
@venizia/ignis-helpersBunS3Helper (active S3/Minio client), BaseStorageHelper, multipart + content-disposition helpers
honoHTTP route context (via IGNIS)
drizzle-ormMetaLink access via PostgresCoreDataSource
@hono/zod-openapiRoute request/response schemas

Internal:

PackagePurpose
@nx/coreMetaLink 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.json

5. 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):

ControllerBase pathEndpointsAuth
AssetController/assets7mixed (read public, mutate JWT/Basic)
BanksVNController/assets/banks-vn2public
MetaLinkController/meta-links7 (CRUD)JWT/Basic (authorize skipped today)

Async topics (full reference in API Events):

DirectionCount
Inbound (Kafka)0
Outbound (Kafka)0
WebSocket out0
BullMQ jobs in0
BullMQ jobs out0

N/A — asset has no async surface. It is a synchronous REST + S3 library.

8. Components

ComponentFilePurpose
ApplicationAssetComponentsrc/components/application-asset.component.tsConstructs BunS3Helper, binds it under APPLICATION_S3_STORAGE_HELPER, registers AssetController + MetaLinkController
ApplicationAssetBanksVNComponentsrc/components/banks-vn.component.tsRegisters BanksVNController (VN bank registry + logos)

9. Services

ServiceFileOne-liner
N/A — no service layer; logic lives directly in controllers + BunS3Helper

10. Repositories

RepositoryTableSourceCustom Methods
MetaLinkRepositorypublic.MetaLinkmodel from @nx/core; thin DefaultCRUDRepository

11. Entry Points

FilePurpose
src/index.tsRe-exports components + resources for host apps; no bootstrapApplication()
src/components/*.component.tsThe two mountable IGNIS components

N/A — no application.ts, migrate.ts, or service entry. Mounted via host.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.

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