How heyimamit/gramify works
Project type and purpose
• Gramify is a full-stack, AI-powered web application for converting vague cooking measurements into precise grams and hosting a community forum.
• It combines a React single-page frontend, a Node.js/Express backend for routing, authentication, forum and media handling, a separate Python/FastAPI microservice for NLP/ML tasks, and a MongoDB Atlas database.
High-level components
a. Frontend (React + Context API + Tailwind/Vite)
b. Backend API (Node.js/Express + JWT auth + forum, image, voice controllers)
c. ML Microservice (Python/FastAPI handling NLP, fuzzy matching, density prediction, OCR, voice-to-text)
d. Database (MongoDB Atlas)
e. External Services (Gemini API for OCR, Google Web Speech API, Speech_recognition, any cloud hosting)
Relationships and interactions
• The React app issues HTTP(S) calls to the Node.js API endpoints (auth, forum, image, voice, conversion).
• Node.js routes incoming requests, applies middleware (requireAuth), interacts with MongoDB (via config/db.js) for users and posts, and proxies or orchestrates calls to the Python/FastAPI microservice for ingredient parsing, density prediction, fuzzy matching, OCR, and voice transcription.
• The Python microservice reads/writes any needed cache or supplementary data to MongoDB (via ml/database.py) and invokes third-party services (Gemini API, Google Web API).
• Static assets (index.html, JS, CSS, images) are served by the Node.js public folder.
Architectural patterns and design principles
• Separation of Concerns: UI, API layer, Machine Learning/AI logic, and data storage are decoupled.
• Microservice Pattern: NLP/ML engine is isolated in its own Python/FastAPI service.
• RESTful API: Node.js and Python services expose JSON endpoints with FastAPI TestClient coverage.
• Context API in React for global state (StoreContext.jsx)
• JWT Authentication middleware guards protected API routes.
• MVC-inspired organization in backend folder: models/controllers/routes.
Technologies, frameworks, libraries
• Frontend: React, Vite, Tailwind CSS, Context API, Hooks
• Backend: Node.js, Express, JWT, Mongoose (MongoDB driver)
• ML Service: Python 3.10, FastAPI, SpaCy, TextBlob, word2number, scikit-learn, Gemini API 2.5, Speech_recognition, Google Web API
• Database: MongoDB Atlas
• Testing: pytest, FastAPI TestClient
• Deployment: Google Cloud VM