Altschool Africa Second Semester Project Exam
# π Course Management & Enrollment API
A modern, modular backend system built with **FastAPI** that manages users, courses, and student enrollments.
This project demonstrates clean architecture principles, role-based access control, validation handling, and relationship management using in-memory storage.
---
## π Features
### π€ User Management
* Create users (student/admin)
* Retrieve all users
* Retrieve a specific user by ID
* Email validation using Pydantic `EmailStr`
* Duplicate email prevention
### π Course Management
* Admin-only course creation
* Update course details
* Delete course (with cascading enrollment cleanup)
* Prevent duplicate course codes
* Public course retrieval
### π Enrollment System
* Student enrollment into courses
* Duplicate enrollment prevention
* Student deregistration
* Admin force deregistration
* View student enrollments
* View course enrollments (admin)
---
## π Architecture & Design
This project follows a **layered architecture pattern**:
```
βββ README.md
βββ app
β βββ __init__.py
β βββ __pycache__
β β βββ __init__.cpython-314.pyc
β β βββ main.cpython-314.pyc
β βββ api
β β βββ v1
β β βββ courses.py
β β βββ enrollments.py
β β βββ users.py
β βββ core
β β βββ __init__.py
β β βββ __pycache__
β β βββ storage.py
β βββ main.py
β βββ schemas
β β βββ __init__.py
β β βββ __pycache__
β β βββ common.py
β β βββ course_schema.py
β β βββ enrollment_schema.py
β β βββ user_schema.py
β βββ services
β βββ __init__.py
β βββ __pycache__
β βββ course_service.py
β βββ enrollment_service.py
β βββ user_service.py
βββ env
β
βββ pytest.ini
βββ requirements.txt
βββ tests
βββ __pycache__
β
βββ test_courses.py
βββ test_enrollments.py
βββ test_users.py
```
### πΉ Separation of Concerns
| Layer | Responsibility |
| ------- | ----------------------- |
| api/v1 | HTTP handling only |
| Schema | Input/output validatio β¦