Skip to content

hbiegacz/BiteRight

Repository files navigation

BiteRight | Nutrition & Activity Tracker ⚖️ 🥗🏋🏻‍♂️

Contributors Commit Activity GitHub commits Repo Size Lines of Code License: MIT

Eat, track, succeed.

BiteRight is a nutrition and activity tracking application designed for individuals looking to monitor their dietary habits and physical performance. It provides tools for logging daily food and water intake, managing nutritional goals, and tracking exercise data to support a balanced lifestyle.

Features

  • Nutritional Tracking: Log meals to calculate daily calorie and macronutrient (protein, carbohydrates, fats) intake
  • Goal Management: Set and update personal targets for calories, macronutrients, and water consumption
  • Activity Logging: Record physical exercises to track estimated calories burned
  • Progress Analytics: Monitor weight history and review performance

📹 Quick Demo

Modern landing page
landing page
Onboarding process
onboarding demo

🛠️ Tech Stack & Architecture

Java JavaScript HTML5 CSS Spring Boot Next.js Docker Nginx MySQL Git

BiteRight uses a containerized architecture with a Spring Boot REST API and a Next.js frontend, run using Docker and served through an Nginx reverse proxy.

Backend (Spring Boot)

  • Security & Authorization: Uses a stateless security model with Spring Security and JSON Web Tokens (JWT). A custom JwtFilter checks bearer tokens against the user database for secure, token-based sessions without server-side storage.
  • Email Service: Uses SMTP via JavaMailSender for sending automated emails (registration, password recovery). It uses HTML templates and a dedicated service layer.
  • Persistence Layer: Built on Spring Data JPA with a MySQL database. It uses audit tables for weight and limit history to keep data consistent across the system.

Frontend (Next.js)

  • Structure: Built with the Next.js App Router (React Server Components). It uses nested layouts to keep dashboard modules (meals, exercises, progress) separate and fast.
  • Data Management: Uses a central API layer to talk to the backend. It manages state transitions with React hooks and service modules to keep data in sync across the frontend.

Infrastructure & DevOps

  • Docker: Managed by Docker Compose, with multi-stage builds for both the Spring Boot JAR and the Next.js production files.
  • Reverse Proxy: Nginx handles request routing, static files, and CORS settings, acting as the main entry point for the application.

💾 Database & Data Model

The system relies on a relational database (MySQL) designed with 18 tables to manage user profiles, nutrition data, and historical records.

  • Triggers & Automation: Database functions handle automatic BMI calculation, calorie burns, and history archiving to keep data synchronized.
  • Optimized Views: SQL views (like daily_summary) aggregate complex data from multiple sources (meals, water, exercises) to simplify backend operations.
  • Consistency: Strong relational constraints ensure data integrity across ingredients, recipes, and user logs.

🚀 Run Locally

Getting started with BiteRight is simple and straightforward. Follow these steps to get the application running on your local machine in just a few minutes. Make sure you have Docker and Docker Compose installed on your machine.

First, download the project source code to your local machine:

    git clone https://github.com/hbiegacz/BiteRight.git
    cd BiteRight
    # Copy the example environment file and fill in the values
    cp .env.example .env
    docker-compose up --build

Stop and clean the environment:

docker compose down -v

Thanks for reading this far!

About

Health application designed for monitoring diet and physical activity, implemented with Java Spring Boot and Next.js

Topics

Resources

License

Stars

Watchers

Forks

Contributors