How edu-trailblaze/edu-trailblaze-be works
Project type and purpose
• This is a cloud-ready, backend-only solution for an online course platform (EduTrailblaze).
• It combines a modular monolith (EduTrailblaze.API + Entities + Repositories + Services) with a microservice (Cart.API) and an Ocelot API Gateway.
• It uses DDD-style layers, an event-driven style (EventBus/Consumers), CQRS in at least one service, and shared BuildingBlocks libraries.
File structure
• Top-level “EduTrailblaze” solution:
• EduTrailblaze.API (ASP.NET Core WebAPI controllers, middleware, DI extensions, SignalR hubs, Hangfire)
• EduTrailblaze.Entities (POCOs/entity definitions)
• EduTrailblaze.Repositories (EF DbContext, generic repository, unit-of-work)
• EduTrailblaze.Services (business logic, DTOs, mapping profiles, helpers, external integrations, event consumers, SignalR Hubs)
• EduTrailblaze.Tests (unit tests)
• OcelotApiGw (API Gateway for routing to monolith & services)
• Under “src”:
• BuildingBlocks (common logging, contracts, event‐bus messages, infrastructure, shared seedwork)
• Services/Cart (microservice following layered architecture + CQRS using MediatR‐style Commands/Queries)
README points
• ASP.NET Core Web API with Identity for auth & JWT
• SQL Server as primary datastore
• Redis for caching/locks
• Elasticsearch for search
• SignalR for real‐time notifications
• Hangfire for background jobs
• Generative AI & fine-tuned AI integration
• Payment providers: PayPal, MoMo, VNPAY
• Cloudinary & ClamAV & Windows Defender for media/security
a. Clients
• Web/Mobile frontend (React, Angular, etc.)
b. API Gateway
• Ocelot routing layer
c. Monolithic Backend (“EduTrailblaze.API”)
• Controllers → Services → Repositories → SQL Server
• SignalR Hub for real-time updates
• Hangfire server for scheduled/background jobs
• EventBus publisher to RabbitMQ (via BuildingBlocks.EventBus)
d. Microservices
• Cart.API service (Controllers → Application layer (CQRS) → Domain → Infrastructure → SQL Server)
• (Other future microservices follow same template)
e. Shared BuildingBlocks
• Contracts library (interfaces, base entities)
• Infrastructure (repository base, unit‐of‐work, AutoMapper extensions, common logging)
• EventBus.Messages (integration events definitions)
f. External Systems
• Redis (cache, distributed locks)
• Elasticsearch (search indices)
• Identity (ASP.NET Identity store, JWT issuer)
• Payment Gateways (PayPal, MoMo, VNPAY)
• Cloudinary (media upload)
• ClamAV / Windows Defender (virus scanning)
• External AI provider (OpenAI)
Relationships and data flows
• Clients → (HTTP + JWT) → API Gateway → proper backend (monolith or microservice)
• Controllers call into business Services (or MediatR handlers)
• Services call Repositories → SQL Server
• Services publish domain events → RabbitMQ → subscribed Consumers in monolith or other services
• Background tasks (Hangfire) invoked by API or scheduled → Services → Repositories
• SignalR pushes notifications from Services → Clients over WebSocket
• Cache reads/writes via Redis from Services
• Search writes/reads via Elasticsearch from Services
• External calls from Services to Payment / AI / Cloudinary / ClamAV
Architectural patterns & principles
• Layered (API → Application/Services → Domain/Entities → Infrastructure/Repositories)
• DDD boundaries: Entities, Repositories, Services
• CQRS pattern in Cart microservice (Commands vs Queries)
• API Gateway pattern (Ocelot)
• Event‐driven integration (RabbitMQ/EventBus, Consumers)
• Shared libraries for cross‐cutting concerns (BuildingBlocks)
• Background processing (Hangfire)
• Real‐time messaging (SignalR)
Important reminders
• Be detailed: capture all layers (API, Biz Logic, Domain, Infrastructure).
• Don’t over-simplify: include shared BuildingBlocks and event flows.