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.

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

titan-database does not define dedicated DI tokens. The TitanDatabaseModule registers DatabaseManager and DatabaseHealthIndicator as classes — inject them by class reference:

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 (re-exported)Redis

titan-events

TokenType
EVENTS_SERVICE_TOKENEventsService
EVENT_OPTIONS_TOKENIEventEmitterOptions
EVENT_EMITTER_TOKENEnhancedEventEmitter
EVENT_BUS_SERVICE_TOKENEventBusService
EVENT_HISTORY_SERVICE_TOKENEventHistoryService
EVENT_METADATA_SERVICE_TOKENEventMetadataService
EVENT_SCHEDULER_SERVICE_TOKENEventSchedulerService
EVENT_DISCOVERY_SERVICE_TOKENEventDiscoveryService
EVENT_VALIDATION_SERVICE_TOKENEventValidationService

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_TOKENRedis
getRedisClientToken(namespace?) factoryRedis (named instance)
getRedisOptionsToken(namespace?) factoryRedisModuleOptions

Multi-client setups use the factory form:

import { Redis } from 'ioredis';
import { getRedisClientToken } from '@omnitron-dev/titan-redis';

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

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 also register a Netron @Service so the Omnitron CLI / web console (or any remote peer) can call them.

ModuleRPC service nameWhen
titan-healthHealth@1.0.0When enableRpcService: true (default)
titan-metricsOmnitronMetricsAuto-registered when the module loads

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 does not have a feature flag for unregistering — if you don't want it on the wire, 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