Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 FastAPI Student Management API

A RESTful Student Management API built with FastAPI, PostgreSQL, and SQLAlchemy. This project demonstrates CRUD (Create, Read, Update, Delete) operations and serves as a beginner-friendly backend application.


🚀 Features

  • ✅ Create a new student
  • ✅ Get all students
  • ✅ Get a student by ID
  • ✅ Update student information
  • ✅ Delete a student
  • ✅ PostgreSQL database integration
  • ✅ SQLAlchemy ORM
  • ✅ Pydantic data validation
  • ✅ Interactive Swagger UI documentation
  • ✅ RESTful API design

🛠️ Tech Stack

  • Python 3.x
  • FastAPI
  • PostgreSQL
  • SQLAlchemy
  • Pydantic
  • Uvicorn
  • Postman (API Testing)

📂 Project Structure

FastAPI-Student-Management/
│
├── app/
│   ├── main.py
│   ├── database.py
│   ├── models.py
│   ├── schemas.py
│   ├── crud.py
│   └── config.py
│
├── .gitignore
├── requirements.txt
├── README.md
└── image.png

📌 API Endpoints

Method Endpoint Description
POST /students Create a new student
GET /students Retrieve all students
GET /students/{id} Retrieve a student by ID
PUT /students/{id} Update student information
DELETE /students/{id} Delete a student

⚙️ Installation

1. Clone the repository

git clone https://github.com/Abdulwasaytahir/FastAPI-Student-Management.git

2. Navigate to the project

cd FastAPI-Student-Management

3. Create a virtual environment

python -m venv venv

4. Activate the virtual environment

Windows

venv\Scripts\activate

Linux/macOS

source venv/bin/activate

5. Install dependencies

pip install -r requirements.txt

6. Configure PostgreSQL

Update your database connection in app/config.py or app/database.py.

Example:

DATABASE_URL = "postgresql://username:password@localhost/student_db"

7. Run the application

uvicorn app.main:app --reload

📖 API Documentation

After running the project:

Swagger UI

http://127.0.0.1:8000/docs

ReDoc

http://127.0.0.1:8000/redoc

📸 Screenshots

Swagger UI

Add your Swagger UI screenshot below.

alt text


📚 What I Learned

During this project, I learned:

  • Building REST APIs with FastAPI
  • Working with PostgreSQL databases
  • Using SQLAlchemy ORM
  • Request validation using Pydantic
  • Testing APIs with Swagger UI and Postman
  • Implementing CRUD operations
  • Organizing a FastAPI project

🔮 Future Improvements

  • JWT Authentication
  • User Registration & Login
  • Search Functionality
  • Pagination
  • Filtering & Sorting
  • Docker Support
  • Unit Testing
  • Deployment

👨‍💻 Author

Abdul Wasay Tahir

BS Computer Science Student


⭐ Support

If you found this project helpful, consider giving it a ⭐ on GitHub.

About

Student Management REST API built with FastAPI, PostgreSQL, SQLAlchemy, and Pydantic.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages