Introduction
Capstone #2: ShopNest Catalog API — Clean Architecture, JWT, search/filter/pagination, Azure Blob images, Redis cache, Swagger, tests, Docker Compose.
After this article you will
- Layer Domain/Application/Infrastructure/API
- Product search API with Redis cache-aside
- JWT-secured write endpoints
- Blob storage for product images
- Docker Compose + xUnit tests
Prerequisites
- Article 65 — Complete Blog Website
- Articles 1–64 ShopNest foundations (MVC, EF Core, API, auth, deploy)
Architecture & design
Projects: ShopNest.Catalog.Domain, .Application, .Infrastructure, .Api. Use patterns from Articles 36, 40, 44, 48, 60.
[Authorize(Roles = "Admin")]
[HttpPost("products")]
public async Task<ActionResult<ProductDto>> Create(CreateProductCommand cmd)
=> Ok(await _mediator.Send(cmd));Hands-on build guide — ShopNest Amazon-like Product API
- Entities: Product, Category, Review.
- GET /products?search=&category=&sort=price&page=1 with Redis.
- POST image → Azure Blob; store URL on Product.
- Integration tests with WebApplicationFactory.
- docker-compose: api + sql + redis.
Common pitfalls
- Cache not invalidated on product update — stale listings.
- Returning EF entities — use DTOs only.
Interview & portfolio questions
Q: Why Redis on catalog?
A: Read-heavy product lists; cache-aside cuts DB load 10x+ on sales.
Summary
- Production-style API capstone for ShopNest mobile/partners
- Clean Architecture + CQRS optional via MediatR
- Docker + tests demonstrate DevOps maturity
Previous: Complete Blog Website
Next: Student Management System
FAQ
Reviews on same API?
Yes — nested /products/{id}/reviews with separate validator.
Azure Blob local dev?
Use Azurite emulator or local wwwroot fallback.