How scotchlabs/inventory works
This is a web-based inventory management application: users browse and search assets, filter by location and category, and administrators can add, edit, or delete inventory items. The frontend calls a FastAPI backend; backend routes enforce user authorization and access PostgreSQL-backed models. File uploads are handled separately, stored locally in development or in S3 in production, and exposed as file metadata. The graph preserves the documented and indexed inventory, identity, and file capabilities. Some inventory and admin implementation details are unsampled, so their internal links are omitted where the evidence does not establish a call.
Main entry points: asset.py Inventory routes · app.py FastAPI app · __init__.py DB session · routes.py File routes
Components 24
Web application
- Web app
frontend/src/App.tsx - Public inventory
frontend/src/pages/Public.tsx - Admin UI
frontend/src/pages/Admin.tsx - Add item
frontend/src/pages/AddItem.tsx - File widget
frontend/src/components/Files.tsx - API client
frontend/src/api/client.ts
API runtime
- FastAPI app
backend/app/app.py - Route authorization
backend/app/utils/api_route.py - DB session
backend/app/db/__init__.py
Inventory domain
- Inventory routes
backend/app/inventory/routes/asset.py - Category routes
backend/app/inventory/routes/category.py - Location routes
backend/app/inventory/routes/locations.py - Asset model
backend/app/inventory/models/asset.py - Category model
backend/app/inventory/models/category.py - Location model
backend/app/inventory/models/location.py
Identity and files
- Auth routes
backend/app/users/routes/auth.py - Token and auth
backend/app/users/services/auth.py - User service
backend/app/users/services/user.py - File routes
backend/app/files/routes.py - File storage service
backend/app/files/services.py - File model
backend/app/files/models.py
Other components
- User
- PostgreSQL
- Local files / S3
Connections 31
- User → Web app: uses
frontend/src/App.tsx - Web app → Public inventory: routes to
frontend/src/App.tsx - Web app → Admin UI: routes to
frontend/src/App.tsx - Admin UI → Public inventory: uses
frontend/src/pages/Admin.tsx - Admin UI → Add item: uses
frontend/src/pages/Admin.tsx - Public inventory → API client: queries and mutates
frontend/src/pages/Public.tsx - Add item → API client: calls
frontend/src/pages/AddItem.tsx - Public inventory → File widget: renders
frontend/src/pages/Public.tsx - Add item → File widget: uses
frontend/src/pages/AddItem.tsx - API client → FastAPI app: sends API requests
frontend/src/api/client.ts - FastAPI app → Inventory routes: registers
backend/app/app.py - FastAPI app → File routes: registers
backend/app/app.py - FastAPI app → Auth routes: registers
backend/app/app.py - Inventory routes → Route authorization: uses router authorization
backend/app/inventory/routes/asset.py - File routes → Route authorization: uses router authorization
backend/app/files/routes.py - Auth routes → Token and auth: calls
backend/app/users/routes/auth.py - Token and auth → User service: calls
backend/app/users/services/auth.py - Inventory routes → Asset model: reads and writes
backend/app/inventory/routes/asset.py - Inventory routes → Category routes: uses
backend/app/inventory/routes/asset.py - Inventory routes → Location routes: uses
backend/app/inventory/routes/asset.py - Category routes → Category model: reads and writes
backend/app/inventory/routes/category.py - Location routes → Location model: reads and writes
backend/app/inventory/routes/locations.py - Inventory routes → File storage service: uses file operations
backend/app/inventory/routes/asset.py - File routes → File storage service: calls
backend/app/files/routes.py - File storage service → File model: creates and queries
backend/app/files/services.py - File storage service → Local files / S3: stores uploads
backend/app/files/services.py - FastAPI app → DB session: opens request session
backend/app/app.py - Inventory routes → DB session: uses
backend/app/inventory/routes/asset.py - File routes → DB session: uses
backend/app/files/routes.py - Token and auth → DB session: uses
backend/app/users/services/auth.py - DB session → PostgreSQL: connects to
backend/app/db/__init__.py