API Client Registry (Provider-only)
Overview
The api_client table records which external systems connect into the platform. It works alongside
API Keys, which is the part that actually has a management UI.
On the cms-api side this module exposes no HTTP routes at all — the original NestJS module
declared controllers: []. What it does provide is an exported ApiClientRepository for other
modules to use.
Its real consumer is Audience Management, which needs to resolve which client owns a given data source when building an audience from external data.
This page exists as its own feature entry so readers who spot the module name in
cmd/api/modules.go and then fail to find any routes are not left guessing.
Business Flow
apiclient.RegisterRoutesis called fromcmd/api/modules.gounder the same contract as every other module, but its body is intentionally empty, marked with the commentIntentionally empty — ApiClientModule has controllers: [].- Modules that need it construct the service themselves via
apiclient.NewService(deps). - The service offers a flexible query interface: the caller passes in a GORM query-scope callback,
standing in for TypeORM's
FindManyOptionsandFindOneOptions, so where clauses and relations can still be expressed the same way. - Soft deletes are handled automatically. The entity declares
gorm.DeletedAt, so GORM appendsdeleted_date IS NULLon its own — matching the TypeORM@DeleteDateColumnthat was not configured withselect:false. - The audience service uses the result when resolving that audience's data source and permissions.
Key Files & Functions
The code lives in internal/modules/apiclient/.
| File | Role |
|---|---|
controller.go | RegisterRoutes(_, _, _) — intentionally a no-op (0 routes) |
service.go | Service, a port of ApiClientRepository, with a stateless NewService(d) |
Endpoints: none
Connections to Other Services
- Permission — no routes, therefore no guards.
- Tables —
api_client. - Consumers — Audience Management (the TypeScript audience.service injected
ApiClientRepository). - Related — API Key, the module that carries the actual management UI.