How nakama-nova/nakamadesk-backend works
NakamaDesk is the FastAPI backend for a furniture-business ERP, serving desktop clients with authentication, inventory, sales and billing, customer management, production, workforce, and analytics capabilities. The main flow is client request → registered API route → business service → SQLAlchemy-backed persistence; sales, purchasing, and production also affect inventory through its movement engine. The README describes the API/service split, while sampled source confirms app registration, authentication, inventory movement calls, and database/repository patterns. Most route-to-service links below follow documented module responsibilities; unsampled route implementations may differ.
Main entry points: main.py FastAPI application · sqlalchemy_repo.py Repositories and unit of work · inventory_service.py Inventory engine · production_service.py Production service
Components 30
API surface
- FastAPI application
app/main.py - Authentication routes
app/api/auth.py - Item routes
app/api/items.py - Sales routes
app/api/sales.py - Customer routes
app/api/customers.py - Invoice routes
app/api/invoices.py - Dashboard routes
app/api/dashboard.py - Reports routes
app/api/reports.py - Order routes
app/api/orders.py - Production routes
app/api/production.py - Purchase routes
app/api/purchases.py - Attendance and wages
app/api/attendance.py - Sync routes
app/api/sync.py
Sales and customers
- Sales service
app/services/sales_service.py - Customer service
app/services/customer_service.py - Invoice service
app/services/invoice_service.py - PDF generation
app/services/invoice_pdf_service.py - Analytics service
app/services/analytics_service.py
Inventory and operations
- Inventory engine
app/services/inventory_service.py - Order service
app/services/order_service.py - Production service
app/services/production_service.py - Bill of materials
app/services/bom_service.py - Purchase service
app/services/purchase_service.py - Raw materials
app/services/raw_material_service.py - Workforce service
app/services/workforce_service.py
Platform and persistence
- Authentication service
app/services/auth_service.py - Sync service
app/services/sync_service.py - Repositories and unit of work
app/repositories/sqlalchemy_repo.py - PostgreSQL database
app/db/session.py
Other components
- Desktop client
Connections 38
- Desktop client → FastAPI application: sends requests
- FastAPI application → Authentication routes: registers routes
- FastAPI application → Item routes: registers routes
- FastAPI application → Sales routes: registers routes
- FastAPI application → Customer routes: registers routes
- FastAPI application → Invoice routes: registers routes
- FastAPI application → Dashboard routes: registers routes
- FastAPI application → Reports routes: registers routes
- FastAPI application → Order routes: registers routes
- FastAPI application → Production routes: registers routes
- FastAPI application → Purchase routes: registers routes
- FastAPI application → Attendance and wages: registers routes
- FastAPI application → Sync routes: registers routes
- Authentication routes → Authentication service: calls
- Authentication routes → Repositories and unit of work: queries users
- Authentication service → Repositories and unit of work: persists users
- Item routes → Inventory engine: delegates item work
- Sales routes → Sales service: delegates sales
- Sales service → Inventory engine: records stock movement
- Customer routes → Customer service: delegates CRM
- Invoice routes → Invoice service: requests invoices
- Invoice service → PDF generation: generates PDF
- Dashboard routes → Analytics service: requests metrics
- Reports routes → Analytics service: requests reports
- Order routes → Order service: delegates orders
- Production routes → Production service: delegates jobs
- Production service → Inventory engine: consumes and adds stock
- Production service → Bill of materials: uses material requirements
- Purchase routes → Purchase service: delegates purchasing
- Purchase service → Inventory engine: adds received stock
- Purchase service → Raw materials: manages materials
- Attendance and wages → Workforce service: delegates attendance
- Sync routes → Sync service: delegates sync
- Sync service → Repositories and unit of work: applies operations
- Inventory engine → Repositories and unit of work: reads and writes records
- Production service → Repositories and unit of work: reads and writes jobs
- Workforce service → Repositories and unit of work: records attendance and wages
- Repositories and unit of work → PostgreSQL database: persists transactions