How priyanshuk17/online-mental-health-support-platform works
MindSpace is a full-stack mental-health support platform. Users register or log in, then use mood check-ins and trends, private journaling, an AI companion, and a resource library; crisis-language scanning can surface support resources independently of AI responses. The graph follows the documented client-to-API workflow and sampled server calls. README capabilities retain branches whose implementation was not sampled; edges to those areas are limited to relationships visible in excerpts or documented behavior.
Main entry points: App.jsx App routes · index.js Express API · api.js API client · journalController.js Journal operations
Components 27
User experience
- App routes
client/src/App.jsx - Login and register
client/src/pages - Dashboard
client/src/pages/Dashboard.jsx - Mood tracking
client/src/pages/MoodTracker.jsx - Journal
client/src/pages/Journal.jsx - AI companion
client/src/pages/AIChat.jsx - Resource library
client/src/pages/Resources.jsx - Crisis button
client/src/components/CrisisButton.jsx - API client
client/src/lib/api.js
API and identity
- Express API
server/src/index.js - Auth routes
server/src/routes/authRoutes.js - Authentication
server/src/controllers/authController.js - JWT protection
server/src/middleware/auth.js
Wellness features
- Mood operations
server/src/controllers/moodController.js - Journal operations
server/src/controllers/journalController.js - Chat operations
server/src/controllers/chatController.js - Resource operations
server/src/controllers/resourceController.js
Safety and AI
- Crisis events
server/src/models/CrisisEvent.js - Keyword safety scan
server/src/services/crisisService.js - AI services
server/src/services/aiService.js
Persistence
- Mood records
server/src/models/MoodEntry.js - Journal records
server/src/models/JournalEntry.js - Chat sessions
server/src/models/ChatSession.js - Resource records
server/src/models/Resource.js - User records
server/src/models/User.js
Other components
- User
- OpenRouter
Connections 37
- User → App routes: uses
README.md - App routes → Login and register: routes
client/src/App.jsx - App routes → Dashboard: routes
client/src/App.jsx - App routes → Mood tracking: routes
client/src/App.jsx - App routes → Journal: routes
client/src/App.jsx - App routes → AI companion: routes
client/src/App.jsx - App routes → Resource library: routes
client/src/App.jsx - Login and register → API client: requests
- Mood tracking → API client: requests
- Journal → API client: requests
- AI companion → API client: requests
- Resource library → API client: requests
- Crisis button → User: offers support
README.md - User → Crisis button: opens
README.md - API client → Express API: calls API
- Express API → Auth routes: mounts
server/src/index.js - Auth routes → Authentication: routes to
server/src/routes/authRoutes.js - Auth routes → JWT protection: protects
server/src/routes/authRoutes.js - Express API → Mood operations: mounts routes
server/src/index.js - Express API → Journal operations: mounts routes
server/src/index.js - Express API → Chat operations: mounts routes
server/src/index.js - Express API → Resource operations: mounts routes
server/src/index.js - Authentication → User records: reads and writes
server/src/controllers/authController.js - JWT protection → User records: loads user
server/src/middleware/auth.js - Mood operations → Mood records: reads and writes
server/src/controllers/moodController.js - Journal operations → Journal records: reads and writes
server/src/controllers/journalController.js - Chat operations → Chat sessions: reads and writes
server/src/controllers/chatController.js - Resource operations → Resource records: reads resources
server/src/controllers/resourceController.js - Mood operations → Keyword safety scan: scans notes
server/src/controllers/moodController.js - Journal operations → Keyword safety scan: scans entries
server/src/controllers/journalController.js - Chat operations → Keyword safety scan: scans messages
server/src/controllers/chatController.js - Mood operations → Crisis events: logs flags
server/src/controllers/moodController.js - Journal operations → Crisis events: logs flags
server/src/controllers/journalController.js - Chat operations → Crisis events: logs flags
server/src/controllers/chatController.js - Chat operations → AI services: requests reply
server/src/controllers/chatController.js - Journal operations → AI services: requests summary
server/src/controllers/journalController.js - AI services → OpenRouter: calls model
server/src/services/aiService.js