Skip to content

Chintucode/life-os

Repository files navigation

Life OS

A personal operating system built as a full-stack PWA — habit tracking, journaling, finance, health logging, and AI-powered monthly coaching in a single self-hosted app.

Stack: Java 17 · Spring Boot 3.5 · MySQL 8 · Vanilla JS · PWA


Screenshots


Login
Clean sign-in screen with orb branding. Supports username/password and optional Firebase Google login.

Dashboard
Daily greeting, Aura orb, quick-log bar (Expense · Habit · Mood · Intention), and today's summary.

Habits
Weekly habit grid, perfect-day streak, show-up streak, and today/week completion rings.

Aura
Animated gradient orb driven by Discipline · Mindfulness · Intent scores. Week/Month/Year range views.

Treasury
Wallet with income, budget, and savings target. Available capital, daily spend, and debt tracking.

Settings
Account, appearance, reflections schedule, lock screen, AI usage, and full data export.

Features

Daily Tracking

  • Habits — Weekly grid (Sun–Sat), cross-week streaks, perfect-day scoring, retroactive regenerate (max 3/month), durable completion log
  • Journal — Full-text entries with mood (1–5), image galleries, voice-to-text cleanup via Gemini AI
  • Reflections — Morning intention + evening verdict, push-notification scheduler, 30-day stats
  • Lines — Anti-goals ("No phone in bed"), daily kept/broke log, per-line streaks

Finance

  • Wallet — Income / monthly budget / savings target
  • Expenses — Auto-category detection (food, transport, housing, clothes, electronics, health)
  • Debts — Payable & Receivable ledger with EMI, interest rate, due date; AI natural-language parser
  • Budget categories — Percentage allocation with lock flag

Health Pillars

  • Workouts — Sets, reps, kcal, scheduled days, completion toggle
  • Food log — 1 000+ item Indian food DB with portion multipliers, kcal tracking
  • Junk log — Indulgence tracker with kcal debt and recovery time
  • Supplements — Dose, timing (AM / PM / Pre-Workout), scheduled days
  • Care products — Skin & hair routine checklists with daily completion

Aura (Performance Score)

  • Three pillars: Discipline (habits) · Mindfulness (journals) · Intent (budget vs spend)
  • Composite 0–100 score with five vibes: Radiant · Focused · Steady · Drifting · Quiet
  • Animated gradient orb that reacts to your score
  • 365-day history synced to server; weekly AI-generated insights

