A modern, full-stack web application for tracking weight progress with beautiful charts and dark mode support.
The application is deployed and ready to use! You can create an account and start tracking your weight progress immediately.
- π Visual Charts - Interactive weight progress visualization using Chart.js
- π Dark Mode - Beautiful dark/light theme toggle with persistent settings
- π± Responsive Design - Optimized for desktop and mobile devices
- π Secure Authentication - JWT-based user authentication with refresh tokens
- π Weight Management - Add, edit, delete weight entries with notes
- π Toast Notifications - Real-time feedback for user actions
- π Pagination - Efficient data loading with pagination support
- β‘ Fast Performance - Optimized React components and API endpoints
- React 19 - Modern React with hooks and functional components
- Vite - Fast build tool and development server
- Chart.js - Interactive charts and data visualization
- React Router - Client-side routing
- CSS Modules - Scoped styling with CSS modules
- Custom Hooks - Reusable logic with custom React hooks
- Node.js - Server runtime environment
- Express.js - Web application framework
- MongoDB - NoSQL database for data storage
- JWT - JSON Web Tokens for authentication
- Joi - Data validation and sanitization
- Helmet - Security middleware
- CORS - Cross-origin resource sharing
- Rate Limiting - API protection against abuse
- Node.js (v16 or higher)
- MongoDB (local or cloud)
- Git
-
Clone the repository
git clone https://github.com/Ligo-code/weightTracker.git cd weightTracker -
Install dependencies
# Install server dependencies cd server npm install # Install client dependencies cd ../client npm install
-
Environment Setup
β οΈ Security Note: Never commit.envfiles to version control!# Copy the example file and configure your environment cd server cp .env.example .env
Edit
.envfile with your actual values:PORT=5000 MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/database JWT_SECRET=your-super-secure-jwt-secret-minimum-32-characters JWT_LIFETIME=30d REFRESH_SECRET=your-super-secure-refresh-secret-minimum-32-characters
π Generate secure secrets:
# Generate random secrets node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
π Required Environment Variables:
PORT- Server port (default: 5000)MONGO_URI- MongoDB connection stringJWT_SECRET- Secret for JWT token signing (min 32 chars)JWT_LIFETIME- JWT token expiration timeREFRESH_SECRET- Secret for refresh token signing (min 32 chars)
-
Start the application
# Start server (from server directory) npm run dev # Start client (from client directory) npm run dev
-
Open your browser Navigate to
http://localhost:5173
- π API Documentation - Complete API reference with examples
- π Changelog - Project development history
- π Deployment Info - Live deployment details
π¨ Important Security Guidelines:
- Never commit
.envfiles - They contain sensitive data - Use strong secrets - Minimum 32 characters for JWT secrets
- Different secrets for different environments - Dev, staging, production
- Rotate secrets regularly - Especially if compromised
For production environments (Render, Heroku, Vercel, etc.):
- Set environment variables through platform interface
- Use platform's secret management
- Enable environment variable encryption if available
- Monitor for secret leaks in logs
# Generate secure JWT secrets
node -e "console.log('JWT_SECRET=' + require('crypto').randomBytes(32).toString('hex'))"
node -e "console.log('REFRESH_SECRET=' + require('crypto').randomBytes(32).toString('hex'))"
# Or use online tools (ensure HTTPS):
# https://generate-secret.vercel.app/32server/
βββ .env # Your local environment (gitignored)
βββ .env.example # Template for other developers
βββ .env.local # Local overrides (gitignored)
βββ .env.production # Production template (gitignored)
weightTracker/
βββ client/ # React frontend
β βββ public/ # Static assets
β βββ src/
β β βββ api/ # API service functions
β β βββ components/ # React components
β β β βββ Layout/ # Layout components
β β β βββ UI/ # UI components
β β βββ hooks/ # Custom React hooks
β β βββ pages/ # Page components
β β βββ styles/ # CSS modules
β βββ package.json
βββ server/ # Node.js backend
β βββ controllers/ # Route controllers
β βββ db/ # Database configuration
β βββ middleware/ # Custom middleware
β βββ models/ # MongoDB models
β βββ routes/ # API routes
β βββ services/ # Business logic
β βββ package.json
βββ README.md
- App.jsx - Main application component with theme management
- WeightTracker.jsx - Core weight management interface
- WeightChart.jsx - Chart visualization component
- AuthForm.jsx - Authentication form component
- Toast.jsx - Notification system component
- useToast - Toast notification management
- useAuth - Authentication state management
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production buildnpm run dev # Start with nodemon
npm start # Start production server- ESLint configuration for consistent code style
- CSS Modules for scoped styling
- Functional components with hooks
- Modern ES6+ syntax
- JWT Authentication with refresh tokens
- Password Hashing using bcrypt
- Request Validation with Joi schemas
- Rate Limiting to prevent abuse
- CORS Configuration for cross-origin requests
- Helmet.js for security headers
- XSS Protection with sanitization
This project is licensed under the MIT License - see the LICENSE file for details.
Ligo-code
- GitHub: @Ligo-code
β This project showcases modern full-stack development skills and is part of my professional portfolio.