A professional-grade health tracking web application built with pure vanilla JavaScript, HTML5, and CSS3. Track calories, monitor nutrition, and visualize your health data with beautiful charts.
Maintaining a healthy diet requires consistent tracking of food intake and nutrition. Most calorie tracking apps are either:
- Too complex with unnecessary features
- Require account creation and share your data
- Need expensive subscriptions
HealthGrid solves this by providing a beautiful, privacy-first calorie tracker that:
- Works entirely in your browser (no backend needed)
- Stores all data locally using LocalStorage
- Supports thousands of foods via the Nutrition API
- Provides clear visualizations of your eating patterns
- Real-time Statistics - Total calories, meals logged, protein/carbs breakdown
- Canvas-based Chart - Currency-style area chart showing calorie trends
- Time Period Selector - View data for 7 days, 2 weeks, 1 month, 3 months, or 6 months
- Recent Meals List - Quick view of latest logged foods
- Nutrition Breakdown - Visual bars for protein, carbs, and fat
- API-Powered Search - Search any food using the API Ninjas Nutrition API
- Local Food Database - 25+ common foods (Indian & global) as fallback
- Manual Entry - Add custom foods with full nutrition data
- Real-time Totals - Animated calorie counter with macro summary
- History Modal - View all past tracking data
- Animated Particle Background - Canvas-based interactive particles
- Hero Section - With floating cards and counter animations
- Features Showcase - Highlighting all app capabilities
- Testimonials - Social proof section
- Responsive Design - Works on all screen sizes
- Dark/Light Theme - Toggle with persistence
- Responsive Navigation - Desktop and mobile menu
- Toast Notifications - Visual feedback for actions
- Data Sync - All pages share the same localStorage data
| Concept | Implementation |
|---|---|
| Creating Elements Dynamically | Search results, food list items, history entries, chart data points |
| Updating DOM Based on Interaction | Real-time calorie totals, chart time period changes, theme toggle |
| Removing/Toggling Elements | Remove food items, toggle manual entry section, show/hide modals |
| Changing Styles via JavaScript | Theme switching, progress bar widths, chart rendering |
| Event Handling (Click) | Add food buttons, navigation, theme toggle, remove items |
| Event Handling (Form) | Search input, manual entry form, quantity inputs |
| Event Handling (Keyboard) | Enter to search, Escape to close modals |
| Event Delegation | Food list remove buttons, search results add buttons |
| Fetch API | Nutrition data from API Ninjas |
| LocalStorage | Calorie data persistence, theme persistence, API key storage |
| Canvas API | Area chart rendering, particle animation background |
| Intersection Observer | Scroll-triggered animations on homepage |
| requestAnimationFrame | Smooth animations for numbers, chart rendering |
WedDev_EndTerm_project/
βββ Dashboard/
β βββ Dashboard.html # Main dashboard page
β βββ Dashboard.css # Dashboard styles
β βββ Dashboard.js # Chart & data logic
βββ HomePage/
β βββ index.html # Landing page
β βββ style.css # Homepage styles
β βββ script.js # Particles & animations
βββ calorie_Tracker/
β βββ calorie_Tracker.html # Food tracking page
β βββ calorie_Tracker.css # Tracker styles
β βββ calorie_Tracker.js # API integration & logging
βββ favicon.png # App favicon/icon
βββ dashboard-screenshot.png # Dashboard preview image
βββ README.md # This file
- Clone or download this repository
- Open
HomePage/index.htmlin any modern web browser - Navigate using the navbar to access different sections
- Optional: Add API Key for unlimited food search
- Visit api-ninjas.com
- Create a free account
- Copy your API key
- Paste it when prompted in the Calorie Tracker
Note: The app works without an API key using the built-in local food database.
- Endpoint:
https://api.api-ninjas.com/v1/nutrition - Method: GET with query parameter
- Authentication: API key in
X-Api-Keyheader - Features: Natural language query (e.g., "2 eggs and toast")
// Example API call
fetch('https://api.api-ninjas.com/v1/nutrition?query=apple', {
headers: { 'X-Api-Key': 'YOUR_API_KEY' }
})
.then(response => response.json())
.then(data => console.log(data));{
"2026-01-20": {
"foods": [
{
"name": "chicken breast",
"kcal": 165,
"protein": 31,
"carbs": 0,
"fat": 3.6,
"time": "20 Jan 2026, 10:30 AM"
}
],
"total": 165
}
}"dark" | "light""your-api-key-here"- API Rate Limits - Free tier has daily request limits
- Offline Mode - API search requires internet (local DB works offline)
- Browser Support - Requires modern browser with ES6+ support
- Data Backup - LocalStorage can be cleared by browser; no export feature yet
- HTML5 - Semantic markup, Canvas elements
- CSS3 - Flexbox, Grid, Custom Properties, Animations, Glassmorphism
- Vanilla JavaScript (ES6+) - Classes, Arrow functions, Template literals, Async/await, Fetch API
- Browser APIs - LocalStorage, Canvas, Intersection Observer, Fetch
Amartya Majumder
Built with π using pure vanilla technologies for WebDev EndTerm Project
