Gateway Service

Express.js:80Core

The Gateway Service is the single entry point for all external traffic into the Tarasol platform. Built with Express.js and TypeScript, it provides centralized authentication, rate limiting, request routing, and session management.

Architecture

Gateway Service Architecture

Loading diagram...

Key Features

  • Request Routing — Proxies requests to 12+ backend services based on URL path
  • JWT Validation — Validates access tokens on every request
  • Rate Limiting — Per-tenant and per-user throttling via express-rate-limit
  • Session Management — Redis-backed session storage
  • Security Headers — Helmet middleware for XSS, HSTS, CSP
  • CORS — Configurable cross-origin request handling
  • Health Checks — Monitors connectivity to all downstream services

Routing Table

Path PrefixTarget ServicePort
/api/tenantTenant Service:8001
/api/notificationNotification Service:8002
/api/cmsCMS Service:8003
/api/adminAdmin Service:8004
/api/mediaMedia Service:8005
/api/biBI Service:8006
/api/electronicElectronic Service:8007
/api/correspondenceCorrespondence Service:8008
/api/taskTask Service:8014
/api/searchSearch Service:8015
/api/identityIdentity Service:8016
/api/profileProfile Service:8017

API Endpoints

GET
/health

Gateway health check — returns status of all downstream services

Configuration

NameTypeDefaultDescription
PORTnumber80Gateway listening port
REDIS_HOSTstringlocalhostRedis host for session store
REDIS_PORTnumber6379Redis port
JWT_SECRETstring-JWT signing secret (must match Identity)
RATE_LIMIT_MAXnumber100Max requests per rate limit window
RATE_LIMIT_WINDOWstring15mRate limit window duration
HELMET_ENABLEDbooleantrueEnable Helmet security headers
CORS_ORIGINstring*Allowed CORS origins

Dependencies

  • Redis — Session storage and token caching
  • All Backend Services — Proxied traffic destinations
  • Identity Service — JWT validation

Startup Order

The Gateway should start last after all downstream services are healthy. This ensures all proxy targets are available.