How tejasshinkar12/eat-fit-1 works
Project type and purpose
• PantryFit is a mobile-first full-stack application: a React Native frontend (TypeScript) communicating with a FastAPI backend (Python), backed by PostgreSQL, and augmented by specialized ML services (image processing, recipe generation, text Q&A).
File structure
• Top-level folders:
• docs/ – detailed design, flows, tech stack
• src/frontend/ – React Native app
• src/backend/ – FastAPI app + database migrations (Alembic)
• (README hints at src/ml_services/, but the file tree omits it; treat ML modules as separate services)
• Backend uses Alembic for migrations, exposes OpenAPI docs, reads .env for JWT and DB config.
• Frontend uses React Native with contexts (AuthContext), navigation, and a TypeScript project structure.
README for additional insights
• Core features (inventory ingestion, calorie tracking, recipe gen, reports) identify the main functional modules.
• ML services are distinct technical components:
• Image Processing (Detectron2 + TrOCR)
• Recipe Generation (Flan-T5)
• Text Q&A
a. Main components
• Mobile Client (React Native app)
• Backend API (FastAPI)
• Relational Database (PostgreSQL)
• ML Microservices (3 separate services)
• Authentication & Security (JWT, bcrypt)
• External Storage (if images are stored on S3 or similar—add as needed)
b. Relationships and interactions
• Client ↔ API: all user-driven actions (login, inventory CRUD, recipe requests)
• API ↔ DB: read/write user profiles, inventory, nutrition logs, reports
• API → ML Services:
• Image upload endpoint calls Image Processing service → returns detected items
• Recipe endpoint calls Recipe Generation service → returns suggestions
• Q&A endpoint calls Text Q&A service
c. Architectural patterns
• Layered (Mobile UI → API Layer → Data Layer)
• Microservice pattern for ML components
• JWT-based stateless auth in API layer
• Use of configuration/migration (Alembic) indicates IaC/DevOps awareness
d. Technologies/frameworks
• Frontend: React Native, TypeScript, React Navigation
• Backend: FastAPI, Pydantic models, Alembic migrations
• DB: PostgreSQL
• ML: Detectron2, TrOCR, Flan-T5
• Auth: JWT, bcrypt
Detailed component breakdown (suggested grouping)
• Mobile Client
• AuthContext
• Navigation
• Screens: Inventory, Camera, Recipes, Reports
• Backend API
• Routers: auth.py, inventory.py, recipes.py, reports.py
• Services: user_service, inventory_service
• Data Layer: SQLAlchemy models (users, items, logs)
• Database (PostgreSQL)
• Tables: users, inventory_items, nutrition_logs, recipes
• ML Services (as separate deployable units)
• Image Processing Service
• Recipe Generation Service
• Text QA Service
• External components (optional)
• Object store (e.g., AWS S3) for image uploads
• Monitoring/Logging (e.g., Prometheus, Grafana)
Final advice
• Be granular but avoid clutter: start high-level, then drill into sub-components in a second view.
• Notes or callouts for important patterns (JWT stateless auth, database migrations).