How mollahhamza/yum-ai works
1. Repo shape: two delivered runtimes, one main product path.
The repository is split into a React frontend and a Django backend. In the current codebase, the live architecture is a single-page app talking to a Django REST API. The README also mentions future FastAPI/AI services, but those are not present in the tree yet, so they should be treated as planned, not current, components.
2. Frontend boundary: Vite + React SPA.
FRONTEND/ is a client application built with Vite. The key runtime entry points are src/main.jsx and src/App.jsx, with feature screens under src/pages/ such as Dashboard, Inventory, Billing, Forecasting, AIInsights, Login, Register, Reports, and Settings. This implies the UI is organized as route-based pages rather than a server-rendered app.
3. Frontend API integration is centralized.
src/lib/api.js is the obvious shared API client layer. That is the main boundary where the UI likely converts user actions into HTTP calls to the backend. Styling is split between page CSS, global CSS, and Tailwind/PostCSS config, so visual concerns are kept inside the frontend package.
4. Backend boundary: Django project with REST endpoints.
BACKEND/backend_project/ contains the Django project configuration (settings.py, urls.py, asgi.py, wsgi.py). The backend exposes JSON APIs through Django URLs and views, with Django REST Framework-style serializers in each app. This is a classic API server, not a monolithic server-rendered Django site.
5. Backend is decomposed by business domain.
The backend is split into Django apps: orders, inventory, users, dashboard, and api. Each app follows the same pattern: models.py, serializers.py, views.py, urls.py, plus admin.py, tests.py, and migrations. That structure shows the system is organized by bounded domain, not by technical layer alone.
6. Orders is the core transactional subsystem.
The README and file layout indicate orders manages menu items, order creation, payment processing, and billing history. It also has a management command, seed_demo_data.py, which suggests demo/test data can be loaded into the order flow. This is the main write-heavy path in the system.
7. Inventory is a separate operational subsystem.
inventory handles stock items and stock-related operations such as listing, searching, filtering, low-stock reporting, and quantity updates. Its API surface is distinct from orders, which helps keep stock management independent from POS/payment logic. This app likely feeds both operational UI and dashboard summaries.
8. Dashboard is a read-only aggregation layer.
The dashboard app appears to expose summary statistics rather than owning primary business data. The README describes a /dashboard/stats/ endpoint with totals, popular items, and recent orders. Architecturally, this is a read model built from the transactional apps, not a separate source of truth.
9. Users is the identity/account boundary.
The users app is present with its own models, serializers, views, and migrations, which implies user/account data is isolated from the operational domains. The README says authentication is not enforced yet, so the current repo likely has the structure for user management without full auth enforcement in production form.
10. Data flow is REST over JSON, then ORM to relational storage.
The typical path is: React page → api.js → Django URL/view → serializer → model → database → JSON response. The presence of db.sqlite3 shows local development is currently backed by SQLite, while the README describes PostgreSQL/MySQL as the intended production database layer.
11. Current API boundaries are domain-prefixed.
The documented routes show separate namespaces such as /api/orders/..., /inventory/..., and /dashboard/.... That means the URL structure maps directly to business domains, which is useful for diagramming: the frontend talks to one backend, but the backend is internally segmented by domain routes.
12. Admin, tests, and migrations are supporting infrastructure.
Every app has admin.py for Django admin exposure, tests.py for app-level testing, and migrations for schema evolution. This indicates the backend is designed to be managed through Django’s standard operational tooling, not via ad hoc scripts.
13. Planned AI/ML and deployment pieces are not yet part of the runtime graph.
The README mentions Gemini/Ollama, forecasting libraries, Docker, and GitHub Actions, but no corresponding service directories exist in the tree. For an accurate architecture diagram, those should be shown as future external integrations or roadmap items, not as live components in the current repository.
14. Best diagram framing for this repo.
Draw the current system as: React SPA on the left, Django REST backend in the middle, relational database on the right. Inside the backend, split into Orders, Inventory, Dashboard, and Users domains, with shared Django project configuration above them and the Django admin/management command tooling alongside them.
Main entry points: App.jsx SPA shell · settings.py Project config · views.py Orders · api.js API client
Components 18
Frontend
Vite + React single-page application
- SPA shell · Top-level client shell and page composition
FRONTEND/src/App.jsx - Entry · Client bootstrap and mount point
FRONTEND/src/main.jsx - API client · Shared frontend backend-calling module
FRONTEND/src/lib/api.js - Dashboard · Main summary and navigation surface
FRONTEND/src/pages/Dashboard.jsx - Inventory · Stock management screen
FRONTEND/src/pages/Inventory.jsx - Billing · Order payment and billing UI
FRONTEND/src/pages/Billing.jsx - AI insights · Insights and forecast-oriented UI
FRONTEND/src/pages/AIInsights.jsx - Auth pages · Login and registration screens
FRONTEND/src/pages/Login.jsx - Reports · Reporting and export views
FRONTEND/src/pages/Reports.jsx
Backend
Django REST API and domain apps
- Manage · Project management entrypoint
BACKEND/manage.py - Project config · Settings, routing, ASGI, and WSGI configuration
BACKEND/backend_project/settings.py - Orders · Order creation, menu items, payments, and billing history
BACKEND/orders/views.py - Inventory · Stock items, search, filtering, and updates
BACKEND/inventory/views.py - Dashboard API · Aggregated stats and recent activity endpoints
BACKEND/dashboard/views.py - Users · Account and user boundary
BACKEND/users/views.py - Shared API · General backend API module
BACKEND/api/views.py - SQLite DB · Local development database backing Django ORM
BACKEND/db.sqlite3 - Seed data · Demo data loader for orders
BACKEND/orders/management/commands/seed_demo_data.py
Connections 23
- Entry → SPA shell: mounts · Bootstraps the SPA shell
- SPA shell → Dashboard: routes to · Navigates to the dashboard page
- SPA shell → Inventory: routes to · Navigates to inventory management
- SPA shell → Billing: routes to · Navigates to billing flow
- SPA shell → AI insights: routes to · Navigates to insights and forecasting views
- SPA shell → Auth pages: routes to · Navigates to login and registration
- SPA shell → Reports: routes to · Navigates to reporting views
- Dashboard → API client: calls · Uses shared HTTP client for backend requests
- Inventory → API client: calls · Uses shared HTTP client for stock operations
- Billing → API client: calls · Uses shared HTTP client for order and payment actions
- AI insights → API client: calls · Uses shared HTTP client for analytics data
- Manage → Project config: loads · Starts the Django project runtime
- Project config → Orders: includes · Registers orders app routes and models
- Project config → Inventory: includes · Registers inventory app routes and models
- Project config → Dashboard API: includes · Registers dashboard app routes and models
- Project config → Users: includes · Registers users app routes and models
- Project config → Shared API: includes · Registers shared API app
- Orders → SQLite DB: persists · Stores transactional order data
- Inventory → SQLite DB: persists · Stores stock data
- Users → SQLite DB: persists · Stores user/account data
- Dashboard API → Orders: reads from · Aggregates order statistics
- Dashboard API → Inventory: reads from · Aggregates stock summaries
- Seed data → Orders: seeds · Loads demo order data