How kanhunayak2026/ecommerce-backend works
This is a FastAPI e-commerce backend. Clients use its API to manage accounts and catalog data, maintain a cart, and place and manage orders; admin-only operations include catalog changes and order-status updates. The API also uses Pydantic request/response schemas and SQLAlchemy models backed by a MySQL database. The sampled excerpts show API routes and model definitions, but omit portions of main.py, so details of authentication and checkout wiring are limited to what the visible code supports.
Main entry points: main.py FastAPI routes · database.py DB session config · model.py User model · category_model.py Category model
Components 11
API and contracts
- FastAPI routes
app/main.py - Request schemas
app/pydatic.py
Identity and catalog
- JWT helpers
app/auth.py - User model
app/model.py - Category model
app/category_model.py - Product model
app/product_model.py
Cart and orders
- Cart models
app/cart_model.py - Order models
app/order_model.py
Persistence
- DB session config
app/database.py - MySQL database
Other components
- API client
Connections 16
- API client → FastAPI routes: sends requests
- FastAPI routes → API client: returns responses
- FastAPI routes → Request schemas: validates data
- FastAPI routes → JWT helpers: uses tokens
- FastAPI routes → User model: queries users
- FastAPI routes → Category model: queries categories
- FastAPI routes → Product model: queries products
- FastAPI routes → Cart models: queries cart
- FastAPI routes → Order models: queries orders
- FastAPI routes → DB session config: opens sessions
- User model → DB session config: uses base
- Category model → DB session config: uses base
- Product model → DB session config: uses base
- Cart models → DB session config: uses base
- Order models → DB session config: uses base
- DB session config → MySQL database: connects