Skip to main content

Tokens & RPC reference

A single-page lookup for every DI token a Titan module exports and every Netron RPC service a module registers. Useful when you can't remember which token you need to inject, or when reviewing the external RPC surface of an app for security/audit purposes.

The token list is checked against the packages by a script rather than asserted to have been verified — run it yourself:

node internal/website/scripts/check-titan-inventories.mjs .

It exits non-zero if this page names a token no Titan package exports.

Built-in module tokens

Built-in@omnitron-dev/titan

Ships inside @omnitron-dev/titan. No additional install required.

config (@omnitron-dev/titan/module/config)

TokenType
CONFIG_SERVICE_TOKENConfigService
CONFIG_OPTIONS_TOKENIConfigModuleOptions
CONFIG_SCHEMA_TOKENunknown (Zod schema)
CONFIG_LOADER_SERVICE_TOKENConfigLoaderService
CONFIG_VALIDATOR_SERVICE_TOKENConfigValidatorService
CONFIG_WATCHER_SERVICE_TOKENConfigWatcherService

logger (@omnitron-dev/titan/module/logger)

TokenType
LOGGER_SERVICE_TOKENILoggerModule
LOGGER_TOKENILogger (root logger instance)
LOGGER_OPTIONS_TOKENILoggerOptions
LOGGER_TRANSPORTS_TOKENITransport[]
LOGGER_PROCESSORS_TOKENILogProcessor[]

Official module tokens

Official@omnitron-dev/titan-*

Maintained by the Omnitron team. Independent npm package.

titan-auth

TokenType
AUTH_OPTIONS_TOKENIAuthModuleOptions
AUTH_MIDDLEWARE_TOKENIAuthMiddleware
JWT_SERVICE_TOKENIJWTService
SIGNED_URL_SERVICE_TOKENISignedUrlService

titan-cache

TokenType
CACHE_SERVICE_TOKENICacheService
CACHE_OPTIONS_TOKENICacheModuleOptions
CACHE_DEFAULT_TOKENICache (default cache instance)
CACHE_ADAPTER_TOKENCacheAdapter
CACHE_ADAPTER_OPTIONS_TOKENICacheAdapterOptions

titan-database

TokenType
DATABASE_MANAGERDatabaseManager
DATABASE_MODULE_OPTIONSDatabaseModuleOptions
DATABASE_CONNECTIONKysely (default connection)
DATABASE_HEALTH_INDICATORDatabaseHealthIndicator

The tokens are Symbol.for('titan:…') symbols, but DatabaseManager and DatabaseHealthIndicator are also registered against their class references, so you can inject either way:

constructor(private readonly db: DatabaseManager) {}

For forFeature(...) repository registration, the per-repository tokens are generated from the repository class name. See the titan-database page for forFeature patterns.

titan-discovery

TokenType
DISCOVERY_SERVICE_TOKENIDiscoveryService
DISCOVERY_OPTIONS_TOKENDiscoveryOptions
NETRON_DISCOVERY_INTEGRATION_TOKENNetronDiscoveryIntegration
REDIS_TOKEN (module-local)Redis

titan-discovery exports its own REDIS_TOKEN (createToken('TitanDiscovery:Redis')) — it is not the same symbol as titan-redis's REDIS_MANAGER. Supply a client against this token, or let the module create one from its options.

titan-events

TokenType
EVENTS_SERVICE_TOKENEventsService
EVENT_OPTIONS_TOKENIEventEmitterOptions
EVENT_EMITTER_TOKENEnhancedEventEmitter
EVENT_BUS_SERVICE_TOKENEventBusService
EVENT_HISTORY_SERVICE_TOKENEventHistoryService
EVENT_SCHEDULER_SERVICE_TOKENEventSchedulerService
EVENT_VALIDATION_SERVICE_TOKENEventValidationService

EVENT_METADATA_SERVICE_TOKEN and EVENT_DISCOVERY_SERVICE_TOKEN exist internally but are not re-exported from the package barrel — their backing services are module-private. The seven tokens above are the public DI surface.

titan-health

TokenType
HEALTH_SERVICE_TOKENIHealthService
HEALTH_MODULE_OPTIONS_TOKENHealthModuleOptions
HEALTH_RPC_SERVICE_TOKENHealthRpcService
MEMORY_HEALTH_INDICATOR_TOKENMemoryHealthIndicator
EVENT_LOOP_HEALTH_INDICATOR_TOKENEventLoopHealthIndicator
DISK_HEALTH_INDICATOR_TOKENDiskHealthIndicator
DATABASE_HEALTH_INDICATOR_TOKENDatabaseHealthIndicator
REDIS_HEALTH_INDICATOR_TOKENRedisHealthIndicator

titan-lock

TokenType
LOCK_SERVICE_TOKENIDistributedLockService
LOCK_OPTIONS_TOKENILockModuleOptions

titan-metrics

TokenType
METRICS_SERVICE_TOKENIMetricsService
METRICS_OPTIONS_TOKENIMetricsModuleOptions
METRICS_STORAGE_TOKENIMetricsStorage

titan-notifications

Note the trailing _TOKEN is omitted in this package's naming convention — symbols are bare:

