Calmind is a full-stack AI-powered mental wellness platform that helps users manage their emotional health through conversational therapy, mood tracking, and activity-based insights. The system combines real-time AI interaction with structured user data to provide personalized recommendations and continuous mental health support.
Unlike basic chatbots, Calmind maintains conversational context across sessions and uses historical user dataβmood trends, activity logs, and chat historyβto influence future AI responses, creating a truly personalized and evolving support system.
Current mental health solutions face three critical gaps:
- Accessibility: Traditional therapy is expensive and not always available
- Personalization: Most digital apps provide generic content without adapting to individual users
- Fragmentation: No system connects mood, activities, and conversations into a unified experience
| Feature | Description |
|---|---|
| π€ AI Therapy Chat | Session-based conversations with context-aware responses |
| π Mood Tracking | Log emotional state with scores (0-100) and notes |
| π Activity Logging | Track meditation, exercise, journaling, and more |
| π― Personalized Recommendations | AI-driven suggestions based on user behavior |
| π Session History | Complete conversation and data history |
| π Secure Authentication | JWT + session-based auth with expiry |
- Next.js 15 (App Router) - React framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- React Context - State management
- Node.js - Runtime
- Express - API framework
- MongoDB + Mongoose - Database & ODM
- JWT + bcrypt - Authentication
- Inngest - Async job processing
- OpenAI API / LangChain - LLM integration
- Vercel - Frontend deployment
- Render / VPS - Backend hosting
- MongoDB Atlas - Cloud database
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client (Browser) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Next.js Frontend (Vercel) β
β Pages β Components β API Layer β State β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
REST API
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Express Backend (Node.js) β
β Routes β Middleware β Controllers β Services β Models β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MongoDB Atlas β
β User | Session | ChatSession | Mood | Activity | Recs β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
User sends message
β
React Component captures input
β
API Layer sends POST request
β
Auth Middleware verifies JWT
β
Controller extracts message & session
β
AI Service calls LLM (with history)
β
Response + metadata stored in ChatSession
β
Response returned to frontend
β
UI updates with AI response
// Core models centered around User
User {
name, email, password (hashed)
}
Session {
userId, token, expiresAt (TTL), lastActive, deviceInfo
}
ChatSession {
sessionId, userId, messages[], status, startTime
// messages: { role, content, timestamp, metadata }
// metadata: { emotionalState, riskLevel, currentGoal }
}
Mood {
userId, score (0-100), note, context, timestamp
}
Activity {
userId, type, name, duration, timestamp
}
Recommendation {
userId, items[]
}| Method | Endpoint | Description |
|---|---|---|
POST |
/api/auth/register |
User registration |
POST |
/api/auth/login |
User login (returns JWT) |
GET |
/api/auth/me |
Get current user |
POST |
/api/chat/sessions |
Create chat session |
POST |
/api/chat/sessions/:id/messages |
Send message |
GET |
/api/chat/sessions/:id/history |
Get session history |
POST |
/api/mood |
Log mood |
GET |
/api/mood |
Get mood history |
POST |
/api/activity |
Log activity |
GET |
/api/activity |
Get activity history |
- Node.js 20+
- MongoDB (local or Atlas)
- OpenAI API key
# Clone repository
git clone https://github.com/yourusername/calmind.git
cd calmind
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.local
# Configure .env.local
MONGODB_URI=your_mongodb_uri
JWT_SECRET=your_jwt_secret
OPENAI_API_KEY=your_openai_key
# Run development server
npm run dev# Database
MONGODB_URI=mongodb://localhost:27017/calmind
# Authentication
JWT_SECRET=your_super_secret_key
JWT_EXPIRES_IN=7d
# AI Services
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4-turbo
# App
NEXT_PUBLIC_API_URL=http://localhost:3000/api| Decision | Why |
|---|---|
| Session-based chat | Maintains context across messages for meaningful responses |
| Hybrid auth (JWT + DB sessions) | JWT for scalability, DB for control & revocation |
| MongoDB | Flexible schema for evolving AI metadata |
| Service layer | Separates AI/recommendation logic from controllers |
| Async AI processing | Prevents blocking main request cycle |
- β JWT-based authentication with database sessions
- β bcrypt password hashing
- β Input validation & sanitization
- β Protected routes with auth middleware
- β Session expiry via TTL indexes
- β Data isolation (userId-scoped queries)
| Component | Platform |
|---|---|
| Frontend (Next.js) | Vercel |
| Backend (Node.js) | Render / VPS |
| Database | MongoDB Atlas |
| CI/CD | GitHub + Auto-deploy |
- Real-time chat using WebSockets
- Enhanced emotion detection (NLP sentiment analysis)
- Mobile application (React Native)
- Advanced analytics dashboard
- Redis caching layer
- Microservices architecture
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing) - Open a Pull Request
MIT Β© Calmind
Project Link: https://github.com/tanishxdev/calmind
Built with β€οΈ for mental wellness accessibility