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.
Below is the list of core technologies and dependencies used in this project, based on the project configuration:
- Python 3.12+ β https://www.python.org/
- FastAPI β https://fastapi.tiangolo.com/
- Uvicorn β https://www.uvicorn.org/
- SQLAlchemy 2.0 β https://docs.sqlalchemy.org/
- Alembic β https://alembic.sqlalchemy.org/
- aiofiles β https://github.com/Tinche/aiofiles
- httpx β https://www.python-httpx.org/
- orjson β https://github.com/ijl/orjson
- argon2-cffi β https://argon2-cffi.readthedocs.io/
- passlib[bcrypt] β https://passlib.readthedocs.io/
- python-jose β https://github.com/mpdavis/python-jose
- python-multipart β https://andrew-d.github.io/python-multipart/
- pydantic-settings β https://docs.pydantic.dev/
- python-dotenv β https://github.com/theskumar/python-dotenv
- FastAPI-Mail β https://sabuhish.github.io/fastapi-mail/
- Celery β https://docs.celeryq.dev/
- Flower (Celery Monitoring) β https://flower.readthedocs.io/
- pytest β https://docs.pytest.org/
- pytest-asyncio β https://github.com/pytest-dev/pytest-asyncio
- pytest-cov β https://github.com/pytest-dev/pytest-cov
- black β https://github.com/psf/black
- isort β https://pycqa.github.io/isort/
- ruff β https://docs.astral.sh/ruff/
- mypy β https://mypy-lang.org/
- pre-commit β https://pre-commit.com/
- loguru β https://github.com/Delgan/loguru
-
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
- 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
| 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 |
Project SQL diagram overview
- users
- sellers
- couriers
- delivery_addresses
- deliveries
- product_variants
- products
- product_images
- orders
- order_items
- brands
- categories
- carts
- cart_items
- promo_codes
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/- Clear separation between API, services, repositories, and database models
- Easy to extend and maintain
- Each domain (products, orders, delivery, etc.) is fully isolated
- Can be easily split into microservices (catalog, delivery, payments, etc.)
- High throughput thanks to async stack
- Perfect for realβtime tasks such as courier tracking
# Use this file to configure your development environment
# Copy it to .env and fill your credentialsgit clone https://github.com/RustamovAkrom/Marketplace-FastAPI.git
cd Marketplace-FastAPIDATABASE_URL=postgresql+asyncpg://user:pass@localhost/db
SECRET_KEY=your-secret-key
DEBUG=truepython -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
pip install -r requirements.txtalembic upgrade headuvicorn src.main:app --reload --host 0.0.0.0 --port 8000http://localhost:8000/docs
Run all tests using:
pytest -vvAkrom β 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.
MIT License
