How matnoren/inventory-api works
This repository is an Inventory Management REST API. Users register or log in, obtain JWT credentials, then use role-protected endpoints to manage users, categories, products, and stock. Route modules own request handling and delegate to authentication, inventory, and CRUD logic; CRUD uses SQLAlchemy models backed by PostgreSQL. README documents the major capabilities, while source excerpts and the index support the connections shown. Some route internals are unsampled, so only indexed references or documented links are used for those relationships.
Main entry points: services/auth.py Authentication · routes/auth.py Auth endpoints · main.py FastAPI app · user.py User operations
Components 24
API routes
- Auth endpoints
app/api/routes/auth.py - User endpoints
app/api/routes/users.py - Category endpoints
app/api/routes/categories.py - Product endpoints
app/api/routes/products.py - Health check
app/api/routes/health.py - User validation
app/schemas/user.py - Token schemas
app/schemas/auth.py - Category validation
app/schemas/category.py - Product validation
app/schemas/product.py
Domain services
- Authentication
app/services/auth.py - Stock adjustment
app/services/inventory.py - JWT and hashing
app/core/security.py
Persistence
- User operations
app/crud/user.py - Category operations
app/crud/category.py - Product operations
app/crud/product.py - User model
app/models/user.py - Category model
app/models/category.py - Product model
app/models/product.py
Runtime foundations
- DB sessions
app/db/session.py - PostgreSQL
- Settings
app/core/config.py - HTTP errors
app/core/exceptions.py - FastAPI app
app/main.py
Other components
- API caller
Connections 34
- API caller → FastAPI app: sends requests
README.md - FastAPI app → Auth endpoints: registers routes
app/main.py - FastAPI app → User endpoints: registers routes
app/main.py - FastAPI app → Category endpoints: registers routes
app/main.py - FastAPI app → Product endpoints: registers routes
app/main.py - FastAPI app → Health check: registers routes
app/main.py - Auth endpoints → Authentication: delegates login
app/api/routes/auth.py - Auth endpoints → User operations: checks and creates
app/api/routes/auth.py - Auth endpoints → User validation: validates input
app/api/routes/auth.py - Auth endpoints → Token schemas: returns token
app/api/routes/auth.py - User endpoints → User operations: manages users
app/api/routes/users.py - User endpoints → Authentication: checks access
app/api/routes/users.py - Category endpoints → Category operations: manages categories
app/api/routes/categories.py - Category endpoints → Authentication: checks access
app/api/routes/categories.py - Product endpoints → Product operations: manages products
app/api/routes/products.py - Product endpoints → Stock adjustment: adjusts stock
app/api/routes/products.py - Product endpoints → Authentication: checks access
app/api/routes/products.py - Authentication → User operations: loads users
app/services/auth.py - Authentication → JWT and hashing: verifies and signs
app/services/auth.py - Authentication → DB sessions: gets DB dependency
app/services/auth.py - User operations → User model: queries and writes
app/crud/user.py - User operations → JWT and hashing: hashes passwords
app/crud/user.py - User operations → User validation: accepts updates
app/crud/user.py - Category operations → Category model: queries and writes
app/crud/category.py - Category operations → Category validation: accepts updates
app/crud/category.py - Product operations → Product model: queries and writes
app/crud/product.py - Product operations → Product validation: accepts updates
app/crud/product.py - Stock adjustment → Product operations: updates stock
app/services/inventory.py - Stock adjustment → Product model: checks stock
app/services/inventory.py - Stock adjustment → Product validation: uses stock update
app/services/inventory.py - DB sessions → Settings: loads DB settings
app/db/session.py - DB sessions → PostgreSQL: connects
app/db/session.py - Health check → DB sessions: checks DB
app/api/routes/health.py - Auth endpoints → HTTP errors: raises conflicts
app/api/routes/auth.py