A professional backend API built using FastAPI for managing students and course enrollments.
The Student Management System API is a backend application designed to manage:
- ๐จโ๐ Students
- ๐ Course Assignments
- ๐งพ Student Information
- โ Data Validation
The project follows a clean and organized layered architecture using:
- Routes Layer
- Services Layer
- Models Layer
- Database Layer
This structure helps keep the project scalable, readable, and easy to maintain.
| Technology | Purpose |
|---|---|
| Python | Core programming language |
| FastAPI | Backend framework |
| Pydantic | Data validation |
| REST API | API architecture |
| Uvicorn | ASGI server |
TASK-1/
โ
โโโ models/
โ โโโ student.py
โ
โโโ routes/
โ โโโ student.py
โ โโโ course.py
โ
โโโ services/
โ โโโ student_service.py
โ โโโ course_service.py
โ
โโโ database.py
โโโ main.py
โโโ requirements.txt
โโโ README.md
โโโ .gitignore- Create Student
- Get All Students
- Get Single Student
- Update Student
- Delete Student
- Assign Course to Student
- Get Assigned Course
- Update Assigned Course
- Delete Assigned Course
The API uses Pydantic for strong validation.
- Minimum & maximum name length
- Age validation
- Class validation
- Email validation using
EmailStr - Nested address validation
Responsible for:
- Handling API endpoints
- Managing HTTP requests/responses
- Raising exceptions
- Connecting routes with services
Responsible for:
- Business logic
- Data processing
- CRUD operations
- Database interactions
This separation keeps the code clean and maintainable.
Responsible for:
- Data schemas
- Validation rules
- Request & response structure
A fake in-memory database is used using Python dictionaries.
This is suitable for:
- Learning purposes
- Fast prototyping
- Understanding API flow
| Field | Type |
|---|---|
| student_name | string |
| father_name | string |
| student_age | integer |
| student_current_class | integer |
| admission_date | date |
| parent_email | |
| address | object |
| Field | Type |
|---|---|
| city | string |
| area | string |
| house_no | string |
| Course No | Course Name | Duration |
|---|---|---|
| 1 | Python Basics | 2 months |
| 2 | Python Advanced | 3 months |
| 3 | Front-end Development | 4 months |
| 4 | Back-end Development | 4 months |
| Method | Endpoint | Description |
|---|---|---|
| POST | /students/ |
Create student |
| GET | /students/ |
Get all students |
| GET | /students/{student_id} |
Get single student |
| PUT | /students/{student_id} |
Update student |
| DELETE | /students/{student_id} |
Delete student |
| Method | Endpoint | Description |
|---|---|---|
| POST | /courses/{student_id}/{course_no} |
Assign course |
| GET | /courses/ |
Get all assigned courses |
| GET | /courses/{student_id} |
Get assigned course |
| PUT | /courses/{student_id}/{course_no} |
Update course |
| DELETE | /courses/{student_id} |
Delete course |
The project uses FastAPI's HTTPException for handling errors.
Examples:
- Student not found
- Course not found
- Duplicate course assignment
python -m venv .venv.venv\Scripts\activatepip install -r requirements.txtuvicorn main:app --reloadFastAPI automatically provides interactive documentation.
http://127.0.0.1:8000/docshttp://127.0.0.1:8000/redocPlanned future enhancements:
- ๐ JWT Authentication
- ๐๏ธ SQLite/PostgreSQL Integration
- ๐ Attendance Management
- ๐ Marks Management
- ๐ฅ User Roles
- ๐งช Automated Testing
- โ๏ธ Deployment Support
This project helped me understand:
- FastAPI fundamentals
- API architecture
- Dependency Injection
- Pydantic validation
- CRUD operations
- Service layer structure
- REST API development
Passionate learner exploring:
- Artificial Intelligence
- Generative AI
- Backend Development
- FastAPI
- Python
This project was built for learning and practice purposes as part of my backend development and FastAPI learning journey.
Continuous improvement and learning are the main goals of this repository ๐