A comprehensive e-learning platform backend built with Clean Architecture principles using ASP.NET Core 9.0. The IlmPath API provides a robust foundation for managing online courses, user authentication, payments, video streaming, and AI-powered features.
- Frontend Application: IlmPath Frontend - Angular 19 with Material Design
This project follows Clean Architecture principles with clear separation of concerns across four distinct layers:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Presentation Layer β
β (IlmPath.Api) β
β β’ Controllers β’ Middleware β’ DTOs β’ Swagger β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Application Layer β
β (IlmPath.Application) β
β β’ Use Cases β’ Commands/Queries β’ Interfaces β’ DTOs β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Infrastructure Layer β
β (IlmPath.Infrastructure) β
β β’ Data Access β’ External Services β’ Repositories β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Domain Layer β
β (IlmPath.Domain) β
β β’ Entities β’ Business Rules β’ Domain Logic β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- π― Domain Layer: Core entities, business rules, and domain logic
- π§ Application Layer: Use cases, CQRS commands/queries, and business orchestration
- β‘ Infrastructure Layer: Data persistence, external API integrations, and third-party services
- π API Layer: REST endpoints, authentication, authorization, and API documentation
- Course Creation & Management: Full CRUD operations for courses
- Section & Lecture Organization: Hierarchical content structure
- Video Upload & Streaming: Integration with Google Cloud Storage
- Course Categories: Organized learning paths
- Course Ratings & Reviews: Student feedback system
- JWT Authentication: Secure token-based authentication
- Role-Based Authorization: Admin, Instructor, and Student roles
- User Profiles: Customizable user profiles with image upload
- User Registration & Login: Secure account management
- Stripe Integration: Secure payment processing
- Shopping Cart: Redis-powered cart management
- Coupon System: Flexible discount management
- Invoice Generation: Automated billing system
- Instructor Payouts: Revenue sharing with instructors
- Admin Dashboard: Comprehensive analytics
- Revenue Tracking: Financial reporting
- User Analytics: Engagement metrics
- Course Performance: Learning analytics
- AI Chat Assistant: Hugging Face integration for student support
- Smart Recommendations: Personalized learning suggestions
- Enrollment System: Course registration and tracking
- Bookmarks: Save favorite courses and content
- Progress Tracking: Monitor learning progress
- Certificates: Course completion certificates
- Runtime: .NET 9.0
- Framework: ASP.NET Core 9.0
- ORM: Entity Framework Core 9.0
- Database: SQL Server
- Authentication: JWT Bearer Tokens
- Documentation: Swagger/OpenAPI
- Payment Processing: Stripe API
- Video Storage: Google Cloud Storage
- Video Processing: FFMpeg
- Caching: Redis (StackExchange.Redis)
- AI Services: Hugging Face API
- Email Services: SMTP Configuration
- Architecture Pattern: CQRS with MediatR
- Object Mapping: AutoMapper
- Validation: FluentValidation
- Result Handling: FluentResults
- API Testing: Swagger UI
Before running the application, ensure you have:
- .NET 9.0 SDK or later
- SQL Server (LocalDB, Express, or Full)
- Redis Server (for caching and cart management)
- Visual Studio 2022 or VS Code (recommended)
- Google Cloud Storage Account (for video uploads)
- Stripe Account (for payment processing)
git clone <repository-url>
cd ilmPathServerdotnet restoreUpdate IlmPath.Api/appsettings.json with your configuration:
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=IlmPathDb;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True",
"Redis": "localhost:6379"
},
"JWT": {
"ValidAudience": "Your_Audience",
"ValidIssuer": "Your_Issuer",
"Secret": "YourSuperSecretKeyThatIsLongAndComplex"
},
"Stripe": {
"SecretKey": "sk_test_...",
"PublishableKey": "pk_test_...",
"WebhookSecret": "whsec_..."
},
"GoogleCloud": {
"StorageBucketName": "your-bucket-name",
"ProjectId": "your-project-id",
"CredentialsPath": "path/to/credentials.json"
},
"HuggingFace:ApiKey": "your-huggingface-api-key"
}# Add migration (if not exists)
dotnet ef migrations add InitialCreate --project IlmPath.Infrastructure --startup-project IlmPath.Api
# Update database
dotnet ef database update --project IlmPath.Infrastructure --startup-project IlmPath.Api# Using Docker
docker run -d -p 6379:6379 redis:alpine
# Or start local Redis service
redis-serverdotnet run --project IlmPath.ApiThe API will be available at:
- Swagger UI:
https://localhost:5001(Development) - API Base URL:
https://localhost:5001/api
POST /api/users/login # User authentication
POST /api/users/register # User registration
GET /api/users/profile # Get user profile
POST /api/users/{id}/profile-image # Update profile image
GET /api/courses # Get all courses
GET /api/courses/{id} # Get course by ID
POST /api/courses # Create new course
PUT /api/courses/{id} # Update course
DELETE /api/courses/{id} # Delete course
GET /api/courses/{id}/sections # Get course sections
POST /api/payments/checkout-session # Create payment session
POST /api/payments/verify-payment/{sessionId} # Verify payment
GET /api/carts # Get user cart
POST /api/carts/items # Add item to cart
GET /api/admin/reports/revenue # Revenue analytics
GET /api/admin/users # User management
POST /api/admin/payouts # Generate instructor payouts
POST /api/aichat # AI-powered chat assistance
For complete API documentation, visit the Swagger UI when running in development mode.
IlmPath.sln
βββ IlmPath.Api/ # Presentation Layer
β βββ Controllers/ # API Controllers
β βββ Middleware/ # Custom middleware
β βββ Program.cs # Application entry point
β βββ appsettings.json # Configuration
βββ IlmPath.Application/ # Application Layer
β βββ Commands/ # CQRS Commands
β βββ Queries/ # CQRS Queries
β βββ DTOs/ # Data Transfer Objects
β βββ Interfaces/ # Application interfaces
β βββ Mappings/ # AutoMapper profiles
βββ IlmPath.Infrastructure/ # Infrastructure Layer
β βββ Data/ # Database context
β βββ Repositories/ # Data repositories
β βββ Services/ # External services
β βββ DependencyInjection.cs # Service registration
βββ IlmPath.Domain/ # Domain Layer
βββ Entities/ # Domain entities
βββ Common/ # Shared domain logic
Set the following environment variables for production:
ASPNETCORE_ENVIRONMENT=Production
ConnectionStrings__DefaultConnection="your-production-db-connection"
JWT__Secret="your-production-jwt-secret"
Stripe__SecretKey="your-production-stripe-key"- Create a Google Cloud Storage bucket
- Generate service account credentials
- Update the credentials path in configuration
- Create a Stripe account
- Get your API keys from the Stripe dashboard
- Configure webhook endpoints for payment processing
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY ["IlmPath.Api/IlmPath.Api.csproj", "IlmPath.Api/"]
# ... copy other projects
RUN dotnet restore "IlmPath.Api/IlmPath.Api.csproj"
COPY . .
RUN dotnet build "IlmPath.Api/IlmPath.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "IlmPath.Api/IlmPath.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "IlmPath.Api.dll"]# Run all tests
dotnet test
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"Use the built-in Swagger UI for interactive API testing, or use tools like:
- Postman: Import the OpenAPI specification
- Insomnia: REST client testing
- curl: Command-line testing
- JWT tokens with configurable expiration
- Role-based access control (Admin, Instructor, Student)
- Secure password requirements (configurable)
- Protected endpoints with
[Authorize]attributes
- SQL injection prevention via Entity Framework
- Input validation with FluentValidation
- CORS configuration for cross-origin requests
- HTTPS enforcement in production
- Rate limiting (implement as needed)
- Request validation middleware
- Exception handling middleware
- Secure headers configuration
- Redis Cache: Shopping cart and session data
- Memory Cache: Frequently accessed data
- Database Optimization: Indexed queries and efficient relationships
- Entity Framework optimizations
- Lazy loading configuration
- Query optimization with projection
- Connection pooling
Database Connection Issues
# Verify connection string
dotnet ef database update --project IlmPath.Infrastructure --startup-project IlmPath.Api --verboseRedis Connection Problems
# Test Redis connectivity
redis-cli pingJWT Token Issues
- Verify JWT configuration in appsettings.json
- Check token expiration settings
- Validate issuer and audience claims
Google Cloud Storage Issues
- Verify credentials file path
- Check bucket permissions
- Validate service account roles
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow Clean Architecture principles
- Use CQRS pattern for commands and queries
- Write unit tests for business logic
- Update documentation for new features
- Follow C# coding standards
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Check existing documentation
- Review the Swagger API documentation
- Initial release with core e-learning features
- User authentication and authorization
- Course management system
- Payment integration with Stripe
- Video upload and streaming
- AI chat assistance
- Admin analytics dashboard
Built with β€οΈ using Clean Architecture and .NET 9.0