A robust School Management API built using Clean Architecture to provide structured, scalable, and maintainable code. This API facilitates managing students, teachers, classes, and other school resources. Authentication is secured using JWT tokens with refresh tokens for session management.
- 📚 Manage students, teachers, classes, and subjects.
- 📝 CRUD operations for school resources.
- 🔐 Secure authentication using JWT.
- ♻️ Refresh tokens for extended session management.
- 🏗️ Modular and scalable design using Clean Architecture.
- ASP.NET Core for the backend framework.
- Entity Framework Core for database management.
- JWT for authentication.
- Refresh Token for session renewal.
- Clean Architecture to organize the codebase.
- SQL Server as the primary database.
POST /auth/login
– Login with email and password to receive a JWT token and refresh token.POST /auth/refresh
– Get a new JWT token using a valid refresh token.POST /auth/register
– Register a new user.
GET /students
– Get a list of all students.POST /students
– Add a new student.PUT /students/{id}
– Update student details.DELETE /students/{id}
– Delete a student.
GET /teachers
– Get a list of all teachers.POST /teachers
– Add a new teacher.PUT /teachers/{id}
– Update teacher details.DELETE /teachers/{id}
– Delete a teacher.
GET /classes
– Get a list of all classes.POST /classes
– Add a new class.PUT /classes/{id}
– Update class details.DELETE /classes/{id}
– Delete a class.
-
Clone the repository:
git clone https://github.com/username/school-management-api.git
-
Navigate to the project directory:
cd school-management-api
-
Install the necessary packages:
dotnet restore
-
Apply database migrations:
dotnet ef database update
-
Run the API:
dotnet run
The project follows the Clean Architecture principles, ensuring separation of concerns across the following layers:
- Domain – Contains core business logic and entities.
- Application – Contains use cases and business rules.
- Infrastructure – Handles external concerns like databases.
- Presentation – Exposes the API endpoints.
- After successful login, users receive a JWT token used for API authentication.
- The JWT token has a short expiry time for enhanced security.
- To extend the session without forcing the user to log in again, the Refresh Token is issued alongside the JWT token.
- Clients can request a new JWT token using the Refresh Token.
- Login → Client sends credentials → Receives JWT + Refresh Token.
- Access Secured Endpoints → Include JWT in the
Authorization
header. - Token Expiry → Use Refresh Token to get a new JWT without logging in again.
src/
│
├── Application/ # Use cases, interfaces, DTOs
├── Domain/ # Core business logic and entities
├── Infrastructure/ # Database access, external services
├── Presentation/ # API controllers and middleware
└── Tests/ # Unit and integration tests
We welcome contributions! Please follow these steps:
- Fork the repository.
- Create a feature branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -m 'Add feature'
). - Push the branch (
git push origin feature-branch
). - Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.