Case study
Smart Campus: one backend for a university
An ASP.NET Core 8 API that covers courses, grades, attendance and campus services, with role-based access and real-time updates.
- Team
- 3 developers
- My part
- Backend, about a third of the commits
- Stack
- ASP.NET Core 8, EF Core, MySQL, SignalR
- Year
- 2025
The problem
A university runs on many separate processes: course registration, grading, attendance, meal menus, events. Smart Campus puts them behind a single API so that a student, a lecturer and an administrator each see their own part of the same system.
Architecture
The solution is a layered monolith split into four projects. Controllers stay thin, all business rules live in the service layer, and entities never leave the backend: the API speaks in DTOs, so a database column cannot leak into a response by accident.
API
Controllers, SignalR hubs, middleware
Business
Services, DTOs, rules
Data Access
DbContext, migrations
MySQL 8
Entities as tables
Access control
Authentication uses JWT access tokens with refresh tokens. Authorization is role-based with three roles, and the roles decide what an endpoint will do for you:
- Students enroll in sections, check in to attendance sessions and read their own grades.
- Faculty open attendance sessions and enter grades.
- Admins see campus-wide analytics and reports.
- Secrets such as the JWT signing key and the database connection string come from environment variables, not from the repository.
Attendance and real-time parts
A lecturer starts a session and gets a QR code; students check in by scanning it, and the check-in is validated in real time together with GPS location. Notifications and classroom sensor readings (temperature, noise, light) are pushed over SignalR, with the database and email as fallback channels.
Testing and deployment
Unit tests are written with xUnit and Moq against an in-memory EF Core database, and a script produces an HTML coverage report. The API ships as a Docker image; migrations run automatically on startup, and Swagger documents the endpoints under /api/v1.