System Architecture

Tarasol follows a microservices architecture with 21+ independent services communicating via HTTP REST and RabbitMQ message queues. Each service owns its data and is independently deployable.

Architecture Principles

  • Service Isolation — Each service has its own database schema and can be deployed independently
  • Event-Driven — Asynchronous communication via RabbitMQ for decoupled processing
  • Multi-Tenant — Tenant isolation at the database level with dynamic connection management
  • API Gateway — Single entry point via the Gateway service for all client traffic
  • Shared Nothing — Services don't share databases; inter-service data access is via APIs

Service Communication

Service Dependency Graph

Loading diagram...

Deployment Topology

The system is designed for containerized deployment:

  1. Infrastructure Layer — Redis, RabbitMQ, SQL Server, MongoDB, Elasticsearch
  2. Foundation Services — Identity, Tenant (must start first)
  3. Core Business Services — CMS, Correspondence, Task, Admin
  4. Support Services — Notification, Media, Search, BI, Audit, Profile
  5. Workers — Notification Workers, Media Worker
  6. Gateway — Starts last, routes to all services

Multi-Tenant Data Isolation

Multi-Tenant Database Routing

Loading diagram...

Each request carries a tenant identifier. Services dynamically connect to the appropriate tenant database based on configuration stored in the central Tarasol.MultiTenancy database.

Security Layers

LayerImplementation
TransportHTTPS / TLS
AuthenticationJWT tokens (access + refresh)
AuthorizationRole-based + Permission-based
Service-to-ServiceS2S JWT tokens
HTTP SecurityHelmet middleware
Rate Limitingexpress-rate-limit (per tenant/user)
Input ValidationClass-validator (NestJS)
File SecurityClamScan virus scanning

Monitoring Stack

  • Elastic APM — Application performance monitoring across all services
  • Elasticsearch — Centralized log aggregation
  • Prometheus — Metrics collection from each service
  • Winston — Structured JSON logging (ECS format)
  • Morgan — HTTP request logging