How 5004-sea-fa24-geeng/final-project-final-project-8 works
Project type and purpose
• This is a full-stack web application (“Food Wizard”) that lets users pick ingredients to get recipe suggestions.
• Frontend: React + TypeScript + Vite SPA (food-frontend/)
• Backend: Java Spring Boot REST API (src/main/java/com/group8/foodwizard/)
• No local database—uses TheMealDB external API and a local ingredients.json for ingredient metadata.
File structure
• Top-level:
• food-frontend/ (React/Vite app)
• src/main/java/com/group8/foodwizard/ (Spring Boot code)
• src/main/resources/static/ (built SPA assets served by Spring Boot)
• Dockerfile, fly.toml (deployment), gradlew* + gradle/ (build), data/ingredients.json (static data)
• DesignDocuments/, Manual/, Instructions/ (docs)
• Backend follows MVC:
• Controllers: REST endpoints (RecipeController.java)
• Models: domain (Recipe, Ingredient, Meal), request DTOs, strategy sub-packages
• Config: CORS / SPA routing (SpaWebMvcConfigurer.java)
• Frontend:
• Pages & Components (custom UI + composable UI library)
• Services call backend APIs
• Store (state management) + models + utility functions
Key README insights
• Purpose: reduce food waste by suggesting recipes based on user-selected ingredients
• Tech stack: Spring Boot, React + Vite, TheMealDB API
• Deployment: Docker + Fly.io
Main components
a. User (Browser)
b. Frontend SPA
• UI Components
• State Store
• API Service layer
c. Backend REST API
• Controllers (RecipeController)
• Business Logic / Strategy modules
• JSON Parser utility
• Static asset server (serves built SPA)
d. External systems
• TheMealDB API
• Static ingredient data (ingredients.json)
e. Build/Deployment (optional)
• Vite build → static assets → Spring Boot’s resources/static
• Docker container on Fly.io
Relationships & data flow
1. User interacts with SPA in browser
2. SPA calls backend REST endpoints (e.g., /recipes?ingredients=...)
3. Backend Controller delegates to Strategy classes
4. Backend calls TheMealDB API (external HTTP) and/or reads ingredients.json
5. Backend aggregates/parses JSON into domain models → returns JSON to SPA
6. SPA updates state/store → rerenders UI
7. (On deploy) CI builds frontend (Vite) → copies assets into Spring Boot → Dockerizes application → deploys to Fly
Architectural patterns & design principles
• Backend:
• MVC (RestController + Models + Utilities)
• Strategy Pattern for different “get meal” algorithms (IGetMealStrategy)
• Single Spring Boot application bundling static SPA assets
• Frontend:
• Component-based UI with custom + shared UI library
• Unidirectional data flow via service calls → state store → view
• Separation of concerns: UI, models, services, store, utils
Detail
• Strategy classes as a sub-module under Business Logic.
• Static asset server in Spring Boot (to illustrate integration of frontend build).
• That there’s no traditional database—just external API + local JSON.
• Optionally, annotate the Docker and Fly.io deployment for completeness.