How dang-khoa-nguyen/whereweeat works
WhereWeEat is a restaurant-discovery app with two user paths: search by location and preferences, or request a surprise pick. Both lead to selecting a restaurant, fetching walking/biking/driving routes, and viewing the result on a map. The README also documents a normalized restaurant-data layer and external Places, routing, map-tile, geolocation, and directions services. The principal frontend and backend wiring is supported by sampled source; the map and random-button implementations were not sampled, so their internal behavior is represented only where documented.
Main entry points: page.tsx Search and results · main.py FastAPI endpoints · ScratchModel.tsx Scratch reveal · seek_restaurant_service.py Restaurant search
Components 22
Frontend experience
- Search and results
app/page.tsx - Search hook
hooks/useRecommendation.ts - Random button
app/components/buttons/randomButton.tsx - Random hook
hooks/useRandom.ts - Scratch reveal
app/components/model/ScratchModel.tsx - Restaurant list
app/components/RestaurantList.tsx - Browser location
lib/geo.ts - API endpoint config
lib/api.ts
Restaurant discovery
- FastAPI endpoints
backend/main.py - Restaurant search
backend/services/seek_restaurant_service.py - Radius calculation
backend/services/calculate_service.py - Result normalization
backend/utils/format_list.py - Rating assignment
backend/utils/random_star.py - Random selection
backend/services/random_service.py
Routes and maps
- Map display
app/components/map/RestaurantMap.tsx - Route service
backend/services/routing_service.py
External services
- Foursquare Places
- OpenRouteService
- OpenStreetMap tiles
- Geolocation API
- Google Maps directions
Other components
- Diner
Connections 33
- Diner → Search and results: sets preferences
- Search and results → Search hook: searches via
- Search hook → Browser location: requests coordinates
- Browser location → Geolocation API: reads location
- Search hook → API endpoint config: uses endpoint
- Search hook → FastAPI endpoints: fetches recommendations
- Search and results → Random button: offers surprise
- Random button → Random hook: requests pick
- Random hook → Browser location: requests coordinates
- Random hook → API endpoint config: uses endpoint
- Random hook → FastAPI endpoints: fetches random pick
- FastAPI endpoints → Restaurant search: searches restaurants
- FastAPI endpoints → Random selection: selects random
- Restaurant search → Radius calculation: calculates radius
- Restaurant search → Foursquare Places: searches places
- Foursquare Places → Restaurant search: returns places
- Restaurant search → Result normalization: normalizes results
- Result normalization → Rating assignment: gets rating
- FastAPI endpoints → Route service: requests all routes
- Route service → OpenRouteService: requests directions
- OpenRouteService → Route service: returns route data
- FastAPI endpoints → Search and results: returns results
- Search and results → Restaurant list: renders results
- Restaurant list → Search and results: selects restaurant
- Search and results → Browser location: requests route origin
- Search and results → FastAPI endpoints: fetches selected routes
- Search and results → Map display: shows route
- Map display → OpenStreetMap tiles: loads map tiles
- Random button → Scratch reveal: opens reveal
- Search and results → Scratch reveal: passes result and routes
- Scratch reveal → Map display: shows route
- Scratch reveal → Geolocation API: reads origin
- Scratch reveal → Google Maps directions: links directions