A backend API for managing products and sellers in an e-commerce platform. Built using FastAPI, SQLAlchemy, and JWT Authentication, this project supports versioned, modular development and can be used as a base for marketplace-style systems.
- Modular folder structure
- JWT-based login and token management
- CRUD operations for Products and Sellers
- PostgreSQL-ready using SQLAlchemy ORM
- Interactive API docs via Swagger & ReDoc
microservices/
β
βββ main.py # Entry point (FastAPI app)
βββ models/ # SQLAlchemy models
βββ routes/ # API route modules
βββ helpers/ # Utility functions (e.g., auth, hashing)
βββ .development.env # Stores secret credentials
# 1. Clone the repository
git clone https://github.com/your-username/products-sellers-api.git
cd products-sellers-api
# 2. Create virtual environment
python -m venv venv
activate_venv.bat --- file to activate the environment and run uvicorn server.
# 3. Install dependencies
pip install -r requirements.txt
# 4. Run the server
uvicorn main:app --reload
- Login to receive JWT access token.
- Use this token in the
Authorization: Bearer <token>
header for protected routes.
POST /login/
Method | Endpoint | Description |
---|---|---|
GET | /product/fetch |
Fetch all products |
POST | /product/create |
Create a product |
PUT | /product/update/{id} |
Update a product |
DELETE | /product/delete/{id} |
Delete a product |
Method | Endpoint | Description |
---|---|---|
POST | /seller/create |
Create a seller |
DELETE | /seller/delete/{id} |
Delete a seller |
Access Swagger UI at:
http://localhost:8000/docs
- FastAPI - High-performance Python web framework
- SQLAlchemy - ORM for SQL databases
- Pydantic - Data validation
- SQL Lite - Relational database
- JWT - Token-based authentication
MIT License β feel free to use and adapt this project.
β This backend was designed for experimentation, modular scaling, and clean separation of concerns.