Skip to content

srikanthmarapatla/FastAPI_Ecommerce_API_project

Repository files navigation

This is a personal learning project built while practicing backend development.

E-commerce API using FastAPI

This project is a backend application built using FastAPI. It provides basic e-commerce functionality like user authentication, product management, cart system, and order handling.

I built this project to understand how real-world backend systems are structured and how different components like authentication, database, and APIs work together.


Features

  • User registration and login
  • Password hashing and JWT authentication
  • Product creation and listing
  • Search and filter products
  • Cart functionality
  • Order placement
  • Pagination support

Technologies Used

  • Python
  • FastAPI
  • SQLAlchemy
  • SQLite
  • Pydantic
  • python-jose (JWT)
  • passlib (bcrypt)

Project Structure

project/

app.py database.py models.py schemas.py auth.py dependencies.py

routers/  user.py  product.py  cart.py  order.py


How to Run

  1. Clone the repository

  2. Create virtual environment

python -m venv .venv

  1. Activate environment

.venv\Scripts\activate

  1. Install dependencies

pip install -r requirements.txt

  1. Run the server

python -m uvicorn app:app --reload


API Testing

After running the server, open:

http://127.0.0.1:8000/docs

You can test all APIs from there.


API Flow

  1. Register a user
  2. Login to get token
  3. Use token for authorized requests
  4. Create products
  5. Add products to cart
  6. Place order

What I Learned

  • How to build REST APIs using FastAPI
  • How authentication works using JWT
  • How to connect database using SQLAlchemy
  • How to structure a backend project
  • How to handle requests and responses properly

Future Improvements

  • Add role-based access (admin/user)
  • Use PostgreSQL instead of SQLite
  • Deploy the project online
  • Add frontend integration

Author

Srikanth

About

Backend e-commerce API built using FastAPI with authentication, product management, cart and order features.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages