Capstone Project Requirements
Project: E-Commerce API with Advanced EF Core
Build a production-quality e-commerce API demonstrating all EF Core concepts and patterns.
Domain Model
Entities
// Products
- Product (Id, SKU, Name, Description, Price, StockQuantity, IsActive, IsDeleted, CreatedDate, ModifiedDate, RowVersion)
- Category (Id, Name, ParentId, IsActive)
- ProductCategory (ProductId, CategoryId)
- ProductImage (Id, ProductId, Url, IsPrimary)
// Orders
- Order (Id, OrderNumber, CustomerId, OrderDate, Status, TotalAmount, IsDeleted, RowVersion)
- OrderItem (Id, OrderId, ProductId, Quantity, UnitPrice, Discount)
// Customers
- Customer (Id, Email, FirstName, LastName, Phone, IsActive, CreatedDate)
- Address (Id, CustomerId, Street, City, State, ZipCode, IsDefault)
// Reviews
- ProductReview (Id, ProductId, CustomerId, Rating, Comment, ReviewDate)
// Audit
- AuditLog (Id, EntityName, EntityId, Action, UserId, Timestamp, Changes)
Required Features
1. Relationships
- One-to-Many: Category → Products, Customer → Orders
- Many-to-Many: Products ↔ Categories
- One-to-One: Order → ShippingAddress
- Self-Referencing: Category hierarchy
2. Query Optimization
- No N+1 query problems
- Use AsNoTracking for read-only queries
- Implement projection for DTOs
- Use compiled queries for hot paths
- Implement pagination
- Use AsSplitQuery for multiple includes
3. Advanced Patterns
- Global query filter for soft delete
- Global query filter for active records
- Optimistic concurrency on Orders and Products
- Interceptor for audit logging
- Interceptor for slow query detection
- Connection resiliency with retry policy
4. Indexing
- Unique index on Product.SKU
- Unique index on Customer.Email
- Composite index on (OrderDate, CustomerId)
- Filtered index on active products
- Covering index for common queries
5. Performance
- DbContext pooling enabled
- All list endpoints paginated
- Bulk operations for imports
- Caching for frequently accessed data
- Query tags for monitoring
API Endpoints
Products
GET /api/products - List with pagination, filters
GET /api/products/{id} - Get with reviews and images
POST /api/products - Create
PUT /api/products/{id} - Update
DELETE /api/products/{id} - Soft delete
GET /api/products/category/{id} - By category with optimization
Orders
GET /api/orders - List customer orders
GET /api/orders/{id} - Order details with items
POST /api/orders - Create order (handles concurrency)
PUT /api/orders/{id}/status - Update status
GET /api/orders/customer/{id} - Customer order history
Categories
GET /api/categories - Tree structure
GET /api/categories/{id} - With products count
POST /api/categories - Create
PUT /api/categories/{id} - Update
Architecture
src/
├── Domain/
│ ├── Entities/
│ ├── Enums/
│ └── Interfaces/
├── Infrastructure/
│ ├── Data/
│ │ ├── Configurations/
│ │ ├── Interceptors/
│ │ │ ├── AuditInterceptor.cs
│ │ │ └── SlowQueryInterceptor.cs
│ │ ├── Migrations/
│ │ └── AppDbContext.cs
│ └── Repositories/
├── Application/
│ ├── DTOs/
│ ├── Services/
│ └── Specifications/
└── WebApi/
├── Controllers/
├── Middleware/
└── Program.cs
tests/
├── UnitTests/
├── IntegrationTests/
└── PerformanceTests/
Implementation Steps
Phase 1: Domain & Infrastructure
- Create all entities
- Implement IEntityTypeConfiguration for each
- Configure relationships and constraints
- Add seed data
- Create initial migration
Phase 2: Core Features
- Implement repositories (if using pattern)
- Create DTOs
- Implement basic CRUD operations
- Add validation
Phase 3: Query Optimization
- Identify and fix N+1 problems
- Add AsNoTracking where appropriate
- Implement projection for list endpoints
- Add compiled queries
- Implement pagination
Phase 4: Advanced Features
- Add global query filters
- Implement optimistic concurrency
- Create audit interceptor
- Add slow query interceptor
- Configure connection resiliency
Phase 5: Testing & Benchmarking
- Write integration tests
- Create performance benchmarks
- Test concurrency scenarios
- Validate soft delete behavior
- Test pagination
Deliverables
Code
- Complete source code on GitHub
- All tests passing
- Clean, well-organized structure
- Comprehensive comments
Documentation
- README with setup instructions
- Architecture decision records
- API documentation
- Performance optimization notes
Benchmarks
- Before/after optimization metrics
- Query performance comparisons
- Memory usage analysis
- Concurrency test results
Success Criteria
- All endpoints working correctly
- No N+1 query problems (verified with logging)
- All tests passing
- Performance benchmarks show optimizations
- Soft delete working across all entities
- Concurrency handling works correctly
- Audit log captures all changes
- Code is production-ready quality
Bonus Challenges
- Implement Redis caching
- Add full-text search
- Implement CQRS with MediatR
- Add event sourcing for order history
- Implement multi-tenancy
- Add GraphQL endpoint
- Implement real-time notifications with SignalR
- Add distributed tracing
Time Estimate
~40-50 hours over 7-10 days