How rehannurle/foodmood works
Project Type & Purpose
• Full-stack, monolithic Flask web application for AI-powered mood-based discovery of restaurants, cafes, hotels, and dhabas.
• Backend in Python 3.8+, Flask 2.x, SQLAlchemy ORM. Frontend rendered server-side with Jinja2 templates and styled with Bootstrap 5.
Key Components
a. Client Layer
• Web browser (desktop/mobile)
• Static assets (CSS, JS, images under /static/)
• Jinja2 HTML templates (/templates/)
b. Application Layer
• Flask application (fomo.py)
• Request routing & controllers (mood search, user auth, feedback, admin)
• Business logic (mood-to-Foursquare query translation, analytics)
• Database migrations (Alembic under /migrations/)
c. Data Layer
• SQLAlchemy ORM
• SQLite (development) or PostgreSQL (production via DATABASE_URL)
d. External Services
• Foursquare Places API (location & venue data)
• Geolocation API (client GPS lookup)
• SMTP Email (welcome, feedback notifications)
Relationships & Data Flow
1. User sends HTTP request from browser → Flask routes in fomo.py.
2. Static requests (CSS/JS/images) are served directly from /static/.
3. Flask retrieves/stores data via SQLAlchemy into the DB.
4. Mood-based search triggers an outgoing REST call to Foursquare API, processes JSON response, then renders results.
5. Feedback and registration events queue outgoing SMTP email jobs.
6. Admin UI routes invoke analytics queries, data export (CSV), and backup operations.
Architectural Patterns & Principles
• MVC-like separation:
• Models: SQLAlchemy + Alembic
• Views: Jinja2 templates
• Controllers: Flask route handlers in fomo.py
• Single-process monolith deployable on Render or Heroku.
• Environment config via .env.