Clarity is a comprehensive digital mental health support platform developed as an initiative for the Government of Jammu & Kashmir's Higher Education Department as part of Smart India Hackathon 2025. The platform provides confidential, accessible mental health support specifically designed for students across universities and colleges.
- 24/7 availability with intelligent conversational AI
- Confidential and encrypted conversations
- Crisis intervention protocols with emergency resources
- Contextual mental health guidance
- Curated mental health resources for students
- Coping strategies and wellness tools
- Educational content on stress management
- Downloadable guides and worksheets
- Online appointment booking with licensed counselors
- Video/audio consultation options
- Specialized support for academic stress
- Integration with local mental health services
- End-to-end encryption for all communications
- Government-backed privacy protection
- Anonymous usage options
- HIPAA-compliant data handling
- Real-time peer chat with WebSocket-powered messaging
- Interest-based matching to connect with peers who share similar experiences
- Online status indicators showing when peers are available
- Typing indicators for a responsive chat experience
- Message persistence with chat history stored in Supabase
- WhatsApp-style recent chats showing latest conversations with timestamps
- Real-time bidirectional communication using Socket.IO
- JWT-based authentication for secure connections
- Automatic reconnection handling
- Multi-tab support with proper session management
- User presence tracking (online/offline status)
-
Clone the repository
git clone https://github.com/Ajay-Krishna00/Clarity cd Clarity -
Install dependencies
npm install
-
Environment Setup Create a
.env.localfile in the root directory -
Run the development server
npm run dev
-
Start the WebSocket server
cd backend npm install node index.js -
Open your browser Navigate to http://localhost:3000
See db/schema.sql for full database schema.
POST /api/chatbot
Content-Type: application/json
{
"message": [["user_message", "user"], ["previous_message", "model"]]
}| Event | Direction | Description |
|---|---|---|
joinChat |
Client → Server | Join a chat room with another user |
joinedChat |
Server → Client | Confirmation with chatId |
sendMessage |
Client → Server | Send a message to chat room |
receiveMessage |
Server → Client | Receive a message from peer |
typing |
Client → Server | Notify peer that user is typing |
peerTyping |
Server → Client | Peer started typing |
stopTyping |
Client → Server | User stopped typing |
peerStoppedTyping |
Server → Client | Peer stopped typing |
userOnline |
Server → Client | User came online |
userOffline |
Server → Client | User went offline |
clarity/
├── app/
│ ├── api/ # API routes
│ │ ├── chatbot/ # AI chat endpoint
│ │ ├── interests/ # Interests management
│ │ ├── match/ # Peer matching
│ │ └── ...
│ ├── peer-chat/ # Real-time peer chat page
│ ├── peers/ # Peer discovery & matching
│ ├── support-chat/ # AI support chat
│ └── ...
├── backend/
│ └── index.js # WebSocket server (Socket.IO)
├── components/
│ └── recentChat.js # WhatsApp-style chat list
├── lib/
│ ├── supabaseClient.js # Supabase client config
│ └── ...
└── ...
- Frontend: Next.js 14, React, Tailwind CSS
- Backend: Node.js, Express, Socket.IO
- Database: Supabase (PostgreSQL)
- Authentication: Supabase Auth with JWT
- AI: Google Gemini API
- Real-time: WebSockets via Socket.IO
Built with ❤️ for the students by students as part of Smart India Hackathon 2025