Hocine-Bec/university-management-system
A modular, clean-architecture .NET 9 platform for managing academic operations, administration, and institutional workflows.
University Management System
A comprehensive web-based application designed to digitize and streamline administrative operations of educational institutions. Built with Clean Architecture principles using .NET 9.0 and modern development practices.
๐ Table of Contents
- Overview
- Features
- Architecture
- Technology Stack
- Project Structure
- Getting Started
- API Documentation
- Database Schema
- Authentication & Security
- Testing
- Contributing
- License
๐ฏ Overview
The University Management System is a RESTful API application that manages core academic functions including student enrollment, course administration, faculty management, and academic scheduling. The system follows Clean Architecture principles with strict layer separation and dependency inversion to ensure maintainability, testability, and separation of concerns.
Key Capabilities
- Student Lifecycle Management: Complete enrollment workflow from application to graduation
- Academic Operations: Course catalog, scheduling, and registration management
- Faculty Administration: Professor profiles, specializations, and employment records
- Financial Management: Financial holds and resolution tracking
- Document Verification: Academic credential and document validation
- Administrative Workflows: Service applications and interview coordination
โจ Features
Core Academic Features
- Student enrollment and profile management
- Course catalog with prerequisite handling
- Academic scheduling and section management
- Grade processing and transcript generation
- Program and semester management
Administrative Features
- Faculty management and assignments
- Financial hold management
- Document verification workflows
- Service application processing
- Interview scheduling and coordination
- Entrance exam management
System Features
- JWT-based authentication and authorization
- Comprehensive audit logging
- RESTful API with OpenAPI documentation
- Robust error handling with Result pattern
- Automated testing suite
- Database migrations
๐๏ธ Architecture
The system implements Clean Architecture with four distinct layers:
graph TD
%% Define the layers with enhanced styling
A["๐ **Presentation Layer**<br/>Controllers, API Endpoints<br/>Web UI, REST APIs<br/><code>Presentation.csproj</code>"]
B["โ๏ธ **Application Layer**<br/>Use Cases, Services<br/>DTOs, Validators<br/><code>Application.csproj</code>"]
C["๐๏ธ **Domain Layer**<br/>Entities, Value Objects<br/>Domain Services<br/><code>Domain.csproj</code>"]
D["๐ง **Infrastructure Layer**<br/>Repositories, DbContext<br/>External Services, File I/O<br/><code>Infrastructure.csproj</code>"]
%% Dependencies (solid lines for compile-time dependencies)
A -->|"depends on"| B
B -->|"depends on"| C
%% Infrastructure implements domain interfaces (dashed line for runtime dependency)
D -.->|"implements interfaces from"| C
%% Dependency Injection (dotted line)
A -.->|"injected at runtime"| D
%% Styling
classDef presentation fill:#e1f5fe,stroke:#0277bd,stroke-width:2px,color:#000
classDef application fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000
classDef domain fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000
classDef infrastructure fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000
class A presentation
class B application
class C domain
class D infrastructure
%% Add notes
E["๐ **Key Principles:**<br/>โข Domain has no dependencies<br/>โข Application depends only on Domain<br/>โข Infrastructure implements Application's interfaces<br/>โข Presentation depends on Application<br/>โข Dependencies point inward"]
classDef notes fill:#fff9c4,stroke:#f57f17,stroke-width:1px,color:#000,stroke-dasharray: 5 5
class E notes
Architectural Principles
- Dependency Inversion: Inner layers define interfaces, outer layers implement them
- Single Responsibility: Each layer has a specific purpose
- Repository Pattern: Abstraction over data access
- Unit of Work: Transaction coordination across repositories
- Result Pattern: Consistent error handling and operation outcomes
๐ ๏ธ Technology Stack
Core Framework
- .NET 9.0 - Target framework with C# 13 features
- ASP.NET Core 9.0 - Web API framework
- Entity Framework Core 9.0 - Object-Relational Mapping
Database
- PostgreSQL - Primary database
- Npgsql - PostgreSQL provider for EF Core
Authentication & Security
- JWT Bearer Authentication - Token-based authentication
- BCrypt.Net - Password hashing and verification
Development Tools
- AutoMapper - Object-to-object mapping
- Swagger/OpenAPI - API documentation
- Scalar - Enhanced API documentation UI
Testing
- xUnit - Primary testing framework
- Moq - Mocking framework
- FluentAssertions - Fluent assertion library
- EF Core InMemory - In-memory database for testing
๐ Project Structure
UniversityManagementSystem/
โโโ Domain/ # Core business entities and rules
โ โโโ Entities/ # Domain entities (Student, Course, etc.)
โ โโโ Enums/ # Domain enumerations
โ โโโ Domain.csproj
โโโ Applications/ # Business logic and use cases
โ โโโ Services/ # Application services
โ โโโ Interfaces/ # Service, repository, Auth, Unit of work, and custom Logger interfaces
โ โโโ DTOs/ # Data transfer objects
โ โโโ Mappers/ # AutoMapper Profiles
โ โโโ Helpers/ # Utility classes
โ โโโ Shared/ # Result pattern
โ โโโ DependencyInjection.cs
โ โโโ Applications.csproj
โโโ Infrastructure/ # Data access and external services
โ โโโ Data/ # Database context and configurations
โ โโโ Repositories/ # Repository implementations
โ โโโ Logger/ # Custom Logger Implementation
โ โโโ Settings/ # Jwt Settings
โ โโโ UnitOfWokrs/ # UnitOfWork implementation
โ โโโ Authentication/ # JWT and Password Hashing services
โ โโโ DependencyInjection.cs
โ โโโ Infrastructure.csproj
โโโ Presentation/ # API controllers and HTTP handling
โ โโโ Controllers/ # REST API controllers
โ โโโ Extensions/ # Result handling extensions
โ โโโ Presentation.csproj
โโโ UnitTests/ # Test suite
โ โโโ Services/ # Service tests
โ โโโ UnitTests.csproj
โโโ README.md
๐ Getting Started
Prerequisites
Installation
-
Clone the repository
git clone https://github.com/yourusername/university-management-system.git cd university-management-system -
Set up the database
# Create a PostgreSQL database createdb university_management -
Configure environment variables
Create anappsettings.jsonfile in the Presentation project:DefaultConnection=Host=your_host;Database=your_database;Username=your_username;Password=your_password JWT Configuration JWT_SECRET=your-jwt-secret-key-minimum-32-characters-long JWT_ISSUER=your-app-name JWT_AUDIENCE=your-app-users JWT_EXPIRY_MINUTES=jwt_lifetime
-
Install dependencies
dotnet restore
-
Run database migrations
dotnet ef database update --project Infrastructure --startup-project Presentation
-
Build and run the application
dotnet build dotnet run --project Presentation
The API will be available at https://localhost:5001 (HTTPS) or http://localhost:5000 (HTTP).
Environment Variables
The application requires the following environment variables:
| Variable | Description | Required |
|---|---|---|
JWT_SECRET_KEY |
Secret key for JWT token generation | Yes |
JWT_ISSUER |
JWT token issuer | Yes |
JWT_AUDIENCE |
JWT token audience | Yes |
JWT_ACCESS_TOKEN_LIFETIME |
Token lifetime in minutes | Yes |
๐ API Documentation
Swagger UI
Once the application is running, you can access the interactive API documentation at:
- Swagger UI:
https://localhost:5001/swagger - Scalar UI:
https://localhost:5001/scalar/v1
Core API Endpoints
Authentication
POST /api/auth/login- User authenticationPOST /api/auth/register- User registration
Students
GET /api/students- Get all studentsGET /api/students/{id}- Get student by IDPOST /api/students- Create new studentPUT /api/students/{id}- Update studentDELETE /api/students/{id}- Delete student
Courses
GET /api/courses- Get all coursesGET /api/courses/{id}- Get course by IDPOST /api/courses- Create new coursePUT /api/courses/{id}- Update coursePATCH /api/courses/{id}/deactivate- Deactivate course
Enrollments
GET /api/enrollments- Get all enrollmentsPOST /api/enrollments- Create new enrollmentPUT /api/enrollments/{id}- Update enrollment
Grades
GET /api/grades- Get all gradesGET /api/grades/student/{studentId}- Get grades by studentGET /api/grades/course/{courseId}- Get grades by coursePOST /api/grades- Create new grade
Financial Holds
GET /api/financial-holds- Get all financial holdsPOST /api/financial-holds- Create new financial holdPATCH /api/financial-holds/{id}/resolve- Resolve financial hold
๐๏ธ Database Schema
Core Entities
Student Management
- Person: Base entity for all individuals
- Student: Extends Person with academic information
- Professor: Faculty members and instructors
- User: System authentication users
Academic Structure
- Program: Academic programs and degrees
- Course: Course catalog
- Section: Course sections with scheduling
- Semester: Academic semester definitions
- Prerequisite: Course prerequisite relationships
Operations
- Enrollment: Student program enrollments
- Registration: Student course registrations
- Grade: Academic grade records
- FinancialHold: Financial holds and restrictions
Administrative
- ServiceApplication: Student service applications
- DocsVerification: Document verification tracking
- EntranceExam: Entrance examination records
- Interview: Interview process management
๐ Authentication & Security
JWT Authentication
The system uses JSON Web Tokens (JWT) for secure authentication:
- Token-based authentication: Stateless authentication mechanism
- Bearer token: Include token in Authorization header
- Configurable expiration: Token lifetime management
- Secure password hashing: BCrypt for password security
Authorization
- Controller-level authorization: Most endpoints require authentication
- Anonymous access: Limited to public endpoints (e.g., countries)
- Role-based access: Extensible for future role implementations
Security Best Practices
- Environment-based configuration
- Secure password hashing with BCrypt
- JWT token validation
- Input validation and sanitization
- Comprehensive error handling
๐ค Contributing
Development Workflow
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Make your changes
- Add tests for new functionality
- Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.