Skip to content

RustamovAkrom/Marketplace-FastAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

47 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ Marketplace β€” Modern E‑Commerce Backend Platform

Marketplace is a high‑performance, scalable, and modular e‑commerce backend built with FastAPI. It provides a fully structured architecture that covers every essential part of an online marketplace: user authentication, product catalog, carts, orders, delivery logistics, image upload system, and review management.

Designed following clean architecture principles, the project is maintainable, extendable, and production‑ready.

🧰 Used Technologies

Below is the list of core technologies and dependencies used in this project, based on the project configuration:

πŸ”§ Runtime & Frameworks

πŸ“¦ Async & Utilities

πŸ“¨ Email & Background Tasks

πŸ§ͺ Testing

πŸ›  Development Tools


πŸš€ Features

πŸ‘€ Users & Authentication

  • User registration & login

  • Logout and token revocation

  • Refresh token workflow

  • Password recovery via email

  • Secure JWT‑based authentication (access + refresh tokens)

  • Role system with permissions:

    • Buyer
    • Seller
    • Courier
    • Admin

πŸ” Security

  • Password hashing with bcrypt
  • Revoked token tracking (logout / logout_all)
  • Role‑based access control
  • Strict Pydantic validation for all input/output data
  • Secure and isolated file upload handling

πŸ’Ύ Tech Stack

Layer Technologies
Backend FastAPI, SQLAlchemy 2.0, Alembic
Database PostgreSQL
Async asyncpg, aiofiles
Authentication OAuth2, JWT (Access & Refresh)
Caching (optional) Redis
File Storage /media directory with hashed filenames
Testing Pytest
DevOps (optional) GitHub Actions

πŸ—„οΈ Database SQL Diagram

Project SQL diagram overview

Core Tables

  • users
  • sellers
  • couriers
  • delivery_addresses
  • deliveries
  • product_variants
  • products
  • product_images
  • orders
  • order_items
  • brands
  • categories
  • carts
  • cart_items
  • promo_codes

πŸ“‚ Project Structure

src/
 β”œβ”€β”€ api/
 β”‚   └── v1/
 β”‚       β”œβ”€β”€ auth/
 β”‚       β”œβ”€β”€ users/
 β”‚       β”œβ”€β”€ products/
 β”‚       β”œβ”€β”€ categories/
 β”‚       β”œβ”€β”€ seller/
 β”‚       β”œβ”€β”€ courier/
 β”‚       β”œβ”€β”€ orders/
 β”‚       └── delivery/
 β”œβ”€β”€ core/
 β”‚   β”œβ”€β”€ config.py
 β”‚   └── security.py
 β”œβ”€β”€ db/
 β”‚   β”œβ”€β”€ session.py
 β”‚   β”œβ”€β”€ base.py
 β”‚   └── models/
 β”‚       β”œβ”€β”€ users.py
 β”‚       β”œβ”€β”€ products.py
 β”‚       β”œβ”€β”€ categories.py
 β”‚       β”œβ”€β”€ brands.py
 β”‚       β”œβ”€β”€ cart.py
 β”‚       β”œβ”€β”€ orders.py
 β”‚       β”œβ”€β”€ delivery.py
 β”‚       β”œβ”€β”€ seller_profile.py
 β”‚       β”œβ”€β”€ courier_profile.py
 β”‚       └── review.py
 β”œβ”€β”€ services/
 └── media/

🧠 Architecture

βœ” Clean Architecture

  • Clear separation between API, services, repositories, and database models
  • Easy to extend and maintain

βœ” Modular & Scalable

  • Each domain (products, orders, delivery, etc.) is fully isolated
  • Can be easily split into microservices (catalog, delivery, payments, etc.)

βœ” Async‑first Design

  • High throughput thanks to async stack
  • Perfect for real‑time tasks such as courier tracking

βš™οΈ Environment Variables Example (.env-example)

# Use this file to configure your development environment
# Copy it to .env and fill your credentials

▢️ Getting Started (Without Docker)

1. Clone Repository

git clone https://github.com/RustamovAkrom/Marketplace-FastAPI.git
cd Marketplace-FastAPI

2. Create .env File

DATABASE_URL=postgresql+asyncpg://user:pass@localhost/db
SECRET_KEY=your-secret-key
DEBUG=true

3. Install Dependencies

python -m venv venv
source venv/bin/activate  # Linux/Mac
venv\Scripts\activate     # Windows
pip install -r requirements.txt

4. Run Migrations

alembic upgrade head

5. Start Server

uvicorn src.main:app --reload --host 0.0.0.0 --port 8000

6. Open API Docs

http://localhost:8000/docs

πŸ§ͺ Tests

Run all tests using:

pytest -vv

πŸ‘¨β€πŸ’» Author

Akrom β€” Backend developer passionate about scalable architecture, clean code, and modern engineering practices. Building a production‑ready e‑commerce backend for real-world use and portfolio purposes.


πŸ“„ License

MIT License

About

🟑 processing | Online Marketplace creating by FastAPI πŸ›’

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages