The backend follows a service-oriented architecture built with .NET. The key components include:
- RESTful API endpoints organized by domain entity
- Handle HTTP requests and delegate business logic to services
- Return standardized responses
- Implement business logic independent of HTTP concerns
- Interact with repositories for data access
- Handle error cases and validation
- Repository pattern for database operations
- Entity models with navigation properties for relationships
- Uses Entity Framework Core for ORM capabilities
AzureBlobStorageServicefor handling file uploads- Secure access to stored files
- File metadata management
- What: Business logic lives in dedicated service classes
- Why: Separation of concerns, enables unit testing
- Example:
MaterialServiceimplements operations on materials
- What: Azure Blob Storage for file storage
- Why: Scalable solution for storing user-uploaded content
- Example: Methods for generating URLs and managing storage containers
- What: JWT-based authentication
- Why: Stateless authentication suitable for API services
- Example: Token validation in request pipeline
- What: Resources organized hierarchically (courses contain materials, assignments)
- Why: Reflects real-world relationships and simplifies access control
- Example: Endpoints like
/course/{id}/materials
- Inconsistent null handling in several services
- Consider using Result pattern or nullable reference types more effectively
- Implement global exception handling middleware
- Add comprehensive input validation
- Use data annotations or FluentValidation for consistent validation rules
- Ensure client receives clear validation error messages
- Implement Swagger/OpenAPI documentation
- Document expected request/response formats
- Generate client SDKs for frontend consumption
- Add caching layer for frequently accessed data
- Optimize database queries (missing indexes, N+1 query problems)
- Consider implementing batch operations for bulk changes
- Audit authorization logic
- Implement resource-based permissions
- Add rate limiting to prevent abuse
- Expand unit test coverage
- Add integration tests for API endpoints
- Implement automated testing for critical workflows