Implementation of a Real-Time Chat System Based on the MERN Stack and Socket.io with Natural Language Processing Integration for Automatic Sentiment Analysis
Downloads
Digital communication through chat platforms has become a primary medium for consultation services; however, the absence of non-verbal cues makes early detection of users’ emotional states challenging. This study implemented a real-time chat system based on the MERN Stack (MongoDB, Express.js, React.js, and Node.js) integrated with a lexicon-based Natural Language Processing (NLP) module to automatically detect message sentiment and risk levels. The system utilized Socket.io for bidirectional communication, with the NLP module positioned within the Controller layer and executed inline in the sendMessage event handler without requiring external services or message queues. Functional testing of the analyzeText() function across ten scenarios showed that all risk-level classifications matched the expected results. Sentiment classification achieved 80% accuracy, with two misclassifications attributed to the inherent limitations of lexicon-based matching in handling negation and substring ambiguity. All eleven Socket.io communication scenarios and seven REST API endpoints successfully passed testing. The MVC pattern within the MERN Stack demonstrated sufficient flexibility to accommodate an inline NLP module without requiring modifications to the Model or View layers. Furthermore, the tiered priority logic, which placed risky-word detection above sentiment scoring, maintained system reliability in critical cases despite occasional sentiment classification errors.
Amien, M. (2023). Sejarah dan perkembangan teknik Natural Language Processing (NLP) Bahasa Indonesia: Tinjauan tentang sejarah, perkembangan teknologi, dan aplikasi NLP dalam bahasa Indonesia. ELANG: Journal of Interdisciplinary Research, 1(01).
Andrianto, L. D., & Suyatno, D. F. (2024). Analisis performa load testing antara MySQL dan NoSQL MongoDB pada REST API Node.js menggunakan Postman. JEISBI, 5(1), 18–26.
Andzani, D., & Irwansyah. (2023). Dinamika komunikasi digital: Tren, tantangan, dan prospek masa depan. Jurnal Syntax Admiration, 4(11). https://doi.org/10.46799/jsa.v4i11.743
Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2019). BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, 4171–4186.
Fielding, R. T. (2000). Architectural Styles and the Design of Network-based Software Architectures.
Gunawan, F., & Prasetija, A. B. (2023). Penerapan Websocket pada sistem live chat berbasis web. Jurnal Pengembangan Teknologi Informasi Dan Ilmu Komputer (J-PTIIK), 7(2), 854–862.
Hidayatullah, A. F., & Ma’arif, M. R. (2022). Indonesian Sentiment Analysis Using Machine Learning and Natural Language Processing Approaches. International Journal of Advanced Computer Science and Applications.
Jurafsky, D., & Martin, J. H. (2023). Speech and Language Processing: An Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition. Online Manuscript.
Nasrul, N., & Izhar, A. (2023). Pengembangan REST API menggunakan Express JS untuk mencari mentor pribadi. Jurnal Informatika Terpadu, 9(2), 92–102.
Nurhayati. (2023). Rancang bangun back-end API pada aplikasi mobile AyamHub menggunakan framework Node JS Express. JUSTIN, 11(3). https://doi.org/10.26418/justin.v11i3.66823
Pradigi, C. H., Harlina, T., & Solehatin. (2022). Implementasi Express JS untuk membangun REST API website STIKOM PGRI Banyuwangi. JIKOM, 9(2), 118–122. https://doi.org/10.55794/jikom.v9i2.68
Pratama, R., Wijaya, A., & Lestari, D. (2025). Social impact orientation and sustainable business performance in SMEs. Asian Journal of Business Research, 15(2), 89–105.
Putra, F. P. E., Muslim, F., Hasanah, N., Holipah, Paradina, R., & Alim, R. (2024). Analisis komparasi protokol Websocket dan MQTT dalam proses push notification. Jurnal Sistim Informasi Dan Teknologi (JSISFOTEK), 5(4), 63–72.
Putri, O. E., Pranatawijaya, V. H., & Kristianti, N. (2024). Analisis sentimen berbasis aspek dan deteksi emosi pada coffee shop Palangka Raya menggunakan deep learning. JOINTECOMS, 4(3), 250–261.
Riski, R., Husaini, & Nasir, M. (2021). Implementasi socket programming pada aplikasi chat Uloen Messenger berbasis Android. JAISE, 2(1), 70–76.
Rivaldi, R. C., & Wismarini, T. D. (2024). Analisis sentimen pada ulasan produk dengan metode Natural Language Processing (NLP) (Studi Kasus Zalika Store 88 Shopee). Jurnal Ilmiah Elektronika Dan Komputer, 17(1), 120–128.
Saputra, N., Handayani, E., & Dwiretnani, A. (2021). Analisa Penjadwalan Proyek dengan Metode Critical Path Method (CPM) Studi Kasus Pembangunan Gedung Rawat Inap RSUD Abdul Manap Kota Jambi. Jurnal Talenta Sipil, 4(1), 44. https://doi.org/10.33087/talentasipil.v4i1.48
Tyagi, K., Singh, D., & Sharma, B. (2024). De-Link chat application using MERN Stack and Socket.io. International Journal of Research Publication and Reviews, 5(5), 8978–8983.
Widjaja, G. (2025). Perubahan pola komunikasi dalam masyarakat akibat penggunaan aplikasi pesan instan. Prosiding Seminar Nasional Indonesia, 3(1), 10–16.
Wikarsa, L., Angdresey, A., & Kapantow, J. D. (2022). Implementasi metode Naïve Bayes dan lexicon-based approach untuk mengklasifikasi sentimen netizen pada tweet berbahasa Indonesia. Jurnal Ilmiah Realtech, 18(1), 15–24.
Copyright (c) 2026 Tirta Patria Nandhika, Adi Nugroho

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.



