An intelligent life-planning companion that helps users simulate and analyze major life decisions using AI-powered analytics and feeling tracking.
Prototype: http://172.188.112.47/
- Overview
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Installation
- Running the Application
- Environment Configuration
- API Endpoints
- Database Schema
- Deployment
- Troubleshooting
- Contributing
LifePath AI is a full-stack web application that empowers users to make informed life decisions by:
- Creating personalized profiles with life context
- Simulating multiple decision scenarios with AI analysis
- Tracking emotional responses and feelings over time
- Visualizing decision outcomes and patterns
- Revisiting and comparing past decisions
Perfect for career transitions, education choices, relationship decisions, and major life changes.
- User Authentication - Secure JWT-based auth with email verification
- Profile Management - Multi-step profile setup (About You, Current Life, Skills)
- Decision Simulation - Two-step decision entry with AI-powered simulation results
- Feeling Tracker - Log emotional check-ins after decisions
- Decision History - View, compare, and delete past simulations
- Interactive Dashboard - Visualize decision outcomes with Recharts
- Real-time data persistence with PostgreSQL
- Responsive React UI with Vite
- Secure API with CORS and JWT middleware
- Email verification via SMTP (Gmail support)
- Production-ready deployment with PM2
- Node.js (v20+) - JavaScript runtime
- Express.js - REST API framework
- PostgreSQL - Relational database (Azure PostgreSQL)
- JWT (jsonwebtoken) - Authentication & authorization
- Bcryptjs - Password hashing
- Nodemailer - Email notifications
- PM2 - Process management & monitoring
- React (v18) - UI library
- Vite - Lightning-fast build tool
- Recharts - Data visualization
- Modern CSS - Responsive design
lifepath-v2/
βββ backend/ # Node.js + Express backend
β βββ src/
β β βββ index.js # Express app entry point
β β βββ db.js # PostgreSQL setup & initialization
β β βββ middleware/
β β β βββ auth.js # JWT authentication middleware
β β βββ routes/
β β β βββ auth.js # Auth endpoints (signup, login, verify)
β β β βββ profile.js # Profile CRUD endpoints
β β β βββ decisions.js # Decision simulation & history
β β β βββ feelings.js # Feeling check-in tracking
β β βββ utils/
β β βββ email.js # Email sending logic
β βββ package.json
β βββ .env # Environment variables (don't commit)
β
βββ frontend/ # React + Vite frontend
β βββ src/
β β βββ App.jsx # Main app component
β β βββ pages/ # Page components
β β βββ components/ # Reusable UI components
β β βββ api/ # API client utilities
β βββ index.html
β βββ vite.config.js
β βββ package.json
β
βββ ecosystem.config.js # PM2 configuration for production
βββ start.sh # Quick start script (Mac/Linux)
βββ start.bat # Quick start script (Windows)
βββ HOW-TO-RUN.md # Quick start guide
βββ SETUP.md # Detailed deployment guide
βββ README.md # This file
Before you begin, ensure you have:
- Node.js v20.0.0 or higher (Download)
- npm v9.0.0 or higher (comes with Node.js)
- PostgreSQL database (local or cloud-hosted like Azure PostgreSQL)
- Git (optional, for cloning)
- Gmail account with 2-Step Verification enabled
- Gmail App Password (generated from Security settings)
start.batchmod +x start.sh
./start.shThis script will:
- Install all dependencies
- Start the backend on port 5000
- Start the frontend on port 3000
Then open: http://localhost:3000
cd backend
npm installCreate/update .env file:
# PostgreSQL Connection
DB_HOST=localhost
DB_PORT=5432
DB_NAME=lifepath
DB_USER=postgres
DB_PASSWORD=your_password
DB_SSL=false
# JWT Configuration
JWT_SECRET=your_super_secret_key_minimum_32_characters_long
JWT_EXPIRES_IN=7d
# Email Configuration (Gmail)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your@gmail.com
SMTP_PASS=your_16_char_app_password
EMAIL_FROM=LifePath AI <your@gmail.com>
# Server Configuration
PORT=5000
FRONTEND_URL=http://localhost:3000
NODE_ENV=developmentStart the backend:
npm run dev # Development with auto-reload
# OR
node src/index.js # ProductionYou should see:
β
Database tables ready
π LifePath AI backend running on port 5000
In a new terminal:
cd frontend
npm install
npm run devOpen your browser to: http://localhost:3000
Terminal 1 (Backend):
cd backend
npm run devTerminal 2 (Frontend):
cd frontend
npm run dev# Install PM2 globally
npm install -g pm2
# Start both services
pm2 start ecosystem.config.js
# Save configuration
pm2 save
pm2 startupMonitor:
pm2 status
pm2 logs lifepath-backend
pm2 logs lifepath-frontend| Variable | Description | Example |
|---|---|---|
DB_HOST |
Database hostname | localhost or myserver.postgres.database.azure.com |
DB_PORT |
Database port | 5432 |
DB_NAME |
Database name | lifepath |
DB_USER |
Database user | postgres |
DB_PASSWORD |
Database password | your_secret_password |
DB_SSL |
Use SSL connection | true (Azure) or false (local) |
JWT_SECRET |
Secret key for JWT signing | min 32 characters random string |
JWT_EXPIRES_IN |
JWT expiration time | 7d |
SMTP_HOST |
Email server host | smtp.gmail.com |
SMTP_PORT |
Email server port | 587 |
SMTP_USER |
Email sender address | your@gmail.com |
SMTP_PASS |
Email app password | 16-character Gmail app password |
EMAIL_FROM |
From address for emails | LifePath AI <your@gmail.com> |
PORT |
Backend server port | 5000 |
FRONTEND_URL |
Frontend URL for CORS | http://localhost:3000 |
NODE_ENV |
Environment mode | development or production |
- Go to myaccount.google.com
- Security β 2-Step Verification (must be enabled)
- App Passwords β Select app: Mail, device: Windows/Mac/Linux
- Google generates a 16-character password β Copy and paste into
SMTP_PASS
| Method | Route | Auth | Description |
|---|---|---|---|
| POST | /api/auth/signup |
β | Create new account |
| POST | /api/auth/login |
β | Login β returns JWT token |
| GET | /api/auth/verify?token=... |
β | Verify email (via link) |
| POST | /api/auth/resend-verification |
β | Resend verification email |
| GET | /api/auth/me |
β | Get current authenticated user |
| Method | Route | Auth | Description |
|---|---|---|---|
| GET | /api/profile |
β | Get user's saved profile |
| POST | /api/profile |
β | Create/update profile |
| Method | Route | Auth | Description |
|---|---|---|---|
| GET | /api/decisions |
β | Get all user's decisions |
| POST | /api/decisions |
β | Create new decision with simulation |
| DELETE | /api/decisions/:id |
β | Delete a decision |
| Method | Route | Auth | Description |
|---|---|---|---|
| GET | /api/feelings |
β | Get all feeling check-ins |
| POST | /api/feelings |
β | Save new feeling check-in |
| Method | Route | Auth | Description |
|---|---|---|---|
| GET | /health |
β | Backend health check |
users
id (UUID) | email | password_hash | verified (bool) | created_atprofiles
id (UUID) | user_id | about_you | current_life | skills | updated_atdecisions
id (UUID) | user_id | title | description | outcome | created_atfeelings
id (UUID) | user_id | mood (1-10) | notes | created_atAll tables are auto-created on first backend startup.
See SETUP.md for detailed Azure deployment instructions, including:
- Provisioning Azure PostgreSQL
- Setting up Azure VM
- Configuring environment variables
- Using PM2 for process management
- Optional: Setting up Nginx reverse proxy on port 80
- Provision Azure PostgreSQL & VM
- SSH into VM and install Node.js 20
- Upload project files
- Configure
.envwith Azure database credentials - Run:
pm2 start ecosystem.config.js - Save PM2 config:
pm2 save && pm2 startup - Access via:
http://YOUR_VM_IP:3000orhttp://YOUR_VM_IP(with Nginx)
Problem: Frontend connects to backend but fails
Solution: Make sure backend is running first
# Terminal 1: Start backend FIRST
cd backend && node src/index.js
# Terminal 2: Only then start frontend
cd frontend && npm run devProblem: password authentication failed or database does not exist
Solution:
- Verify credentials in
.envmatch your database - Create the database if it doesn't exist:
CREATE DATABASE lifepath;
- For Azure: Add your VM's IP to PostgreSQL firewall
- Ensure
DB_SSL=truefor Azure PostgreSQL
Problem: Verification emails don't arrive
Causes & Fixes:
- Are you using Gmail? Must generate App Password (not regular password)
- Check logs:
pm2 logs lifepath-backend | grep SMTP - In dev mode, emails are logged but not actually sent
- For testing:
NODE_ENV=developmentauto-verifies users
Problem: /api/ calls fail in production
Solution:
- Dev mode: Vite proxy automatically forwards
/apiβlocalhost:5000 - Production: Use Nginx (see SETUP.md Step 7) or ensure CORS is configured correctly
- Check:
FRONTEND_URLin.envmust match actual frontend URL
Problem: Port 3000 or 5000 is already taken
Solution:
# Kill process on port 5000 (Linux/Mac)
lsof -ti:5000 | xargs kill -9
# Or change the port in .env
PORT=5001Problem: npm run build fails
Solution:
rm -rf node_modules package-lock.json
npm install
npm run buildWe welcome contributions! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow existing code style
- Test locally before submitting PR
- Update documentation if needed
- Use meaningful commit messages
This project is licensed under the MIT License. See the LICENSE file for details.
- Check HOW-TO-RUN.md for quick fixes
- See SETUP.md for deployment details
- Open an issue on GitHub for bugs
- Include error messages and environment info in issues
- AI decision recommendations using ML models
- Social features (share decisions, get feedback)
- Mobile app (React Native)
- Advanced analytics & reporting
- Integration with calendar & task managers
- Dark mode UI theme
LifePath AI - Built with β€οΈ for better life decisions
Special thanks to:
- Azure & Microsoft for cloud services
- React, Node.js, and PostgreSQL communities
Last Updated: March 2025
Version: 2.0.0