Mentora
Mentora is a web-based project developed by a team of three, where I contributed as the backend developer. The platform focuses on mental health as part of supporting the healthcare aspect of smart cities, integrating collaboration with both government institutions and professional psychologists. Mentora features AI technology that analyzes users’ emotions based on their input in a personal diary, with visualized emotion trends displayed through a 7-day graph. For government stakeholders, the system provides decision support by mapping regions with high stress levels, offering valuable insights for community well-being. The platform also connects users with psychologists for professional consultations, includes an AI-powered chatbot for instant support, and provides a community forum where users can share experiences, post content, and support one another.
2025
Website
Node.js, Express, Sequelize, MySQL, REST API, JWT
Problem
Urban mental health challenges often remain unaddressed due to social stigma, limited immediate access to professional psychologists, and a lack of real-time community emotional health data for municipal health authorities. Without granular geographic insights, governments struggle to deploy targeted mental health interventions. Mentora was developed as a comprehensive mental health platform under the Smart City Healthcare framework. It unites three key stakeholders: the public seeking daily emotional self-tracking and conversational AI support, licensed psychologists offering scheduled consultations, and local governments requiring spatial clustering dashboards to monitor regional stress concentrations across municipal districts.
My role
This platform was developed by a 3-member multidisciplinary team (1 Frontend Developer, 1 AI/ML Engineer, and 1 Backend Developer). I served as the Backend Developer, owning server architecture, relational database design, AI microservice orchestration, and REST API development:
- Relational Data Modeling (MySQL + Sequelize ORM): Designed a complex multi-domain schema spanning 14+ models, including hierarchical administrative divisions (
District&Subdistrict), appointment scheduling engines (Appointments&PsikologSchedules), persistent conversational chat trees, and emotion logs (EmologHistories). - AI Chatbot Orchestration (Alora) & Vector Memory: Integrated the conversational agent with an external Python LLM service, handling unique session creation (UUID v4), memory synchronization, and atomic database transactions (
sequelize.transaction) when persisting user and agent turns. - Emotion Tracking (Emolog) & Self-Harm Streak Recovery: Engineered diary entry endpoints that relay qualitative reflections to external NLP services for sentiment classification, aggregating 7-day emotional trajectories and managing self-harm prevention streak counters.
- Regional Stress Clustering Engine (Smart City Dashboard): Developed an aggregation endpoint grouping emotional trends dynamically by subdistrict or district, parameterized by gender and custom date intervals, supplying decision-support insights for local health departments.
- Consultation Scheduling & Role-Based Access Control: Built stateless JWT authentication with role authorization gates (
checkPemerintah,checkPsikolog) to safeguard confidential medical appointment interactions and municipal dashboards.
System architecture
The Node.js backend serves as the central orchestration hub connecting the web clients, MySQL database, and external machine learning microservices:
- Express.js API Layer: Provides modular routing (
/api/auth,/api/emolog,/api/alora,/api/appointment,/api/emolog-cluster) secured withhelmetand custom JWT verification middleware. - Sequelize ORM (MySQL): Manages relational integrity, model validations, foreign key constraints, and transactional safety across multi-table operations.
- AI Microservice Integration (FastAPI/Python): The backend interacts via HTTP clients (
axios) with independent Python services executing NLP sentiment classification, vector memory indexing, and spatial stress clustering algorithms.
Key endpoints
| Method | Path | Purpose & Role |
|---|---|---|
POST |
/api/auth/login |
Multi-role user authentication & JWT Bearer token generation |
POST |
/api/emolog |
Submit diary entry for automated NLP emotion classification |
GET |
/api/emolog |
Fetch historical emotion trajectories (default 7 days) |
GET |
/api/emolog-cluster |
Aggregate stress concentrations by district/subdistrict (Role: Government) |
POST |
/api/alora/new-chat |
Initialize AI chatbot session and persist dialogue turns |
GET |
/api/alora/sessions |
Retrieve list of active counseling chat sessions |
GET |
/api/schedule/:psikolog_id |
View psychologist consultation availability slots |
POST |
/api/appointment/book |
Reserve an appointment slot with a licensed psychologist |
PUT |
/api/appointment/:id/status |
Update appointment lifecycle (pending, confirmed, completed) |
GET |
/api/post & POST |
Community peer-support discussion threads |
Technical challenges
1. Ensuring conversation history atomicity across distributed AI calls.
When a user converses with Alora, the backend must save the incoming prompt, call the external Python LLM service, and record the generated response. If a timeout or server drop occurs mid-flight, chat history can easily become desynchronized. To resolve this, session creation and message recording are wrapped inside managed database transactions (sequelize.transaction()). If the downstream inference endpoint fails, changes roll back cleanly without leaving orphaned dialog states.
2. High-performance spatial aggregation for government monitoring.
The clustering endpoint computes aggregate metrics across thousands of historical emotion logs grouped by geographic boundaries (districts and subdistricts) and filtered by demographic parameters. We optimized queries by placing compound indexes on foreign keys (subdistrict_id, district_id) and timestamp columns (date), offloading grouping and counting operations directly to MySQL database engines before serialization.
3. Strict user anonymity in municipal health analytics. Mental health tracking involves sensitive personal data. The government clustering API strips away all personally identifiable information (PII)—including names, phone numbers, and raw diary text. The municipal dashboard receives only normalized percentage distributions of emotional categories per regional boundary code.
4. Preventing double-booking in psychologist schedules.
Psychologists have strict consultation hours. The backend checks slot availability atomically prior to creating an Appointment record, ensuring that simultaneous booking attempts on the same psychologist time slot are safely rejected.
Future improvements
- Offload AI conversational relays and heavy data clustering jobs to asynchronous background queues (Redis + BullMQ).
- Implement WebSockets (Socket.io) for live chat streaming and instant appointment status notifications.
- Introduce automated end-to-end testing suites for appointment workflows using Jest and Supertest.
View More Projects

Tailor marketplace built during my Unimasoft internship: orders, progress tracking, chat, and cashless payments.
- Laravel 11
- Livewire
- MySQL

Digital library API: borrowing, book requests, premium accounts, and cashless fine payments.
- Node.js
- Express
- MySQL

Gamified educational community platform: Phaser mini-games (Kitty Attack), real-time score pipeline, and Top-10 leaderboards.
- Next.js
- Node.js
- Express