TokenType
NOTIFICATIONS_SERVICENotificationsService
NOTIFICATIONS_MODULE_OPTIONSNotificationsModuleOptions
NOTIFICATIONS_TRANSPORTMessagingTransport
NOTIFICATIONS_CHANNEL_REGISTRYChannelRegistry
NOTIFICATIONS_CHANNEL_ROUTERIChannelRouter
NOTIFICATIONS_TEMPLATE_ENGINETemplateEngine
NOTIFICATIONS_PREFERENCE_STOREIPreferenceStore
NOTIFICATIONS_REDIS_PREFERENCE_STORERedisPreferenceStore
NOTIFICATIONS_RATE_LIMITERIRateLimiter
NOTIFICATIONS_REDIS_RATE_LIMITERRedisRateLimiter
NOTIFICATIONS_EVENT_EMITTERNotificationsEventEmitter
NOTIFICATIONS_HEALTHNotificationsHealthIndicator
NOTIFICATION_PERSISTERINotificationPersister
NOTIFICATION_REALTIME_SIGNALERINotificationRealtimeSignaler
NOTIFICATION_TARGET_RESOLVERINotificationTargetResolver

titan-pm

TokenType
PM_CONFIG_TOKENIProcessManagerConfig
PM_MANAGER_TOKENProcessManager
PM_REGISTRY_TOKENProcessRegistry
PM_SPAWNER_TOKENProcessSpawnerFactory
PM_HEALTH_TOKENProcessHealthChecker
PM_METRICS_TOKENProcessMetricsCollector

titan-ratelimit

TokenType
RATE_LIMIT_SERVICE_TOKENIRateLimitService
RATE_LIMIT_OPTIONS_TOKENIRateLimitModuleOptions
RATE_LIMIT_STORAGE_TOKENIRateLimitStorage

titan-redis

SymbolType
REDIS_MANAGERRedisManager
REDIS_MODULE_OPTIONSRedisModuleOptions
getRedisClientToken(namespace?) factoryIRedisClient (named instance)

The default client is injected with the @InjectRedis() decorator; getRedisClientToken(namespace) is the per-namespace token used for multi-client setups. (titan-redis exports no REDIS_TOKEN — its manager token is REDIS_MANAGER. Note that titan-discovery does export a REDIS_TOKEN of its own, for the client it injects; the two are unrelated, so check which package an import comes from.)

import { getRedisClientToken, type IRedisClient }
from '@omnitron-dev/titan-redis';

@Inject(getRedisClientToken('cache')) cacheRedis: IRedisClient;
@Inject(getRedisClientToken('queue')) queueRedis: IRedisClient;

titan-scheduler

TokenType
SCHEDULER_SERVICE_TOKENSchedulerService
SCHEDULER_CONFIG_TOKENISchedulerConfig
SCHEDULER_REGISTRY_TOKENSchedulerRegistry
SCHEDULER_EXECUTOR_TOKENSchedulerExecutor
SCHEDULER_PERSISTENCE_TOKENISchedulerPersistence
SCHEDULER_DISCOVERY_TOKENSchedulerDiscovery
SCHEDULER_METRICS_TOKENSchedulerMetricsCollector
SCHEDULER_LISTENERS_TOKENIJobListener[]

titan-telemetry-relay

titan-telemetry-relay does not define DI tokens. Instantiate TelemetryRelayService directly with config; wire it into the container as a useValue provider if you want DI-style injection.

Importing tokens — the convention

Every module exports both the token and its type from the package root so you can pull them in one line:

import {
CACHE_SERVICE_TOKEN,
type CacheService,
} from '@omnitron-dev/titan-cache';

class UsersService {
constructor(
@Inject(CACHE_SERVICE_TOKEN) private readonly cache: CacheService,
) {}
}

Why named tokens, not classes? Tokens decouple the contract from the implementation. Test code can register a fake CacheService against the same token without subclassing the production class.

RPC services — what's reachable from the wire

Most modules expose their API only via DI inside the same process. Two modules ship a Netron @Service class so the Omnitron CLI / web console (or any remote peer) can call them.

ModuleRPC service nameWhen
titan-healthHealth@1.0.0HealthRpcService is provided by the module when enableRpcService: true (default)
titan-metricsOmnitronMetricsMetricsRpcService is exported, not auto-provided — register it yourself (the Omnitron daemon does)

Everything else (titan-auth, titan-cache, titan-database, titan-discovery, titan-events, titan-lock, titan-notifications, titan-pm, titan-ratelimit, titan-redis, titan-scheduler, titan-telemetry-relay) does not contribute an RPC surface. It's your own @Service classes that own the wire contract; the modules provide infrastructure consumed via DI.

Note about titan-pm — it does not expose a pm@… service; it calls netron.peer.exposeService(...) on your worker instances when they boot. The exposed services are the ones you wrote.

Note about titan-discovery — its registerService method is internal API for adding entries to the Redis registry, not an RPC endpoint. Discovery lookups happen in-process via DI.

Disabling the health RPC surface — pass enableRpcService: false:

TitanHealthModule.forRoot({
enableRpcService: false, // local checks still work
})

OmnitronMetrics is reachable only if you registered MetricsRpcService yourself — it has no module feature flag. If you don't want it on the wire, simply don't register it (or control exposure at the transport layer: don't expose the Netron port externally, or front it with auth-only middleware).

Health RPC surface — Health@1.0.0

The single canonical example. Source: packages/titan-health/src/health.rpc-service.ts.

const health = await peer.queryInterface<HealthRpcService>('Health@1.0.0');

await health.check(); // full report
await health.live(); // liveness
await health.ready(); // readiness

The exact method set is HealthRpcService — refer to its @Public() decorators in source for the current surface.

Hardening checklist

Before exposing the Netron port outside the cluster:

  • Configure titan-auth with a strong JWT secret / JWKS endpoint.
  • Apply @Auth(...) on every @Public() method that touches state.
  • Front the port with TLS termination (transport options).
  • Run titan-ratelimit middleware globally on Netron.
  • Set enableRpcService: false on titan-health if probes are served via plain HTTP routes and you don't want the JSON endpoint reachable as RPC.
  • Review every @Service you wrote — those are the actual external surface.

See also