How chin-ma/fitmate-frontend works
Project type and purpose
• FitMate AI is a personal fitness coaching platform. It’s a full-stack web application with a Next.js (React/TypeScript) frontend MVP and a future Python/Flask backend, integrating AI/ML (Google Gemini) and MongoDB.
File structure
• Top-level directories:
• app/ – Next.js “app router” pages and API routes
• components/ – UI and feature components (shadcn/ui, dashboard, workout, etc.)
• lib/ – shared types and utility functions
• public/ – static assets
• Key files: next.config.ts, tsconfig.json, postcss.config.mjs
• app/api/... contains route.ts files that implement serverless API endpoints for chat, diet recommendations, food analyze, posture analyze, and user updates.
README for additional insights
• Tech stack: Next.js, Tailwind CSS, shadcn/ui
• Backend, AI engine, and database are “coming soon” (Flask, Google Gemini, MongoDB)
• Features include AI-powered workout plans, dynamic adaptation, chat interface, food analysis.
Diagramming strategy
a. Main components
• User (Browser/Mobile app)
• Next.js Frontend
– UI layer (components/ui, components/dashboard, app/layout.tsx)
– Pages (app/page.tsx, app/dashboard/*, app/auth/login/page.tsx)
• Next.js API layer (app/api/*)
• External AI Engine (Google Gemini)
• Future Backend Service (Python/Flask)
• Database (MongoDB)
• Authentication Service (JWT email auth)
b. Relationships & interactions
1. User interacts with Next.js frontend over HTTPS
2. Frontend fetches data or posts user input to Next.js API routes
3. API routes either:
– Call Google Gemini AI (e.g., food analysis, chat)
– Connect to the future Flask backend for workout plans, user data
4. Backend persists/retrieves data in MongoDB
5. JWT tokens issued/validated by Auth service (could be part of Flask backend)
c. Architectural patterns
• Serverless/API-route layer within Next.js
• Component-based UI with shadcn/ui for reusable design
• Layered separation: UI → API → Business logic → Data store
d. Key technologies
• Next.js app router & serverless functions
• React + TypeScript + Tailwind CSS + shadcn/ui
• Google Gemini for AI/ML calls
• Python Flask microservices (planned)
• MongoDB document store
• JWT for auth