Skip to content

LizaMerzhv/food-diary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Food Diary

A full-stack web application for daily meal logging and nutrition tracking, with progress visualization and barcode-based product import via the Open Food Facts API.

Table of Contents

Tech Stack

  • Backend: Java 21, Spring Boot 3, PostgreSQL, Redis, Flyway, Resilience4j, Bucket4j

  • Frontend: React, TypeScript, Vite, MUI

  • Infrastructure: Docker Compose, Nginx

Architecture & Technical Highlights

  • External API Resilience: Barcode lookups rely on the Open Food Facts API. To prevent cascading failures and handle external downtime, the integration is wrapped in a Resilience4j Circuit Breaker.

  • Caching Strategy: Repeated external API queries are cached in Redis with a defined TTL to reduce latency and avoid rate-limit bans from the provider.

  • Rate Limiting: Unauthenticated endpoints (like the Demo session generator) are protected against abuse and brute-force attacks using Bucket4j.

  • Database Migrations: Schema evolution is strictly versioned and managed via Flyway.

  • Authentication: Google OAuth2 integration alongside a custom temporary session mechanism for demo users.

Features

Diary & Meal Tracking

  • Time-series based meal logging categorized by daily slots (breakfast, lunch, dinner, snacks).

  • Supports composite entities (saved dishes) and single entities (products).

Diary page

Catalog & Data Management

  • Global catalog with search and filtering based on categories and tags.

  • Users can fork global items into private catalogs for custom modifications.

My dishes list

Product Ingestion

  • Manual product creation or automated barcode ingestion via Open Food Facts.

Create product from barcode

Recipe Builder (Dishes)

  • Dynamic calculation of macronutrients based on ingredient proportions.

Create dish

Demo Mode (Guest Sessions)

  • Sandboxed temporary sessions via POST /api/v1/demo/session utilizing separate roles to isolate demo data from real accounts.

Demo mode session

Quickstart

git clone https://github.com/LizaMerzh/food-diary.git
cd food-diary

Create a .env file in the root directory:

GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret

Run the application:

docker compose up --build

Open: http://localhost/

API Documentation: OpenAPI/Swagger UI is available at http://localhost:8080/swagger-ui.html when running locally.

About

Food Diary is a full-stack web application for daily meal logging and nutrition tracking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages