DEV Community

Cover image for Real Time Comment System Using Node.js, Express.js, Socket.io and MongoDB
Afzal Imam
Afzal Imam

Posted on

Real Time Comment System Using Node.js, Express.js, Socket.io and MongoDB

Hey friends, today I am going to show you, how to create a Real time comment system using Node.js, Express.js, Socket.io and MongoDB. This is really a awesome project to learn basics of Websocket and socket.io. If you want to know more about this project, please read this complete article. In this post I'll also share the code that I have written to develop this project.

In this real time comment system, if you write a comment on a post then instantly that comment will appear to the other connected users that are on that post without refreshing the page. I have also used MongoDB to store the comments of users with their name.

Note: If you are interested in reading poetry, you can Download Leaves of Grass by Walt Whitman PDF

Image description
When you visit the live demo of this website which is Real time comment system, first of all you have to enter your username in prompt then only you can comment on the blog page. Of course you can do user authentication or login facility by your own which I have not implemented in this project.

I have used Node.js, Express.js for backend and Socket.io package for real time communication and MongoDB to store the data into databases. To create frontend I have used HTML and some basic CSS and JavaScript.

Real time comment system using Express and Socket.io [Source Codes]

To create this project in your system you need to download Node.js and MongoDB. If its all ready in your system then you don't have to download any thing. Otherwise make sure you first of all download Node.js and MongoDB. Which you can download from their website.

After that just visit this Github repo and clone or download the zip file.

Open the downloaded file in VS code or your favorite code editor. Open terminal and run command npm i to download all the packages. After that just run the command npm run dev to run the project. That's all, your project will be live on localhost 3000.

So that's all this friend.
Thank You.

Top comments (0)