A modern, privacy-first mental wellness companion that helps you take meaningful steps toward better mental health.
MindMate is a comprehensive mental wellness platform designed with simplicity, privacy, and accessibility at its core. Built using modern web technologies, it provides users with practical tools for stress management, emotional awareness, and personal reflection without the friction of complex interfaces.
๐ Live Demo: mindmate.aniruddha.fyi
- ๐ฏ Advanced Mood Tracking - Comprehensive mood logging with:
- Visual trend charts with customizable time periods (7, 30, 90 days)
- Mood streak tracking and statistics
- Mood score analytics (1-10 scale)
- Recent entries overview with emoji indicators
- ๐ง Interactive Breathing Exercises - Guided breathing animation with:
- 4-4-6-2 breathing pattern (inhale-hold-exhale-hold)
- Visual circle animation for breathing guidance
- Start/stop controls with smooth transitions
- ๐ Complete Journaling System - Feature-rich journaling with:
- Rich text entries with title and content
- Daily writing prompts for inspiration
- Full CRUD operations (Create, Read, Update, Delete)
- Entry editing with confirmation modals
- ๐ค Advanced AI Chat Integration - Powered by Google's Gemini AI:
- Multi-session chat management
- Session title editing and organization
- Context-aware mental wellness responses
- Crisis detection and professional help redirection
- Credit-based usage system
- ๐ฅ Admin Dashboard - Comprehensive user management:
- User listing with pagination
- Credit management and role assignment
- Blacklisting capabilities for moderation
- Real-time user statistics
- ๐ JWT Authentication - Secure token-based authentication system
- ๐ก๏ธ Middleware Protection - Route-level security for API endpoints
- ๐ Data Visualization - Chart.js integration for mood analytics
- โก Real-time Updates - Dynamic UI updates without page refreshes
- ๐จ Modern UI/UX - Tailwind CSS with gradient backgrounds and animations
- ๐ฑ Mobile-First Design - Responsive layout with mobile-optimized components
- ๐ง Modular Architecture - Clean separation of components and API logic
- Framework: Next.js 14+ (App Router)
- Runtime: React 18+
- Styling: Tailwind CSS + PostCSS
- Language: JavaScript (with JSX)
- Authentication: JWT with jose library
- Database: MongoDB (via connection models)
- AI Integration: Google Gemini API (@google/generative-ai)
- Charts: Chart.js for data visualization
- Notifications: react-hot-toast for user feedback
- Linting: ESLint with custom configurations
- Package Manager: npm / pnpm / yarn / bun
- Google Gemini AI - Advanced conversational AI for mental health support
- Chart.js - Interactive mood tracking visualizations
- JWT Authentication - Secure user sessions and API protection
- MongoDB - Persistent data storage for users, moods, and journal entries
- Node.js 18+ (LTS recommended)
- Package manager of choice (npm, pnpm, yarn, or bun)
- Git for version control
# Clone the repository
git clone https://github.com/aniruddhabagal/MindMate.git
cd MindMate
# Install dependencies (choose one)
npm install
# or
pnpm install
# or
yarn install
# or
bun install
# Start the development server
npm run dev
# or
pnpm dev
# or
yarn dev
# or
bun devOpen http://localhost:3000 in your browser to see the application.
Create a .env.local file in the project root:
# Basic Configuration
NEXT_PUBLIC_SITE_URL=http://localhost:3000
NEXT_PUBLIC_APP_NAME=MindMate
# JWT Configuration (Required)
JWT_SECRET=your-super-secure-jwt-secret-key-here
# MongoDB Configuration (Required)
MONGODB_URI=mongodb://localhost:27017/mindmate
# or for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/mindmate
# Google Gemini AI Configuration (Required for Chat)
GEMINI_API_KEY=your-google-gemini-api-key-here
# Optional: Additional Configuration
NODE_ENV=developmentSecurity Notes:
- Never commit
.env*files to version control- Use strong, unique JWT secrets in production
- Store sensitive API keys securely
MindMate/
โโโ app/ # Next.js App Router (pages, layouts, API routes)
โ โโโ admin/ # Admin dashboard page
โ โ โโโ page.js # User management interface
โ โโโ api/ # API routes
โ โ โโโ admin/ # Admin-only endpoints
โ โ โโโ auth/ # Authentication endpoints
โ โ โโโ chat/ # AI chat functionality
โ โ โโโ journal/ # Journal CRUD operations
โ โ โโโ moods/ # Mood tracking endpoints
โ โโโ globals.css # Global styles and animations
โ โโโ layout.js # Root layout component
โ โโโ page.js # Main application page
โโโ components/ # Reusable UI components
โ โโโ BreathingModal.js # Interactive breathing exercise component
โ โโโ ChatPage.js # Multi-session chat interface
โ โโโ ConfirmationModal.js # Reusable confirmation dialog
โ โโโ Header.js # Application header with user menu
โ โโโ HomePage.js # Dashboard with quick actions
โ โโโ JournalPage.js # Full-featured journaling interface
โ โโโ Loader.js # Loading spinner component
โ โโโ MoodTrackerPage.js # Analytics and mood visualization
โโโ lib/ # Utility functions and configurations
โ โโโ apiClient.js # API communication functions
โ โโโ formatters.js # Date, mood, and data formatting
โ โโโ geminiClient.js # Google Gemini AI configuration
โ โโโ mongodb.js # Database connection setup
โโโ models/ # MongoDB data schemas
โ โโโ User.js # User account model
โ โโโ Mood.js # Mood entry model
โ โโโ Journal.js # Journal entry model
โ โโโ ChatSession.js # Chat session model
โโโ public/ # Static assets
โ โโโ images/ # Image assets
โ โโโ favicon.ico # Application icon
โโโ middleware.js # JWT authentication middleware
โโโ next.config.mjs # Next.js configuration
โโโ tailwind.config.js # Tailwind CSS configuration
โโโ postcss.config.js # PostCSS configuration
โโโ eslint.config.mjs # ESLint configuration
โโโ package.json # Dependencies and scripts
โโโ README.md # This file
app/- Next.js App Router with single-page application structureapp/api/- RESTful API endpoints with JWT authentication middlewarecomponents/- Feature-complete UI components (Chat, Journal, Mood Tracker, etc.)lib/- Core utilities including API client, AI integration, and data formattingmodels/- MongoDB schemas for Users, Moods, Journal entries, and Chat sessionsmiddleware.js- JWT verification and role-based access control
| Script | Description |
|---|---|
npm run dev |
Start development server on http://localhost:3000 |
npm run build |
Build the application for production |
npm run start |
Start the production server |
npm run lint |
Run ESLint to check code quality |
npm run lint:fix |
Run ESLint and automatically fix issues |
npm run type-check |
Run TypeScript compiler to check types |
- Components: Functional components with hooks-based state management
- Styling: Utility-first approach with Tailwind CSS classes
- State Management: React state with useCallback/useMemo for optimization
- API Design: RESTful endpoints with consistent error handling
- Authentication: JWT-based with middleware protection
- Database: MongoDB with proper schema validation
// Example component structure
"use client"; // For client-side components
import { useState, useEffect, useCallback } from "react";
import toast from "react-hot-toast";
export default function Component({ currentUser, apiClient, ...props }) {
const [state, setState] = useState(initialValue);
const [isLoading, setIsLoading] = useState(false);
const handleAction = useCallback(async () => {
setIsLoading(true);
try {
// API call logic
const result = await apiClient.someAPI();
// Update state
setState(result);
toast.success("Action completed!");
} catch (error) {
console.error("Error:", error);
toast.error(`Error: ${error.message}`);
} finally {
setIsLoading(false);
}
}, [apiClient]);
// Component JSX with proper loading states and error handling
return (
<div className="component-wrapper">
{/* Component content */}
</div>
);
}// app/api/example/route.js
import { NextResponse } from "next/server";
import { connectDB } from "@/lib/mongodb";
import Model from "@/models/Model";
export async function GET(request) {
try {
const userId = request.headers.get("x-user-id"); // Set by middleware
await connectDB();
const data = await Model.find({ userId });
return NextResponse.json(data);
} catch (error) {
console.error("API Error:", error);
return NextResponse.json(
{ message: "Internal server error" },
{ status: 500 }
);
}
}- User Profile Management - Complete profile editing and preferences
- Data Export - Export mood and journal data in various formats
- Advanced Analytics - Weekly/monthly mood reports and insights
- Reminder System - Customizable notifications for check-ins
- Goal Setting - Personal wellness goals with progress tracking
- Community Features - Anonymous peer support groups (optional)
- Integration APIs - Connect with fitness trackers and health apps
- Offline Support - Progressive Web App capabilities
- Multi-language Support - Internationalization (i18n)
- Advanced AI Features - Personalized recommendations and insights
- TypeScript Migration - Gradual conversion to TypeScript
- Enhanced Testing - Unit and integration test coverage
- Performance Monitoring - Real-time performance metrics
- Advanced Security - Rate limiting and enhanced data protection
- CI/CD Pipeline - Automated testing and deployment
- Docker Support - Containerized deployment options
- Database Optimization - Indexing and query optimization
- API Documentation - OpenAPI/Swagger documentation
We welcome contributions from the community! Here's how you can help:
- Fork the repository
- Clone your fork locally
- Create a feature branch (
git checkout -b feature/amazing-feature) - Install dependencies and run the development server
- Make your changes following our coding standards
- Test your changes thoroughly
- Commit using conventional commit format
- Push to your branch (
git push origin feature/amazing-feature) - Open a Pull Request with a clear description
- Visual Analytics: Interactive Chart.js graphs showing mood trends
- Smart Statistics: Automatic calculation of streaks, averages, and dominant moods
- Flexible Timeframes: View data for last 7, 30, or 90 days
- Score-Based System: 1-10 mood scoring with emoji representations
- Google Gemini Integration: Advanced conversational AI specifically trained for mental wellness
- Multi-Session Management: Organize conversations with editable titles
- Crisis Detection: Automatic detection of crisis language with professional help redirection
- Context Awareness: AI remembers conversation context within sessions
- Credit System: Usage-based system to manage AI costs
- Rich Text Editor: Title and content fields with formatting preservation
- Writing Prompts: Daily inspiration prompts to encourage reflection
- Full CRUD Operations: Create, read, update, and delete entries seamlessly
- Confirmation System: Safe deletion with confirmation modals
- 4-4-6-2 Pattern: Scientifically-backed breathing rhythm for relaxation
- Visual Guidance: Animated circle that scales with breathing phases
- Smooth Animations: CSS transitions for calming visual experience
- User Management: View and edit user accounts with pagination
- Credit Management: Adjust user credits and monitor usage
- Role Assignment: Promote users to admin or manage permissions
- Moderation Tools: Blacklist users who violate terms of service
This project is licensed under the MIT License - see the LICENSE file for details.
Aniruddha Bagal
- GitHub: @aniruddhabagal
- Portfolio: aniruddha.fyi
- Thanks to the mental health community for inspiration
- Next.js team for the amazing framework
- Tailwind CSS for the utility-first approach
- All contributors who help make MindMate better
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Join our community discussions
- Contact the maintainer directly
Made with โค๏ธ by Aniruddha Bagal
Building technology for better mental wellness, one commit at a time.