Skip to content

Rakshit-Rangarajan/ForgeFit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

24 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation


Live Demo App Portfolio Wear OS


A private full-stack AI fitness app โ€” PostgreSQL backend, JWT auth, free Claude AI via Puter.js, Wear OS support, and a polished public demo landing page.


Node.js Express PostgreSQL Docker Puter.js Claude AI JWT PWA


๐Ÿ“– Overview

ForgeFit is a private full-stack personal fitness web app for complete beginners targeting visible abs and a healthy lifestyle. It has a Node.js + PostgreSQL backend with JWT authentication, free Claude AI coaching via Puter.js (no API key, no billing), Samsung Health data import, a Wear OS watch layout, and a full alarm/reminder system.

The public landing page (/) showcases the app as a portfolio project. The actual app lives at /app/ โ€” private, login-required, with AI features unlocking via a free Puter account during onboarding.


โœจ Features

Feature Description
๐Ÿ” Private Accounts No public signup. Admin creates users directly via SQL. JWT tokens, 30-day sessions.
๐ŸŒ Public Landing Page Polished demo/portfolio page at / โ€” showcases features, phone mockup, tech stack, CTAs.
๐Ÿ‘ค Smart Onboarding First-login profile setup with BMI-based goal recommendations. Puter sign-in during onboarding for immediate AI access.
๐Ÿค– AI Coach (Free) Claude Sonnet via Puter.js โ€” completely free, no API key. Knows your BMI, goal, fitness level, and Indian dietary context.
๐Ÿ“Š Health Report Analysis Upload MovingLife/HealthSense screenshot โ€” AI reads it via Puter vision, extracts metrics, builds 5-point action plan.
๐Ÿ“ˆ Progress Tracking PostgreSQL-backed weight, BMI, and session logs with live Chart.js graphs. Synced across all devices.
๐Ÿ‹๏ธ Goal-Aware Workouts Exercise list adapts to your goal (fat loss, abs, muscle, recomposition). AI generates custom session plans.
๐Ÿ“ฑ Samsung Health Import Export JSON from Samsung Health, import weight and step data directly.
โŒš Wear OS Layout Minimal watch UI at ?watch=1 โ€” streak, water, steps, BMI, next alarm, quick-log buttons.
๐Ÿ”” Smart Alarms Time-based reminders with Web Audio API sounds, browser notifications, haptic vibration, and snooze. Synced to DB.
๐Ÿ’ง Water Reminder Daily glass tracking, progress rings, goal logging.

๐Ÿ—๏ธ Architecture

forgefit.rakshitr.co.in
        โ”‚
        โ”œโ”€โ”€ /              โ†’ Landing page (public portfolio demo)
        โ”œโ”€โ”€ /app/          โ†’ PWA app (login required)
        โ””โ”€โ”€ /api/          โ†’ Express REST API (JWT protected)
                โ”‚
                โ”œโ”€โ”€ PostgreSQL (auth, profiles, logs, alarms)
                โ””โ”€โ”€ AI: Puter.js client-side โ†’ Claude Sonnet (FREE)

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              Docker on your server               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  Nginx   โ”‚  โ”‚  Node.js API โ”‚  โ”‚ Postgres โ”‚  โ”‚
โ”‚  โ”‚ :80/:443 โ”‚โ†’ โ”‚    :3001     โ”‚โ†’ โ”‚  :5432   โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ†• HTTPS
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Android PWA โ”‚   โ”‚  Desktop     โ”‚   โ”‚ Wear OS  โ”‚
โ”‚   /app/     โ”‚   โ”‚ phone shell  โ”‚   โ”‚ ?watch=1 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Deployment

