How revanth127/personal_project_multi_vendor_api works
This is a layered FastAPI marketplace API. Buyers and sellers use versioned routes to register or authenticate, browse and manage products, and place or manage orders; services enforce business rules before repositories access SQLAlchemy models. The README documents role-based access, product filters, order lifecycle, JWT authentication, and request logging. The sampled files show key calls in authentication, product, and order flows; some endpoint and router wiring is supported by the SOURCE INDEX rather than excerpts.
Main entry points: api.py API v1 router · user_service.py User service · auth.py Auth routes · products.py Product routes
Components 23
API and middleware
- FastAPI app
app/main.py - API v1 router
app/api/v1/api.py - Auth routes
app/api/v1/endpoints/auth.py - User routes
app/api/v1/endpoints/users.py - Product routes
app/api/v1/endpoints/products.py - Order routes
app/api/v1/endpoints/orders.py - Request logging
app/middleware/logging.py - API schemas
app/schemas.py
Identity and access
- User service
app/services/user_service.py - Role authorization
app/middleware/auth.py - JWT tokens
app/oauth2.py - Password hashing
app/utils.py
Marketplace services
- Product service
app/services/product_service.py - Order service
app/services/order_service.py
Data persistence
- Product repository
app/repositories/product_repository.py - Order repositories
app/repositories/order_repository.py - User repository
app/repositories/user_repository.py - Repository base
app/repositories/base.py - Marketplace models
app/models.py - DB sessions
app/database.py - Database settings
app/config.py
Other components
- API client
- PostgreSQL
Connections 34
- API client → FastAPI app: sends requests
README.md - FastAPI app → API v1 router: mounts routes
app/main.py - FastAPI app → Request logging: registers middleware
app/main.py - API v1 router → Auth routes: registers
app/api/v1/api.py - API v1 router → User routes: registers
app/api/v1/api.py - API v1 router → Product routes: registers
app/api/v1/api.py - API v1 router → Order routes: registers
app/api/v1/api.py - Auth routes → User service: authenticates with
app/api/v1/endpoints/auth.py - User routes → User service: delegates to
app/api/v1/endpoints/users.py - Product routes → Product service: delegates to
app/api/v1/endpoints/products.py - Order routes → Order service: delegates to
app/api/v1/endpoints/orders.py - Auth routes → API schemas: validates responses
- Product routes → API schemas: uses schemas
app/api/v1/endpoints/products.py - Order routes → API schemas: uses schemas
app/api/v1/endpoints/orders.py - Auth routes → Role authorization: uses token scheme
app/api/v1/endpoints/auth.py - Product routes → Role authorization: checks roles
app/api/v1/endpoints/products.py - Order routes → Role authorization: checks roles
app/api/v1/endpoints/orders.py - User service → User repository: reads and writes
app/services/user_service.py - User service → Password hashing: hashes passwords
app/services/user_service.py - User service → JWT tokens: creates tokens
app/services/user_service.py - Role authorization → JWT tokens: verifies tokens
app/middleware/auth.py - Product service → Product repository: manages products
app/services/product_service.py - Order service → Product repository: checks stock
app/services/order_service.py - Order service → Order repositories: creates and updates orders
app/services/order_service.py - Product repository → Repository base: inherits operations
app/repositories/product_repository.py - Order repositories → Repository base: uses base operations
app/repositories/order_repository.py - User repository → Repository base: uses base operations
app/repositories/user_repository.py - Product repository → Marketplace models: queries products
app/repositories/product_repository.py - Order repositories → Marketplace models: queries orders
app/repositories/order_repository.py - User repository → Marketplace models: queries users
app/repositories/user_repository.py - Repository base → DB sessions: uses ORM base
app/repositories/base.py - Marketplace models → DB sessions: declares mapped tables
app/models.py - DB sessions → Database settings: loads connection URL
app/database.py - DB sessions → PostgreSQL: connects to
README.md