How to create a social networking site in Node JS and Mongo DB

Social Networking Site in Node JS and Mongo DB

A social networking service is an online platform that people use to build social networks or social relationships with other people who share similar personal or career interests, activities, backgrounds, or real-life connections. Social networking services vary in format and the number of features.

wikipedia

Demo

Social Network Site (Node JS + Mongo DB)

Requirements:

Source Code:

Social Networking Site in Node JS and Mongo DB
Social Networking Site in Node JS and Mongo DB

Introduction

Social networking site is a project developed in Node JS and Mongo DB. It has all the functionality that you need to build a social network for your local community. Node JS is becoming a rising programming language for backend servers, it is fast and easy to learn. If you know Javascript, you already knew Node JS.

On the other hand, Mongo DB is quickly becoming a standard for creating schema-less applications where the structure of your database is not important. It is widely being used in large systems with an intention to scale easily.

Basic Version

This project has a basic version that allows you to download the code for free and set it up in your local system. In the source files, a file named “How to install.txt” will guide you on how you can set up the project in your system. But if you are still facing a problem, you can always contact me.

In the basic version, you will avail of the authentication functionality that includes login and registration of the user. Passwords are encrypted before storing in Mongo DB. The project uses JSON Web Token (JWT) for storing logged-in user’s information. JWT is used to transmit information securely between client and server. After logging in, the user will be able to update his profile picture and cover photo. Uploaded files are being stored in Node JS server using fs module which stands for File System and the path of the uploaded file is stored in Mongo DB.

Post with caption, image and video

Now come to the most important part of any social networking site, POSTS. What makes a social network great is the number of posts, so you should allow users to create posts, update their status, what they are doing, etc. The basic version has the ability to create posts using text, images, or video. Post created by the user will only be viewed by his friends. When the post is created, the user will like the post, comment on a post, and reply to any comment. Posts can also be shared on your timeline, so you can pick any post you like and hit the “share” button, and will be displayed on your timeline as well.

When someone likes your post, comments on your post, or replied to your comment, a notification will be received on the left side of your home page. You can view a list of all notifications received and notification will be marked as read once opened.

The basic version also has a search functionality where you can search people by their name, username, or email address. This is all we are offering in the basic version. Next, we will discuss its premium version.

Buy Now:

  1. Let us know your name, email, and country.
  2. An invoice will be emailed to you.
  3. After the invoice is paid, the source code will be emailed to you.

Premium Version

In terms of search functionality, in the basic version, you are able to search the people, but in the premium version, you will be able to search groups and pages as well by their name. This will create 3 tabs on the search page, first for users, second for pages, and third for groups.

In terms of authentication, you will be able to verify the user by his email address during registration. When someone registers, an email will be sent to him with an instruction to verify their email address. Users who have not verified their emails will not be able to log in. This will help you know that the users you have on your site are actual users, not robots.

This premium version also comes with the functionality to reset the password. This gives users the ability to reset their passwords if they have forgotten. When someone types his email for resetting the password, the system will check if the email exists then it will send an email with a link to reset the password. When that link is opened then it will confirm that it is the valid link and show the field to enter a new password.

Create Friends

You can create friends by searching people by their name, then send them a friend request. The other person will be able to respond to that request, he can either decline or accept the request. Once accepted, you both will be able to view each other’s posts in your timeline.

Create Pages

You can create pages by entering the page name, cover photo, and a short description of the page. Then you will be able to add posts to that page as well. When someone searches for that page, he will be able to view all the posts on that page. Users will be able to like the page, once liked they will be able to view the page’s posts in their timeline as well.

Create Groups

This premium version also allows you to create groups by entering the group’s name, cover photo, and a short description of the group. Once the group is created, people will be able to see it in their search results, they will send a request to join the group. Only you (admin) will be able to decline or accept the group request. Once accepted, the user will become a member of that group. Members are allowed to add posts in that group and all the other members will be able to view it in their timeline.

Realtime Chat

One of the most demanding functions of a social network is chat. You make friends chat with them, in this version you will be able to have a real-time secure chat between 2 friends. We have used Sockets for real-time communication, all the messages are also being stored in Mongo DB.

People who viewed your profile

It also has a functionality where you can see a list of all people you have viewed your profile. When someone visits someone’s profile, we are storing his record in Mongo DB along with the current date and time. Then the other person will see a list of people who viewed his profile along with the time that person visited your profile recently.

