How cloudproject-khu/myfridger-be works
MyFridger is a FastAPI backend for household ingredients and recipe discovery. Users can manage ingredients manually or from receipt images, request recipe recommendations based on their inventory and expiry priority, submit recommendation feedback, and estimate food expiry. A separate synchronization path imports recipes into the catalog. The graph follows the API, service, persistence, and integration responsibilities. Some API and service files were not excerpted; their relationships are included only where the SOURCE INDEX or README supports them.
Main entry points: materials.py Material routes · recipe_sync_service.py Recipe synchronization · main.py FastAPI app · recommends.py Recommendation routes
Components 23
API and Identity
- FastAPI app
app/main.py - Material routes
app/api/materials.py - Recipe routes
app/api/recipes.py - Recommendation routes
app/api/recommends.py - JWT authentication
app/core/auth.py
Inventory
- Receipt parsing
app/services/materials.py - Ingredient model
app/models/materials.py - Expiry estimation
app/services/expiry_estimation_service.py
Recipes
- Recipe matching
app/services/recipe_recommendation_service.py - Recipe and feedback models
app/models/recipes.py - Recipe synchronization
app/services/recipe_sync_service.py - Scheduled sync handler
lambda/recipe_sync_handler.py - Manual sync handler
lambda/recipe_manual_sync_handler.py
Runtime and Integrations
- Database sessions
app/core/db.py - PostgreSQL
- Runtime settings
app/core/config.py - Expiry service dependency
app/utils/bedrock_dependencies.py - Recipe image storage helper
app/utils/s3_helper.py
Other components
- API user
- Amazon Cognito
- OCR.space
- Food safety API
- Amazon Bedrock
Connections 29
- API user → FastAPI app: sends requests
app/main.py - FastAPI app → Material routes: mounts routes
app/main.py - FastAPI app → Recipe routes: mounts routes
- FastAPI app → Recommendation routes: mounts routes
- Material routes → JWT authentication: checks identity
app/api/materials.py - Recommendation routes → JWT authentication: checks identity
app/api/recommends.py - JWT authentication → Amazon Cognito: loads signing keys
app/core/auth.py - Material routes → Receipt parsing: parses receipt
app/api/materials.py - Material routes → OCR.space: submits receipt
app/api/materials.py - Material routes → Ingredient model: creates and queries
app/api/materials.py - Material routes → Database sessions: uses session
app/api/materials.py - Recipe routes → Database sessions: uses session
app/api/recipes.py - Recipe routes → Recipe and feedback models: uses recipe model
app/api/recipes.py - Recommendation routes → Recipe matching: requests recommendations
app/api/recommends.py - Recommendation routes → Expiry service dependency: resolves expiry service
app/api/recommends.py - Expiry service dependency → Expiry estimation: provides service
app/utils/bedrock_dependencies.py - Recipe matching → Ingredient model: reads ingredients
app/services/recipe_recommendation_service.py - Recipe matching → Recipe and feedback models: matches and records
app/services/recipe_recommendation_service.py - Recipe matching → PostgreSQL: queries and saves
app/services/recipe_recommendation_service.py - Expiry estimation → Amazon Bedrock: requests estimates
app/services/expiry_estimation_service.py - Scheduled sync handler → Recipe synchronization: runs synchronization
lambda/recipe_sync_handler.py - Manual sync handler → Recipe synchronization: runs synchronization
lambda/recipe_manual_sync_handler.py - Recipe synchronization → Food safety API: fetches recipes
app/services/recipe_sync_service.py - Recipe synchronization → Recipe image storage helper: uploads images
app/services/recipe_sync_service.py - Recipe synchronization → Recipe and feedback models: creates or updates
app/services/recipe_sync_service.py - Recipe synchronization → PostgreSQL: syncs catalog
app/services/recipe_sync_service.py - Database sessions → Runtime settings: reads settings
app/core/db.py - Database sessions → PostgreSQL: connects to
app/core/db.py - Expiry estimation → Runtime settings: reads settings
app/services/expiry_estimation_service.py