Your AI‑powered mental health companion
Check in. Get support. Feel better.
- Features
- Tech Stack
- Monorepo Structure
- Prerequisites
- Quick Start
- Environment Variables
- Run Locally
- Build & Deploy
- API Endpoints (Summary)
- Security & Privacy
- Troubleshooting
- Contributing
- License
- Daily Mood Check‑in with optional journaling
- Personalized Wellness Plan (mindfulness, movement, affirmations)
- 24/7 Crisis Support (hotlines, text lines, grounding & breathing exercises)
- Community Hub with anonymous posting and themed groups
- Curated Resources (articles, podcasts, videos with summaries)
- Privacy by Design: encryption, anonymous mode, data export/delete
Frontend
- React + Vite (or CRA) and Tailwind CSS
- React Router
Backend
- Node.js + Express
- JSON Web Tokens (JWT) for auth
- MongoDB (Mongoose) for data
AI/Personalization
- Lightweight rules + optional LLM prompts for activity suggestions
Infra
- Vercel (frontend)
- Render/Heroku/Fly.io (backend)
- MongoDB Atlas (database)
- GitHub (CI/CD)
lifeline/
├─ client/ # React + Tailwind UI
│ ├─ src/
│ ├─ index.html
│ ├─ vite.config.ts
│ └─ package.json
├─ server/ # Node/Express API
│ ├─ src/
│ │ ├─ index.ts # app bootstrap
│ │ ├─ routes/
│ │ ├─ controllers/
│ │ ├─ models/
│ │ └─ middleware/
│ └─ package.json
├─ .env.example # root env template (optional)
└─ README.md
- Node.js 18+ and npm 9+ (or pnpm/yarn)
- MongoDB Atlas account (or local MongoDB)
- (Optional) Vercel account for hosting the client
- (Optional) Render/Heroku/Fly.io for hosting the server
Verify versions:
node -vandnpm -v
# 1) Clone
git clone https://github.com/<your-username>/lifeline.git
cd lifeline
# 2) Install deps
cd client && npm i && cd ..
cd server && npm i && cd ..
# 3) Copy envs from templates
cp client/.env.example client/.env
cp server/.env.example server/.env
# 4) Run dev (two terminals)
npm run dev -w client
npm run dev -w serverCreate .env files in client/ and server/.
client/.env (Vite)
VITE_API_BASE_URL=https://localhost:5001
VITE_APP_NAME=LifeLine
VITE_ENABLE_ANON_MODE=true
server/.env
PORT=5001
NODE_ENV=development
MONGODB_URI=mongodb+srv://<user>:<pass>@cluster0.xxxxx.mongodb.net/lifeline
JWT_SECRET=change_me_to_a_long_random_string
CORS_ORIGIN=http://localhost:5173
# Optional provider keys (if you enable LLM prompts)
OPENAI_API_KEY=
COHERE_API_KEY=
Tip: Never commit real
.envfiles. Keep.env.examplewith placeholders.
cd client
npm run dev # starts Vite dev server (default http://localhost:5173)
npm run build # production build
npm run preview # preview production build locallycd server
npm run dev # starts nodemon on http://localhost:5001
npm run start # start without nodemon
npm run lint # lint server codecurl http://localhost:5001/health
# => { "ok": true }- Push the repo to GitHub.
- Import the client/ folder in Vercel → Project Settings → Root Directory = client.
- Environment → add
VITE_API_BASE_URLpointing to your deployed server. - Deploy. Vercel will auto-detect Vite/React and build.
- Create a new Web Service from your GitHub repo.
- Root directory:
server - Build command:
npm install && npm run build - Start command:
npm run start - Add env vars from
server/.env(especiallyMONGODB_URI,JWT_SECRET). - After deploy, copy the public URL and set
VITE_API_BASE_URLin Vercel to this URL.
- Create a Cluster → Database Access → add database user
- Network Access → allow your server’s IP or
0.0.0.0/0(dev only) - Get connection string and place in
MONGODB_URI.
GET /health # service health
POST /auth/register
POST /auth/login
# Mood & Journal
GET /mood # list entries (auth)
POST /mood # create entry {rating, note}
# Wellness Plan
GET /plan/today # personalized activities
POST /plan/complete/:activityId # mark done
# Community (anonymous supported)
GET /community/groups
GET /community/posts?groupId=...
POST /community/posts # {groupId, text}
# Resources
GET /resources # curated list w/ types & ratings
Routes are illustrative; adjust to your implementation.
- All user data encrypted at rest (database) and in transit (HTTPS)
- JWTs scoped & short‑lived; refresh flow recommended
- Anonymous Mode: strip identifiers from community posts
- Data Portability: export & delete my data endpoints
- Role‑based access for future therapist/coach features
Important: Include crisis disclaimers and provide 24/7 hotlines. This app does not replace professional care.
- CORS errors: ensure
CORS_ORIGINmatches your client URL - Mongo connection fails: check IP allow‑list and credentials
- 401/403: missing/expired JWT; log in again
- Vercel 404 on refresh: enable SPA fallback or set
vercel.jsonrewrites - Render cold starts: consider Pro plan or keep‑alive pings
- Fork the repo & create a feature branch
- Write clear commit messages
- Add/update tests where feasible
- Open a PR with screenshots and a short demo
MIT ©