- CoreModule: Global configuration, database connection, and shared services
- MessagingModule: Multi-provider messaging system (RabbitMQ, NATS, Redis)
- HealthModule: Application health monitoring
- SeederModule: Database seeding and testing utilities
- TaskModule: Task CRUD operations, status management, and persistence
- WorkerModule: Task execution engine with unified worker pattern
- QueueModule: Queue management, load balancing, and monitoring
- SchedulerModule: Task scheduling (one-time and recurring)
- WorkflowModule: Workflow definition and orchestration
- InvoiceModule: Complete invoice processing workflow
┌─────────────────────────────────────────────────────────────┐
│ API Layer │
├─────────────────────────────────────────────────────────────┤
│ Controllers: Task, Queue, Scheduler, Invoice, Workflow │
├─────────────────────────────────────────────────────────────┤
│ Service Layer │
├─────────────────────────────────────────────────────────────┤
│ TaskService │ QueueService │ SchedulerService │
│ WorkerService │ WorkflowService│ InvoiceService │
├─────────────────────────────────────────────────────────────┤
│ Messaging Layer │
├─────────────────────────────────────────────────────────────┤
│ MessagingService (Factory Pattern) │
│ ├─ RabbitMQProvider │
│ ├─ NatsProvider │
│ └─ RedisProvider │
├─────────────────────────────────────────────────────────────┤
│ Data Layer │
├─────────────────────────────────────────────────────────────┤
│ PostgreSQL: Tasks, Workflows, TaskLogs │
└─────────────────────────────────────────────────────────────┘
- Abstract
BaseProviderinterface - Concrete implementations for each message broker
MessagingFactoryServicefor provider instantiation
- Single worker handles all task types
- EventPattern for fire-and-forget semantics
- Automatic retry and compensation logic
- Workflow definitions stored in database
- Task dependency management
- Status tracking and error handling
- Configurable message broker selection
- Consistent API across providers
- Environment-specific configurations
- Task Creation: API → TaskService → Database + Queue
- Task Processing: Queue → Worker → TaskProcessor → External Services
- Workflow Execution: InvoiceService → Multiple Tasks → Status Updates
- Scheduling: SchedulerService → Cron Jobs → Task Creation
- Framework: NestJS with TypeScript
- Database: PostgreSQL with TypeORM
- Message Brokers: RabbitMQ, NATS, Redis
- Testing: Jest with comprehensive coverage
- Containerization: Docker with multi-stage builds