A simple, responsive fitness tracking web application built with vanilla HTML, CSS, and JavaScript. No frameworks or npm packages required.
- User Authentication: Sign up and sign in functionality with local storage
- Activity Tracking: Track steps, distance, and calories burned
- Dashboard: View today's fitness statistics at a glance
- Activity History: View and manage your fitness activities
- Google Fit Integration: Connect to Google Fit to sync fitness data (requires API credentials)
- Responsive Design: Works on desktop and mobile devices
- Local Storage: All data is stored locally in the browser
runtrack-app/
├── index.html # Main HTML file
├── style.css # CSS styling
├── app.js # Main application logic
├── auth.js # Authentication module
├── googlefit.js # Google Fit integration
└── README.md # This file
- Clone or download this project to your local machine
- Set up Google Cloud Console (see section below for Google Fit integration)
- Run the app locally (see section below)
- Open the app and start tracking your runs!
- Open the project folder in VS Code
- Install the "Live Server" extension from the marketplace
- Right-click on
index.htmland select "Open with Live Server" - The app will open at
http://localhost:5500
- Make sure you have Node.js installed
- Open a terminal in the project directory
- Run:
npx serve . -p 3000 - Open your browser and navigate to
http://localhost:3000
- Make sure you have Python installed
- Open a terminal in the project directory
- Run:
python -m http.server 3000(Python 3) orpython -m SimpleHTTPServer 3000(Python 2) - Open your browser and navigate to
http://localhost:3000
Note: Make sure to use http://localhost:3000 (or your chosen port) as the authorized JavaScript origin in your Google Cloud Console setup.
- Create an account using the Sign Up button
- Sign in with your credentials
- View your dashboard to see fitness statistics
- Add activities manually or sync with Google Fit
To enable Google Fit integration, follow these exact steps:
- Go to https://console.cloud.google.com
- Sign in with your Google account
- Click the project dropdown at the top and select "NEW PROJECT"
- Enter "RunTrack" as the project name
- Click "CREATE"
- In the navigation menu, go to APIs & Services > Library
- Search and enable these APIs:
- Fitness API
- Google Identity Services API
- Wait for each API to finish enabling (may take a few minutes)
- Go to APIs & Services > OAuth consent screen
- Choose External and click "CREATE"
- Fill in required fields:
- App name: "RunTrack"
- User support email: your email address
- Developer contact: your email address
- Click "SAVE AND CONTINUE"
- On the "Scopes" screen, click "ADD OR REMOVE SCOPES"
- Search and add:
.../auth/fitness.activity.write - Click "UPDATE" then "SAVE AND CONTINUE"
- On the "Test users" screen, click "ADD USERS"
- Add your Google email address as a test user
- Click "SAVE AND CONTINUE"
- Review and click "BACK TO DASHBOARD"
- Go to APIs & Services > Credentials
- Click + CREATE CREDENTIALS
- Select OAuth 2.0 Client ID
- Configure the client:
- Application type: Web application
- Name: RunTrack Web Client
- Under Authorized JavaScript origins, add:
http://localhost:3000- Your deployed URL (if applicable)
- Under Authorized redirect URIs, add:
http://localhost:3000- Your deployed URL (if applicable)
- Click CREATE
- Copy the Client ID - you'll need this for the next step
- Open
auth.jsin your project - Replace
"YOUR_GOOGLE_CLIENT_ID"with the Client ID you copied - Save the file
Your Google Fit integration is now configured! The app will be able to authenticate users and sync runs to Google Fit.
Note: During development, you'll need to use a test user account (the email you added in step 3). The app will only work for test users until you publish your app and Google reviews it.
- Main HTML structure for the application
- Contains navigation, dashboard, activities, and profile sections
- Includes all script references
- Complete CSS styling for the application
- Responsive design that works on mobile and desktop
- Modern gradient design with hover effects
- Form styling and modal components
- Main application class
RunTrackApp - Handles navigation, data management, and UI updates
- Manages activities and user data
- Provides notification system
- Authentication class
Auth - Handles user registration, login, and logout
- Password hashing and verification
- Modal-based UI for login/signup forms
- Profile management
- Google Fit integration class
GoogleFit - Connects to Google Fit API
- Fetches steps, distance, and calories data
- Syncs data with the application
- Requires Google API credentials
All user data is stored locally in the browser using localStorage:
- User accounts and credentials
- Activity history
- User preferences
- Authentication tokens
The application integrates with the Google Fit API to:
- Read fitness data (steps, distance, calories)
- Sync today's activities
- Provide real-time fitness statistics
Required Scopes:
fitness.activity.readfitness.body.readfitness.location.read
This application works in all modern browsers that support:
- ES6 JavaScript features
- Local Storage API
- CSS Grid and Flexbox
- Fetch API (for Google Fit integration)
- Passwords are hashed using a simple algorithm (for demonstration only)
- In production, use proper password hashing (bcrypt, etc.)
- Google Fit integration requires proper OAuth setup
- All data is stored locally and not transmitted to external servers
- Create new sections in
index.html - Add corresponding styles in
style.css - Implement functionality in
app.jsor create new modules
- Modify colors and gradients in
style.css - Update font families and sizes
- Adjust responsive breakpoints
- Add new fitness tracking integrations
- Extend the activity data structure
- Implement data export/import features
- Google Fit not connecting: Ensure API credentials are properly configured
- Data not saving: Check if localStorage is enabled in your browser
- Responsive issues: Test on different screen sizes
- Use browser developer tools to debug
- Check console for error messages
- Test localStorage functionality
- Create a new repository on GitHub
- Push your RunTrack code to the repository
- Ensure all files are committed and pushed
- Go to netlify.com
- Click "New site from Git"
- Connect your GitHub account
- Select the RunTrack repository
- Deploy with default settings
- Copy your Netlify URL (e.g.,
https://runtrack-xyz.netlify.app)
- Go to Google Cloud Console
- Navigate to APIs & Services > Credentials
- Find your OAuth 2.0 Client ID
- Under Authorized JavaScript origins, add your Netlify URL
- Save changes
- Open your Netlify URL on mobile phone
- Test GPS tracking in real-world conditions
- Verify Google Fit sync functionality
- Check responsive design on different screen sizes
- GPS updates within 5 seconds of start
- Timer increments every second smoothly
- Distance matches ~phone native within 5%
- Start/stop button responds instantly
- Google Fit shows activity after save
- No console errors in Chrome mobile emulation
- HTTPS properly configured for production
- CSP headers allow Google APIs
- Mobile GPS permissions working correctly
- Offline mode functions properly
- Toast notifications display correctly on mobile
This project is open source and available under the MIT License.
Feel free to submit issues, feature requests, or pull requests to improve this application.
Note: This is a demonstration project. For production use, implement proper security measures, error handling, and backend services.