How mrrobot2524/mini_marketplace works
Marketplace.Api is an HTTP marketplace backend for product catalog management and customer orders. Users can obtain JWTs, browse and maintain products, then create idempotent orders, list or retrieve their orders, and cancel pending orders. Order creation coordinates inventory, order items, and idempotency within repository transactions; retrieval uses a Redis cache, while a background service cancels expired pending orders. The graph follows sampled controllers, services, and repository excerpts; less-visible capabilities are included where the tree and excerpts support them, with uncertain wiring omitted.
Main entry points: OrderRepository.cs Order Repository · OrderService.cs Order Service · ProductRepository.cs Product Repository · RedisCacheService.cs Redis Cache Service
Components 15
HTTP API
- Products Controller
Marketplace.Api/Controllers/ProductsController.cs - Orders Controller
Marketplace.Api/Controllers/OrderController.cs
Identity
- Auth Controller
Marketplace.Api/Controllers/AuthController.cs - JWT Authentication
Marketplace.Api/Program.cs
Product Catalog
- Product Service
Marketplace.Api/Services/ProductService.cs
Order Management
- Order Service
Marketplace.Api/Services/OrderService.cs - Pending Order Worker
Marketplace.Api/Services/PendingOrderCancellationService.cs
Persistence And Cache
- Product Repository
Marketplace.Api/Repositories/ProductRepository.cs - Order Repository
Marketplace.Api/Repositories/OrderRepository.cs - Order Item Repository
Marketplace.Api/Repositories/OrderItemRepository.cs - Idempotency Repository
Marketplace.Api/Repositories/IdempotencyKeyRepository.cs - Redis Cache Service
Marketplace.Api/Services/RedisCacheService.cs - PostgreSQL
- Redis
Other components
- API Client
Connections 20
- API Client → Auth Controller: requests token
- Auth Controller → API Client: returns JWT
- API Client → JWT Authentication: presents JWT
- API Client → Products Controller: catalog requests
- Products Controller → Product Service: dispatches
- Product Service → Product Repository: manages products
- Product Repository → PostgreSQL: reads and writes
- API Client → Orders Controller: order requests
- Orders Controller → Order Service: dispatches
- Order Service → Order Repository: creates and queries
- Order Repository → Product Repository: checks stock
- Order Repository → Order Item Repository: stores and loads items
- Order Repository → Idempotency Repository: checks and saves keys
- Order Repository → PostgreSQL: runs transactions
- Order Item Repository → PostgreSQL: reads and writes
- Idempotency Repository → PostgreSQL: reads and writes
- Order Service → Redis Cache Service: gets, sets, invalidates
- Redis Cache Service → Redis: reads and writes
- Pending Order Worker → Order Repository: finds and cancels expired
- Pending Order Worker → Redis Cache Service: invalidates order cache