Since you are creating posts, you must be able to edit and delete posts. You can edit your own created posts and you can also delete your created posts as well. Once the post is updated, it will be updated on all social networks. Although it is Mongo DB (non-relational) still manages to update the post’s document in all places. The same goes for delete, once the post is deleted, it will be deleted all over the social network.

It also has a functionality that we call “load more”. It allows you to load more posts without having to reload the page. When the social network is opened, the first 30 posts will be fetched and displayed in the browser. When the user scrolls to the bottom, a button is displayed at the bottom of the page which when clicked will fetch the next 30 posts. You can change the number of posts as you wish.

You can send images and videos in a chat with your friends. All attachments sent are being stored in the Node JS file system. You can also preview the files before sending them. Images and videos are not being compressed, so you can send high-quality images without having to worry that the system will reduce the quality of images, it will not reduce the quality of images or videos.

Share Posts

You will be able to share posts in your timeline, pages you have created, and the groups you have joined.

You will be able to view a list of all people you have liked and shared your post. This is really helpful for a social network where you want to know who has liked and shared your post.

This project has 6 major features that are essential for social network:

  1. End-to-end encryption.
  2. Customer support.
  3. Ban & delete the user.
  4. Filter bad or abusive words.
  5. Adult image validation.
  6. Ban the post.

Let’s view each in detail.

1) End-to-end encryption on chat

First, is the end-to-end encryption for chat messages. When you are having a chat with your friend, instead of saving the messages in plain text, we have added the functionality to encode the message during sending and decoding the message during receiving. Thus, making the chat end-to-end encrypted. The below screenshot shows how messages will be stored in the database. So only the receiver can see the message correctly.

end to end encrypted chat - social networking site in node js and mongo db
end to end encrypted chat – social networking site in node js and mongo db

2) Customer support

The second is customer support. If users are having a problem in any function or wanted to ask something, they can contact your social network’s customer support. It can be accessed from the left sidebar. Users can create a new ticket, a ticket is a problem that the user is facing. They can enter their problem, they can also attach an image or video as well to demonstrate the problem.

Created tickets will be displayed on the admin panel in a list. Admin can open any ticket from the list to respond to the corresponding user. Both admin and users can add a comment using the WYSIWYG editor, which helps them to apply styles to their comments. Users and admin can view all the comments from the other person.

The user will receive a notification that a new comment has been added to his ticket and he can respond to admin. Admin can also close the ticket when the issue is resolved. Once the ticket is closed, no-one will be able to add comments on that ticket. The user can also delete the ticket if he wants.

3) Ban & delete user

The third is banning and deleting the user. Banning means that the admin can ban any user he wants, the user’s data will remains to be stored in the database, but the user will not be able to access the system. Once banned, the user will automatically be logged out and when he tries to log in, he will be displayed an error message that he is banned. Admin can unban the user and the user will be able to login now. Admin can also delete the user from the system.

4) Filter bad/abusive words

The fourth is filtering bad words. When the user adds a new post, its content will be checked, and made sure that there are no abusive words in it. If there is any such word, then an error will be displayed and the post will not be saved. The same validation is applied when the post is edited.

5) Adult image validation

The fifth is adult image validation. When the user adds a new post and attaches an image to it, that image is checked and made sure that it must not contain any adult content. If it is an adult image, an error will be displayed and the post will not be saved. Normal images will be uploaded as they were before. The same validation is applied when the post is edited. But if you still do not like any post’s image, you can remove it from the admin panel and it will be removed from the system.

6) Ban Post

The sixth is banning the post. When a user posts anything and you find it offensive, instead of deleting it, you can ban the post. So the post will not be removed from the system but it will not be visible to other users. During banning the post, you have to enter the reason to ban. This reason will be visible to the user. The user will get a notification that his post has been banned and he will also see the reason why it is banned. Admin can unban the post and the post will now be visible for everyone.

So these are the six major functions we added to the social network project. It is developed in Node JS and Mongo DB. The price of this project is just $20.

Customer’s Reviews

18 Replies to “Social Networking Site in Node JS and Mongo DB”

  1. Hello, I have problems with the free version. When I try to update the image profile or the cover photo, it registers the file path in the database, but it doesn’t copy the file to public/images/ so the result is a 404 for boths images.

Leave a Reply

Please disable your adblocker or whitelist this site!