How razgrom47/dierezeptedb works
Project type and purpose
• This is a full-stack web application named “dieRezepteDB,” whose goal is to provide recipes for healthy nutrition.
• The backend is a Flask-based REST API serving recipe, ingredient, profile, and auth data; the frontend is a React (Vite) single-page app offering search, filter, and user-profile views.
File structure
• Top-level directories:
• backend/ – Flask API entry point (app.py), configuration (config.py), ORM models (models.py), migrations/, extensions.py, decorators, plus a blueprints/ folder containing modular routes (auth.py, ingredients.py, meals.py, profile.py).
• frontend/ – React/Vite client (main.jsx, App.jsx), components/, assets/, public/ (static images), plus config files (vite.config.js, eslint.config.js, package.json).
• backend/themealdb/myDB.db: local SQLite database file
• backend/backup/: legacy scripts (creatingDB.py, myMealAPI.py, scape.py) for data scraping and initial API prototype.
• Configuration & build files: requirements.txt, package.json, migrations commands.txt.
README for additional insights
• Python backend runs via python backend/app.py, with optional venv.
• Migrations support via Flask-Migrate (commands.txt).
• React/Vite dev server via npm run dev, using Material-UI and React Router.
• Legacy backup script for reinitializing the DB if needed.
a. Main components
• User’s browser/client
• Frontend SPA (React + Vite)
• Backend REST API (Flask application with blueprints)
• Database (SQLite)
• External/legacy scripts (data scraper & backup tool)
b. Relationships & interactions
1. The user interacts with the SPA in the browser.
2. The SPA issues HTTP requests (GET, POST, PUT, DELETE) to the Flask API endpoints (e.g., /api/meals, /api/ingredients, /api/auth).
3. The Flask app loads configuration, initializes extensions (SQLAlchemy, Migrate, JWT), and registers blueprints.
4. Each blueprint handles a domain (auth, profile, meals, ingredients), invokes models and DB sessions.
5. The API reads/writes to the local SQLite DB.
6. Migrations update the DB schema; backup scripts can regenerate or populate data offline.
c. Architectural patterns & design principles
• Blueprint-based modularization in Flask for separation of concerns.
• MVC-like layering: models.py (data layer), blueprints (controller layer), Flask-provided JSON (view).
• Single-page application pattern on the frontend with component hierarchy and React Router for client-side routing.
• Use of environment isolation (venv, npm modules).
d. Key technologies
• Backend: Python + Flask, Flask-SQLAlchemy, Flask-Migrate, JWT or session auth, SQLite.
• Frontend: React, Vite, MUI (Material UI), React Router.
• Build & run: requirements.txt, package.json, ESLint, Vite dev server.