tarasol-common

TypeScript Library

The tarasol-common package is the shared library consumed by all NestJS microservices. It provides common DTOs, utility functions, RabbitMQ queue definitions, and shared middleware.

Contents

  • DTOs — Shared data transfer objects for inter-service communication
  • Queue Definitions — RabbitMQ exchange, queue, and routing key constants
  • Utilities — Common helper functions used across services
  • Middleware — Shared NestJS middleware (auth, logging, tenant resolution)
  • Decorators — Custom NestJS decorators for common patterns
  • Interfaces — Shared TypeScript interfaces and types
  • Constants — System-wide constants and configuration values

Usage

import {
  CreateCorrespondenceDto,
  RABBITMQ_EXCHANGES,
  TenantMiddleware,
  AuthGuard
} from '@tarasol/common';

Key Exports

CategoryExamples
DTOsCreateCorrespondenceDto, UpdateTaskDto, NotificationPayload
Queue DefsEXCHANGES, QUEUES, ROUTING_KEYS
GuardsAuthGuard, TenantGuard, RolesGuard
MiddlewareTenantMiddleware, LoggingMiddleware
Decorators@CurrentUser(), @TenantId(), @Roles()
InterfacesIUser, ITenant, ICorrespondence
Tip

When adding new shared functionality, add it to tarasol-common rather than duplicating across services. Run npm run build in the common package and update the version in consuming services.