Monthly Coach

  • Wrapped page — Spotify-style month-in-review (#/wrapped?m=YYYY-MM)
  • Coach letter — AI-written monthly reflection letter stored in DB; warm, dignified, grounded in real numbers
  • Q&A thread — Follow-up conversation with the coach about your month
  • Email card — Sends via Resend (optional); HTML email with orb gradient, stats table, deep link

90-Day Reset

  • Three phases: Foundation → Build → Compound
  • Six pillars: sleep, body, focus, morning, emotions, purpose
  • Auto-generated 13-week habit plan from curated library
  • Per-week habit customisation; weekly scores tracked in MySQL

Infrastructure

  • JWT stateless auth (10-hour tokens, BCrypt passwords)
  • Firebase Google login with auto email-linking
  • Rate limiting on auth endpoints (10 req / 60 s / IP)
  • Web Push notifications (VAPID-signed, per-device subscriptions)
  • Cloud sync for aura history, lines, reflections, body stats (debounced 1.5 s flush)
  • Command palette (⌘K), pull-to-refresh, haptic feedback, offline banner
  • Service worker PWA — installable on iOS & Android (cache v45)

Tech Stack

Layer Technology
Language Java 17
Framework Spring Boot 3.5.11
ORM Spring Data JPA / Hibernate
Database MySQL 8
Security Spring Security + JJWT 0.11.5
AI Google Gemini 2.5 Flash
Push web-push 5.1.1 + BouncyCastle 1.78.1
Email Resend (optional)
Auth (optional) Firebase Admin SDK 9.2.0
Scraping JSoup 1.17.2
Docs SpringDoc OpenAPI 2.8.15
Frontend Vanilla JS (ES6 modules), no framework
PWA Service Worker, Web Push API, Web Vibration API

Prerequisites

  • Java 17+
  • Maven 3.9+ (or use the included ./mvnw)
  • MySQL 8 running locally (or remote)

Quick Start

1. Clone

git clone https://github.com/YOUR_USERNAME/life-os.git
cd life-os

2. Create the database

CREATE DATABASE life_os_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

3. Set environment variables

Copy and fill in your values:

export DB_URL=jdbc:mysql://localhost:3306/life_os_db
export DB_USERNAME=root
export DB_PASSWORD=your_mysql_password
export JWT_SECRET=a-random-string-at-least-32-characters-long
export GEMINI_API_KEY=AIza...          # optional — AI features degrade gracefully if unset

Optional — Web Push notifications:

# Generate a VAPID keypair: npx web-push generate-vapid-keys
export VAPID_PUBLIC_KEY=...
export VAPID_PRIVATE_KEY=...
export VAPID_SUBJECT=mailto:you@example.com

Optional — Monthly Aura card email:

export RESEND_API_KEY=re_...
export MAIL_FROM="Life OS <you@yourdomain.com>"
export APP_URL=https://your-app-url.com

Optional — Firebase Google login:

export FIREBASE_SERVICE_ACCOUNT_JSON='{"type":"service_account",...}'
# or place firebase-service-account.json in src/main/resources/ (it is gitignored)

4. Run

./mvnw spring-boot:run

Open http://localhost:8080 — tables are created automatically on first run (ddl-auto: update).


Environment Variables Reference

Variable Required Default Description
DB_URL Yes jdbc:mysql://localhost:3306/life_os_db MySQL JDBC URL
DB_USERNAME Yes root MySQL username
DB_PASSWORD Yes (none) MySQL password
JWT_SECRET Prod (ephemeral — tokens reset on restart) JWT signing secret (32+ chars)
GEMINI_API_KEY No (none) Gemini 2.5 Flash API key
CORS_ALLOWED_ORIGINS No http://localhost:8080,... Comma-separated allowed origins
VAPID_PUBLIC_KEY No (none) Web Push VAPID public key
VAPID_PRIVATE_KEY No (none) Web Push VAPID private key
VAPID_SUBJECT No mailto:lifeos@local Web Push contact
RESEND_API_KEY No (none) Resend email API key
MAIL_FROM No Life OS <onboarding@resend.dev> Sender address
APP_URL No http://localhost:8080 Base URL for email deep links
FIREBASE_SERVICE_ACCOUNT_JSON No (none) Firebase credentials JSON string
GOOGLE_APPLICATION_CREDENTIALS No (none) Path to Firebase credentials file

API Overview

All endpoints (except /api/auth/**) require Authorization: Bearer <token>.

Controller Base Path Key Endpoints
Auth /api/auth POST /register · POST /login · POST /firebase-login
Habits /api/habits CRUD · /toggleDay · /regenerate · /streaks
Journal /api/journals CRUD
Expenses /api/expenses CRUD
Wallet /api/wallet GET / · POST /
Pillars /api workouts · foods · junk · supplements
Products /api/products CRUD · PUT /{id}/toggle
AI /api/ai aura · insight · polish · parse-debt · month-recap
Monthly Card /api/month-card stats · send-test · preview
Coach /api/coach letter · reanalyze · ask
Push /api/push subscribe · prefs · test
Blobs /api/blobs GET all · PUT /{key}
Dashboard /api/dashboard year-progress · heatmap
Reset /api/reset GET · PUT
Scraper /api/scrape POST /

Swagger UI available at http://localhost:8080/swagger-ui.html.


Project Structure

life-os/
├── src/
│   ├── main/
│   │   ├── java/com/rahul/lifeos/
│   │   │   ├── config/          # SecurityConfig, FirebaseConfig
│   │   │   ├── security/        # JwtUtil, JwtFilter, RateLimitFilter
│   │   │   ├── controllers/     # 14 REST controllers
│   │   │   ├── services/        # GeminiService, MonthlyCardService, CoachService,
│   │   │   │                    #   FirebaseService, PushService, NudgeScheduler, ScrapperServices
│   │   │   ├── models/          # 18 JPA entities
│   │   │   └── repositories/    # Spring Data JPA interfaces
│   │   └── resources/
│   │       ├── application.properties
│   │       └── static/          # Vanilla JS PWA
│   │           ├── index.html
│   │           ├── styles.css · mobile.css
│   │           ├── manifest.json · sw.js
│   │           └── src/
│   │               ├── main.js
│   │               ├── lib/     # auth, store, cloudSync, orb, router, score, …
│   │               ├── components/  # layout, commandPalette, bottomSheet, promptModal, …
│   │               └── pages/   # dashboard, habits, journal, aura, treasury, wrapped, …
│   └── test/
├── pom.xml
├── mvnw · mvnw.cmd
└── .env.example

Data & Privacy

  • All data is stored in your own MySQL database — nothing goes to third-party servers unless you configure optional integrations (Gemini, Resend, Firebase)
  • Gemini API calls are made server-side (your key, your quota)
  • Passwords are hashed with BCrypt; JWT tokens never store sensitive data
  • Web Push subscriptions are per-device and can be revoked from Settings

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors