Files
meal-tracker/README.md

113 lines
3.1 KiB
Markdown

# Meal Tracker
A personal food and drink logging application for accountability and macro tracking.
## Project Structure
```
meal-tracker/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # Reusable UI components (Layout)
│ │ ├── pages/ # Page components (Daily, AddEntry, EntryDetail, etc.)
│ │ ├── api.js # API client
│ │ └── App.jsx # Main app with routing
│ ├── public/ # Static assets
│ ├── package.json # Client dependencies
│ └── vite.config.js # Vite configuration
├── server/ # Express backend
│ ├── routes/ # API route handlers
│ ├── models/ # Database models
│ ├── index.js # Server entry point
│ └── package.json # Server dependencies
├── uploads/ # Image uploads (food photos)
├── data/ # SQLite database
└── README.md
```
## Features
### Current Version
- Manual food entry (name, description, macros)
- Daily view of entries with date picker
- Macro tracking (calories, protein, carbs, fat)
- Meal time tags (Breakfast, Lunch, Dinner, Snack)
- Favorites system
- User authentication (login/register)
- Admin panel (view users, reset passwords)
- Dark/Light mode toggle
- PWA support (installable)
- Entry detail view with favorites toggle
### Planned
- Weekly summary charts
- Leaderboard
- Goals tracking
- Streak tracking
- Photo gallery
## Tech Stack
- **Frontend:** React, Vite, Tailwind CSS
- **Backend:** Node.js, Express
- **Database:** SQLite (local)
- **Food API:** OpenFoodFacts (free, no key required)
## API Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /api/entries | Get all entries |
| POST | /api/entries | Create new entry |
| GET | /api/entries/:id | Get single entry |
| DELETE | /api/entries/:id | Delete entry |
| POST | /api/entries/:id/favorite | Toggle favorite |
| GET | /api/favorites | Get favorite entries |
| GET | /api/foods/search | Search food database |
| GET | /api/summary/daily | Get daily summary |
| GET | /api/goals | Get user goals |
| GET | /api/streak | Get streak info |
| POST | /api/auth/login | User login |
| POST | /api/auth/register | User registration |
| GET | /api/auth/me | Get current user |
| GET | /api/admin/users | Get all users (admin) |
| POST | /api/admin/users/:id/reset-password | Reset user password |
## Default Users
- **Admin:** admin / admin123
- **User:** rob / meal123
## Running Locally
```bash
# Install dependencies
cd client && npm install
cd ../server && npm install
# Start backend
cd server && npm start
# Start frontend (separate terminal)
cd client && npm run dev
```
## Deployment
### Server (VM at 10.10.10.143)
```bash
cd server
node index.js
```
### Build Frontend
```bash
cd client
npm run build
# Deploy dist/* to server public folder
```
## Environment Variables
Server runs on port 3000 by default. No additional environment variables required for local setup.