# Keep My Weight Tracker A minimalist, privacy-first web application for tracking your weight and daily meals. This application is designed to be simple, lightweight, and focused on data ownership. ## Features - **Weight Tracking**: Log your weight with optional notes - **Meal Logging**: Record your daily breakfast, lunch, dinner, and other meals - **Data Visualization**: View your weight progress on an interactive chart - **Data Export/Import**: Export and import your data as JSON or CSV - **Privacy-First**: All data stays on your device using browser's localStorage - **Password Protection**: Secure access to your health data - **Automated Backups**: Optional S3-compatible storage backups - **Mobile-Friendly**: Responsive design works on all devices ## Getting Started 1. Clone this repository or download the source code 2. Open `index.html` in your web browser 3. Start logging your weight and meals! No installation or setup required. The application works entirely in your browser. ## Data Storage All your data is stored locally in your browser using localStorage. No data is sent to any server. - To backup your data, use the "Export Data" button in the Settings tab - To restore a backup, use the "Import Data" button in the Settings tab ## Technical Details This application is built with: - **Frontend**: HTML5, CSS3, and vanilla JavaScript (ES6+) - **Data Storage**: Browser localStorage - **Charts**: Chart.js library - **Dependencies**: None, except Chart.js which is loaded from CDN ## Deployment ### Local Development Simply open `index.html` in your web browser. ### Docker Deployment The application includes a complete Docker setup with persistent data storage. ```bash # Build and run with Docker Compose docker-compose up -d ``` This will create: - A container with both the web server and data API - A persistent volume for data storage at `/data` ### Coolify Deployment To deploy on Coolify with persistent storage: 1. In your Coolify dashboard, create a new service 2. Select "Docker Compose" as the deployment type 3. Connect to your Git repository or upload the files directly 4. **Important**: The docker-compose.yml file has been configured with: - A named volume: `coolify-weight-tracker-data` - A Coolify-specific label: `coolify.volume.weight-tracker-data=/data` 5. Deploy the application 6. Verify that the persistent volume appears in your Coolify resources The application will be available at the URL provided by Coolify. All weight and meal data will be stored in the persistent volume, ensuring your data remains intact across container restarts or updates. #### Verifying Data Persistence After deployment: 1. Add some weight or meal entries in the application 2. Restart the container from the Coolify dashboard 3. Verify your data is still available after the restart Even with persistent storage configured, it's recommended to occasionally use the "Export Data" feature in the Settings tab as an additional backup. ### S3 Backup Configuration The application includes automated backups to S3-compatible storage (like Minio): 1. **Configure S3 Credentials in Coolify**: - In your Coolify dashboard, go to your Weight Tracker service - Under the "Environment Variables" section, set the following: - `S3_ENDPOINT`: Your Minio server URL (e.g., `https://minio.example.com`) - `S3_REGION`: Region name (e.g., `us-east-1`, can be any value for Minio) - `S3_BUCKET`: Bucket name for backups (e.g., `weight-tracker-backups`) - `S3_ACCESS_KEY`: Your Minio access key - `S3_SECRET_KEY`: Your Minio secret key - `S3_USE_SSL`: Set to `true` if your Minio server uses HTTPS 2. **Backup Schedule (Optional)**: - `BACKUP_SCHEDULE`: Cron expression for backup schedule (default: `0 0 * * *` - daily at midnight) - `BACKUP_RETENTION`: Number of backups to keep (default: `7`) 3. **Verify Backups**: - Check your Minio bucket for backup files named `weight-tracker-backup-[timestamp].json` - Backups are automatically rotated based on the retention setting ### Authentication The Weight Tracker application can be password-protected to secure your personal health data. To enable password protection, set the following environment variables in your Coolify deployment: - `AUTH_USERNAME`: The username for authentication (defaults to `user` if not specified) - `AUTH_PASSWORD`: The password for authentication (defaults to `password` if not specified) Example: ``` AUTH_USERNAME=myusername AUTH_PASSWORD=mysecurepassword ``` ### Authentication Details 1. **Simple Setup**: Just set the username and password directly in your environment variables 2. **Browser Login**: When accessing your Weight Tracker, you'll be prompted with a browser login dialog 3. **Login Credentials**: - Username: The value of `AUTH_USERNAME` (defaults to `user`) - Password: The value of `AUTH_PASSWORD` (defaults to `password`) > **Note**: This approach uses Nginx's basic authentication with plaintext passwords stored in environment variables. While simpler to set up, ensure your Coolify environment is secure and that you're using HTTPS for all connections. ### Password Protection The application includes password protection to secure your health data: 1. **Generate a Password Hash**: ```bash # Install dependencies locally npm install bcryptjs # Generate a hash for your password node generate-password-hash.js your-secure-password ``` This will output a bcrypt hash that you can use in your environment variables. 2. **Configure Password in Coolify**: - In your Coolify dashboard, go to your Weight Tracker service - Under the "Environment Variables" section, set: - `PASSWORD_HASH`: The bcrypt hash generated in step 1 - `SESSION_SECRET`: A random string for session encryption - `COOKIE_SECURE`: Set to `true` if using HTTPS 3. **Alternative: Use Your Caddy Hash**: - If you already have a bcrypt hash from Caddy, you can use it directly - Set the `PASSWORD_HASH` environment variable to your existing bcrypt hash 4. **Security Notes**: - The password is never stored in plain text - Only the hash is stored in the environment variable - Authentication uses secure HTTP-only cookies - Sessions expire after 24 hours of inactivity ## Roadmap ### Phase 1 (Current) - Weight log UI + persistence - Meal log UI + persistence - Save & Load from JSON ### Phase 2 - Weight evolution line chart - CSV export of all entries - Date-range filters ### Phase 3 - JSON import (merge vs overwrite) - Responsive mobile-first refinements - Docker & Coolify deployment docs ### Phase 4 - Theming (light/dark) - Localization support - Migration guide ## License MIT License ## Privacy Policy This application does not collect any personal data. All data you enter remains on your device.