@takentrade/takentrade-libs
v4.4.0
Published
TakeNTrade shared libraries for auth, cache, logging, messaging, RPC, notification, and utilities
Maintainers
Readme
TakeNTrade Microservices Libraries
Shared libraries for the TakeNTrade microservices architecture.
This package provides shared authentication, caching, logging, messaging, RPC, notification, and utility contracts used by the service repos.
Installation
npm install @takentrade/takentrade-libsDevelopment
npm run build
npm run test
npm run typecheck
npm run format
npm run format:checkQuick Start
import { CacheModule } from '@takentrade/takentrade-libs';
import { ConfigService } from '@nestjs/config';
@Module({
imports: [
CacheModule.registerAsync({
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
host: configService.get<string>('redis.host'),
port: configService.get<number>('redis.port'),
username: configService.get<string>('redis.username'),
password: configService.get<string>('redis.password'),
}),
}),
],
})
export class AppModule {}For authentication, services can extend the shared TntBaseAuthGuard and pair it with their own JWT strategy implementation based on TntJwtStrategy.
Modules
| Module | Description | Documentation | | ------------------ | ---------------------------------------------- | ---------------------------------------------- | | Authentication | Route protection and role-based access control | docs/auth.md | | Cache | Redis-based caching with TTL support | docs/cache.md | | Logging | Shared structured logging helpers | docs/logging.md | | NATS | Microservice messaging and event streaming | docs/nats.md | | Notifications | Email, SMS, and push notifications | docs/notifications.md | | RPC | Request-response patterns for NATS | docs/rpc.md | | Common | Shared constants and utilities | docs/common.md | | Utils | DTOs, pipes, filters, and helpers | docs/utils.md |
