A modern, full-stack nutrition and fitness tracking application with a beautiful Material-UI interface, featuring light/dark mode and integration with USDA FoodData Central database.
- Features
- Tech Stack
- Installation
- Configuration
- Usage
- Production Deployment
- Security Notes
- License
- Contributing
- Support
- Real-time daily calorie and macro tracking
- Visual progress indicators with circular progress
- Quick view of protein, carbs, and fat intake
- Color-coded thresholds for goal tracking
- USDA Database Integration: Search from thousands of foods in the USDA FoodData Central database
- Personal food library for your custom entries
- Edit nutritional values before logging
- Quick-add functionality with customizable servings
- Historical food log viewing with date navigation
- Delete and manage logged entries
- Log weight in pounds or kilograms
- Visual progress chart using Chart.js
- Historical weight data viewing
- Full history with date filters
- Delete and manage weight entries
- Automatic Goal Calculation: Based on your weight logs and goal type
- Weight Loss (~1 lb/week)
- Muscle Growth (Lean Bulk)
- Weight Maintenance
- Manual Goal Setting: Set custom calorie and macro targets
- Complete user profile with:
- Date of birth, gender, height
- Activity level tracking
- Height measurement in ft/in or cm
- Material-UI Components: Beautiful, responsive design
- Light/Dark Mode: Seamless theme switching
- Gradient Accents: Modern, polished aesthetic
- Floating Navigation: Glassmorphism design
- Progressive Web App: Add to homescreen on mobile devices
- Safe Area Support: Works perfectly with device notches and home indicators
- Secure JWT-based authentication
- Automatic token refresh
- User registration and login
- Protected routes and endpoints
- FastAPI - Modern Python web framework
- SQLAlchemy - ORM for database operations
- SQLite - Lightweight database
- httpx - Async HTTP client for USDA API
- python-jose - JWT authentication
- bcrypt - Password hashing
- React - UI library
- Vite - Build tool and dev server
- Material-UI (MUI) - Component library
- Chart.js - Weight progress charts
- react-toastify - Toast notifications
- Axios - HTTP client
- USDA FoodData Central API - Food nutrition database
- Python 3.8+
- Node.js 16+
- USDA FoodData Central API key (free) from fdc.nal.usda.gov
- Clone the repository:
git clone https://github.com/yourusername/chunklog.git
cd chunklog- Create a virtual environment and activate it:
python -m venv venv
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate- Install backend dependencies:
pip install -r requirements.txt- Set up environment variables in
/.env:
USDA_API_KEY=your_usda_api_key_here
SECRET_KEY=your_secret_key_here
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000- Start the backend server:
cd backend
uvicorn app.main:app --reload --port 8000The API will be available at http://localhost:8000
- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Create a
.envfile (optional, defaults to localhost):
VITE_API_URL=http://localhost:8000- Start the development server:
npm run devThe app will be available at http://localhost:5173
USDA_API_KEY: Your USDA FoodData Central API key (required for food search)SECRET_KEY: Secret key for JWT token signingALLOWED_ORIGINS: Comma-separated list of allowed origins for CORS
VITE_API_URL: Backend API URL (default:http://127.0.0.1:8000)
- Create an Account: Click "Sign Up" on the login page
- Complete Your Profile: Fill in date of birth, gender, height, and activity level
- Set Your Goals: Choose automatic goal calculation or set manual targets
- Start Logging: Log your meals and weight to track your progress
- Click the "Log Meal" button on the dashboard or navigate to the Food page
- Search for foods in the USDA database or your personal library
- Select a food from the search results
- Optionally edit nutritional values
- Choose whether to save to your library (for USDA foods)
- Set servings and log the food
- Click the "Log Weight" button on the dashboard or navigate to Weight page
- Enter your weight and select lbs or kg
- Choose the date (defaults to today)
- Log your weight
- Navigate to the Food or Weight page
- Use date navigation to view past entries
- Delete entries by clicking the delete button
- Use a production ASGI server:
uvicorn app.main:app --host 0.0.0.0 --port 8000Or with Gunicorn:
gunicorn app.main:app -w 4 -k uvicorn.workers.UvicornWorker- Update
ALLOWED_ORIGINSin.envto include your production frontend URL
- Build for production:
npm run build-
Serve the
distfolder with a web server (nginx, Apache, etc.) -
For deployment platforms like Vercel or Netlify:
- Vercel: Connect your GitHub repo and deploy
- Netlify: Build command:
npm run build, Publish directory:dist
- Passwords are hashed using bcrypt
- JWT tokens are used for authentication
- Token refresh mechanism prevents frequent re-logins
- CORS is configured to restrict origins
- SQL injection prevented by SQLAlchemy ORM
MIT License
Contributions are welcome! Please feel free to submit a Pull Request.
For issues and feature requests, please open an issue on GitHub.
Built with ❤️