Skip to content

Infrastructure Overview

The banyan-core platform runs on Docker Compose with a complete infrastructure stack. All infrastructure is abstracted away from services - developers write pure business logic while the platform handles messaging, databases, observability, and more.

ComponentPurposePortTechnology
Message BusInter-service communication5672, 15672RabbitMQ 3.13
Event StoreEvent sourcing database5432PostgreSQL 16
CacheQuery caching, sessions6379Redis 7
Distributed TracingRequest tracing16686, 4318Jaeger 2.9
MetricsService metrics storage9200Elasticsearch 8.11
DashboardsObservability UI3000Grafana 11.5
ServicePurposePortImplementation
API GatewayExternal HTTP/GraphQL/WebSocket3003TypeScript
Service DiscoveryContract registry3002TypeScript
Auth ServiceUser authentication3001TypeScript
┌─────────────────────────────────────────────────────────┐
│ External Clients │
│ (REST, GraphQL, WebSocket) │
└────────────────────┬────────────────────────────────────┘
┌─────────────────────────────────────────────────────────┐
│ API Gateway (Port 3003) │
│ • Protocol Translation • Authentication │
│ • Rate Limiting • Permission Checks │
└────────────────────┬────────────────────────────────────┘
┌─────────────────────────────────────────────────────────┐
│ RabbitMQ Message Bus (Port 5672) │
│ • Command/Query Routing • Event Publishing │
│ • Queue Management • Message Persistence │
└─────┬──────────────┬──────────────┬─────────────────────┘
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────────────────┐
│ Service │ │ Service │ │ Platform Services │
│ A │ │ B │ │ • Auth (3001) │
│ │ │ │ │ • Discovery (3002) │
└────┬─────┘ └────┬─────┘ └──────────┬───────────┘
│ │ │
└─────────────┴───────────────────┘
┌─────────────────────────────┐
│ PostgreSQL Event Store │
│ • Events • Snapshots │
│ • Projections • Metadata │
└─────────────────────────────┘
// Pure business logic - NO infrastructure code
@CommandHandler(CreateUserContract)
export class CreateUserHandler {
async handle(input: { email: string; name: string }) {
const user = await this.userRepository.create({
email: input.email,
name: input.name
});
return user;
}
}
  • Message routing via RabbitMQ
  • Database connections to PostgreSQL
  • Caching with Redis
  • Distributed tracing with Jaeger
  • Metrics collection with Elasticsearch
  • Error handling and retries
  • Authentication context propagation
  • Correlation ID propagation
Terminal window
# Start all infrastructure + platform services
docker compose up
# Start specific services
docker compose up postgres rabbitmq redis
# View logs
docker compose logs -f
# Stop all
docker compose down
# Reset (delete data)
docker compose down -v

Services start in dependency order:

  1. PostgreSQL (database)
  2. Elasticsearch (metrics storage)
  3. RabbitMQ (message bus)
  4. Redis (cache)
  5. Jaeger (tracing - depends on Elasticsearch)
  6. Grafana (dashboards - depends on Elasticsearch/Jaeger)
  7. Platform Services (depend on all infrastructure)
ServiceContainer PortHost PortURL
API Gateway30033003http://localhost:3003
Auth Service30013001http://localhost:3001
Service Discovery30023002http://localhost:3002
RabbitMQ Management1567255672http://localhost:55672
PostgreSQL543255432localhost:55432
Redis637956379localhost:56379
Jaeger UI1668616686http://localhost:16686
Grafana30005005http://localhost:5005
Elasticsearch92009200http://localhost:9200

Services communicate via Docker network flow-platform-network:

services:
api-gateway:
environment:
RABBITMQ_URL: amqp://admin:admin123@rabbitmq:5672
DATABASE_URL: postgresql://actor_user:actor_pass123@postgres:5432/eventstore
REDIS_URL: redis://:redis123@redis:6379
JAEGER_ENDPOINT: http://jaeger:4318/v1/traces

Docker volumes persist data across restarts:

volumes:
postgres-data: # Event store database
rabbitmq-data: # Message queue persistence
redis-data: # Cache data
elasticsearch-data: # Metrics and traces
jaeger-data: # Trace storage
grafana-data: # Dashboard configurations
Terminal window
# View volumes
docker volume ls | grep flow-platform
# Inspect volume
docker volume inspect flow-platform-postgres-data
# Backup PostgreSQL
docker exec flow-platform-postgres pg_dump -U actor_user eventstore > backup.sql
# Restore PostgreSQL
docker exec -i flow-platform-postgres psql -U actor_user eventstore < backup.sql

All services include health checks:

Terminal window
# Check service health
docker compose ps
# Detailed health status
docker inspect flow-platform-postgres | grep -A10 Health
# Wait for healthy
docker compose up --wait
Terminal window
# RabbitMQ
curl http://localhost:55672/api/health/checks/alarms
# PostgreSQL
docker exec flow-platform-postgres pg_isready -U actor_user
# Redis
docker exec flow-platform-redis redis-cli ping
# Elasticsearch
curl http://localhost:9200/_cluster/health

Development Only - Change in production!

ServiceUsernamePassword
RabbitMQadminadmin123
PostgreSQLactor_useractor_pass123
Redis(none)redis123
Grafanaadminadmin
Terminal window
# .env file or docker-compose.yml
NODE_ENV=development
DATABASE_HOST=postgres
DATABASE_PORT=5432
DATABASE_NAME=eventstore
DATABASE_USER=actor_user
DATABASE_PASSWORD=actor_pass123
RABBITMQ_URL=amqp://admin:admin123@rabbitmq:5672
REDIS_URL=redis://:redis123@redis:6379
JAEGER_ENDPOINT=http://jaeger:4318/v1/traces
JWT_SECRET=dev-secret-key-change-in-production
JWT_EXPIRATION=300

All services run on flow-platform-network:

networks:
flow-platform-network:
driver: bridge
name: flow-platform-network

Services resolve each other by name:

// In service code
const dbUrl = 'postgresql://actor_user:actor_pass123@postgres:5432/eventstore';
const mqUrl = 'amqp://admin:admin123@rabbitmq:5672';
const redisUrl = 'redis://:redis123@redis:6379';
services:
postgres:
deploy:
resources:
limits:
memory: 1G
reservations:
memory: 512M
elasticsearch:
environment:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"

Edit docker-compose.yml for your needs:

services:
postgres:
deploy:
resources:
limits:
memory: 2G # Increase for production

Check logs:

Terminal window
docker compose logs rabbitmq
docker compose logs postgres

Common issues:

  • Port already in use: Change host port mapping
  • Volume corruption: docker compose down -v
  • Resource exhaustion: Increase Docker memory

Cause: Service not ready or wrong hostname

Solution:

Terminal window
# Check service is running
docker compose ps
# Check network connectivity
docker exec flow-platform-devbox ping postgres
docker exec flow-platform-devbox ping rabbitmq

Cause: Volumes not properly configured

Solution:

Terminal window
# Verify volumes exist
docker volume ls | grep flow-platform
# Check volume mounts
docker inspect flow-platform-postgres | grep -A5 Mounts