Prerequisites

  • Docker + Docker Compose installed on your server
  • Domain pointing to your server (forgefit.rakshitr.co.in)
  • SSL certificate (Let's Encrypt recommended)
  • A free Puter account for AI features (no billing ever)

1 ยท Clone & Configure

git clone https://github.com/yourusername/forgefit.git
cd forgefit
cp .env.example .env
nano .env

Your .env needs only two secrets:

DB_PASSWORD=your_strong_database_password
JWT_SECRET=64_char_hex_string
FRONTEND_URL=https://forgefit.rakshitr.co.in

Generate a secure JWT secret:

node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"

No Anthropic API key needed. AI is handled client-side via Puter.js for free.


2 ยท SSL Certificates

mkdir nginx/certs

# Using Certbot (Let's Encrypt):
certbot certonly --standalone -d forgefit.rakshitr.co.in

cp /etc/letsencrypt/live/forgefit.rakshitr.co.in/fullchain.pem nginx/certs/
cp /etc/letsencrypt/live/forgefit.rakshitr.co.in/privkey.pem nginx/certs/

3 ยท Launch Everything

docker-compose up -d --build

# Verify all 3 services are healthy
docker-compose ps

# Stream logs
docker-compose logs -f api

4 ยท Create Your First User Account

# Connect to the database
docker exec -it forgefit_db psql -U forgefit_user -d forgefit
-- Create your admin account
INSERT INTO users (username, email, password_hash, role)
VALUES (
  'rakshit',
  'rakshitr2000@gmail.com',
  crypt('your_secure_password', gen_salt('bf')),
  'admin'
);

-- Create a regular user for someone else
INSERT INTO users (username, email, password_hash)
VALUES (
  'friend',
  'friend@example.com',
  crypt('their_password', gen_salt('bf'))
);

-- Verify accounts
SELECT id, username, email, role, is_active FROM users;

Other useful SQL commands:

-- Deactivate a user
UPDATE users SET is_active = false WHERE username = 'friend';

-- Reset a password
UPDATE users SET password_hash = crypt('new_password', gen_salt('bf'))
WHERE username = 'friend';

-- View all activity
SELECT u.username, p.goal, p.bmi, COUNT(w.id) AS sessions
FROM users u
LEFT JOIN profiles p ON p.user_id = u.id
LEFT JOIN workout_logs w ON w.user_id = u.id
GROUP BY u.username, p.goal, p.bmi;

5 ยท First Login Flow

1. Visit https://forgefit.rakshitr.co.in/app/
2. Log in with your credentials
3. Profile setup screen appears (first login only):
   โ€ข Enter name, age, sex, height, weight, activity level
   โ€ข App shows BMI-based goal recommendations
   โ€ข Select your goal
   โ€ข Tap "START MY JOURNEY" โ†’ Puter sign-in popup appears
   โ€ข Sign in / create free Puter account
   โ€ข AI features are now active โ€” free forever
4. App loads with your personalised plan

6 ยท Install as Android PWA

1. Open https://forgefit.rakshitr.co.in/app/ in Chrome
2. Log in
3. Chrome shows "Add to Home Screen" banner โ†’ Install
   OR: โ‹ฎ Menu โ†’ Add to Home Screen โ†’ Install
4. App launches fullscreen โ€” no browser chrome

7 ยท Wear OS

Browser on Wear OS โ†’ https://forgefit.rakshitr.co.in/app/?watch=1

Shows: time, date, streak, water, steps, BMI, next alarm. Quick-tap: log workout โœ“ or log water ๐Ÿ’ง.


๐Ÿ“‚ Project Structure

forgefit/
โ”œโ”€โ”€ docker-compose.yml              # PostgreSQL + Node API + Nginx
โ”œโ”€โ”€ .env.example                    # Environment template (no API keys needed)
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ README.md
โ”‚
โ”œโ”€โ”€ frontend/public/
โ”‚   โ”œโ”€โ”€ index.html                  # Public landing / demo page (shown at /)
โ”‚   โ”œโ”€โ”€ manifest.json               # Root PWA manifest
โ”‚   โ”œโ”€โ”€ sw.js                       # Root service worker
โ”‚   โ””โ”€โ”€ app/
โ”‚       โ”œโ”€โ”€ index.html              # Full PWA app (shown at /app/)
โ”‚       โ”œโ”€โ”€ manifest.json           # App PWA manifest (start_url: /app/)
โ”‚       โ””โ”€โ”€ sw.js                   # App service worker
โ”‚
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ Dockerfile
โ”‚   โ”œโ”€โ”€ package.json                # No Anthropic โ€” uses Puter.js client-side
โ”‚   โ”œโ”€โ”€ db/schema.sql               # Full PostgreSQL schema + admin SQL commands
โ”‚   โ””โ”€โ”€ src/
โ”‚       โ”œโ”€โ”€ index.js                # Express server (auth, profile, logs, alarms only)
โ”‚       โ”œโ”€โ”€ db/pool.js              # PostgreSQL connection pool
โ”‚       โ”œโ”€โ”€ middleware/auth.js      # JWT middleware
โ”‚       โ””โ”€โ”€ routes/
โ”‚           โ”œโ”€โ”€ auth.js             # POST /api/auth/login, /api/auth/refresh
โ”‚           โ”œโ”€โ”€ profile.js          # GET/PUT /api/profile
โ”‚           โ”œโ”€โ”€ logs.js             # Metric, workout, daily goal logs + streak
โ”‚           โ””โ”€โ”€ alarms.js           # Full alarm CRUD
โ”‚
โ””โ”€โ”€ nginx/
    โ”œโ”€โ”€ nginx.conf                  # / โ†’ landing, /app/ โ†’ PWA, /api/ โ†’ Node
    โ””โ”€โ”€ certs/                      # SSL certs (not committed)

๐Ÿ”Œ API Reference

Method Endpoint Auth Description
POST /api/auth/login โ€” Login โ†’ JWT token
POST /api/auth/refresh โ€” Refresh JWT
GET /api/profile โœ“ Get user profile + BMI
PUT /api/profile โœ“ Create / update profile
POST /api/logs/metric โœ“ Log weight / BMI / body fat
GET /api/logs/metric โœ“ Get metric history
POST /api/logs/workout โœ“ Log a completed workout session
GET /api/logs/workout โœ“ Get workout history
GET /api/logs/streak โœ“ Get streak + total session count
GET /api/logs/daily โœ“ Get today's water / steps / workout
PATCH /api/logs/daily โœ“ Update today's goals
GET /api/alarms โœ“ List all user alarms
POST /api/alarms โœ“ Create an alarm
PATCH /api/alarms/:id โœ“ Toggle / update alarm
DELETE /api/alarms/:id โœ“ Delete an alarm

AI endpoints โ€” there are none. All AI calls go directly from the browser to Puter.js (puter.ai.chat), which proxies Claude Sonnet for free.


๐Ÿ—บ๏ธ Roadmap

  • Public landing / demo page at /
  • Private PWA app at /app/
  • JWT auth (admin SQL account creation)
  • BMI-based goal recommendations on onboarding
  • Puter.js sign-in during onboarding
  • Free Claude AI coach via Puter.js (zero API cost)
  • Health report image analysis (Puter vision)
  • PostgreSQL progress tracking with live charts
  • Goal-aware workout exercise lists
  • Samsung Health JSON import
  • Smart alarms with audio + notifications + snooze
  • PWA โ€” installable on Android
  • Wear OS optimised layout at ?watch=1
  • Desktop phone-shell + portfolio sidebar
  • Apple Health export support
  • Meal & calorie logging
  • Admin dashboard UI for managing users
  • Push notifications via Web Push API

๐Ÿ—บ๏ธ Legal & Liability Disclaimer

The software and code provided in this repository are provided "as is", without warranty of any kind, express or implied. The author is not responsible for any personal injury, health issues, or data loss resulting from the use of this application. Heart rate estimations and pedometer data are not intended for clinical or medical diagnostic use.
---

๐Ÿ‘ค Author

Rakshit Rangarajan

LinkedIn Email Portfolio


Forge your body. Every rep counts. ๐Ÿ”ฅ

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors