Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • NodeJS Tutorial
  • NodeJS Exercises
  • NodeJS Assert
  • NodeJS Buffer
  • NodeJS Console
  • NodeJS Crypto
  • NodeJS DNS
  • NodeJS File System
  • NodeJS Globals
  • NodeJS HTTP
  • NodeJS HTTP2
  • NodeJS OS
  • NodeJS Path
  • NodeJS Process
  • NodeJS Query String
  • NodeJS Stream
  • NodeJS String Decoder
  • NodeJS Timers
  • NodeJS URL
  • NodeJS Interview Questions
  • NodeJS Questions
  • Web Technology
Open In App
Next Article:
Budget Tracking App with Node.js and Express.js
Next article icon

Build a Social Media REST API Using Node.js: A Complete Guide

Last Updated : 25 Aug, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

Developers build an API(Application Programming Interface) that allows other systems to interact with their Application’s functionalities and data. In simple words, API is a set of protocols, rules, and tools that allow different software applications to access allowed functionalities, and data and interact with each other.API is a service created for user applications that request data or some functionality from servers.

How-to-Build-a-Social-Media-REST-API-Using-Nodejs

In this article, we will build a RESTful Social Media API where we will create a backend structure of a general Social media Application where a User can register, and if a user is authentic then the user can create a Post. Also, they can delete their specific Post. But before directly jumping onto that we will learn why to create an API and choose the Technology stack for your API.

Why Create an API?

If some Applications need a little chunk of data from our system, we cannot give them complete access to our servers for various security concerns. Instead, we create well-structured and secure API for that particular data or functionality so that if someone needs that we can give them endpoints with proper API keys and only Authentic users can access the data which can be checked by proper Authentications like OAuth 2.0 and JSON Web Tokens.

We can also monitor and analyze the API usage by different users so that we can handle that safely if some issue will occur and can improve our API over time for better utilization.

For example: Many large companies like Swiggy, Zomato, and OLA use map API which integrate the map into the Applications to give the live location of their riders and to provide a better experience to the customer.

Before start building the API, let's discuss the technology stack on top of which the whole API will be created.

Choosing the Technology Stack

It is very important to choose the right technology stack when it comes to building an API. The technology stack includes programming language, framework, library, and database which will be used to develop API. Although there are several factors based on which you should choose the technology stack for building an API, some of them are scalability, performance, security, and developer productivity. So always look for technology that provides scalability options such as distributed systems, load balancing, and caching mechanisms. Also, choose such programming languages and frameworks that align with your project requirements and the expertise of your developer team.

So in this article, we will see how to build a RESTful Social Media web API whose tech stack would be:

  • Node.js - to create routes and servers.
  • MongoDB - Database on which we can perform CRUD(Create Read Update Delete ) operations
  • REST - Representational State Transfer which is scalable and works on HTTP protocol.
  • Postman - Additionally, we will use Postman for API testing. Now let’s make it for more clear understanding.

How to Build a Social Media REST API Using Node.js?

We will build a REST API called social_media. We will create Users, add authentication functionalities and if the user is authentic allow them to create posts. All the data will be stored in the MongoDB database. We will further call the API for deleting specific posts by ID and get the user details and all the requests will be sent to Postman.

Since this article is all about building an API. So we are not creating any front end here but for testing and requests of data, we will use Postman.

Here are the steps for building a social media API:

Step 1: Initialize Node.js Project

First, Create a new directory named social_media and inside that directory initialize NPM by running this command on the terminal.

npm init -y

It will initialize your project and create a package.json file containing your project details.

Output:

Initializing-project

Step 2: Installing the Necessary Modules

Install the modules you will need in this project using the following command

npm i <module_name, module_name...>

Here replace the module_name with the name of the modules which are given below.

  • bcrypt:  it is used to make passwords secure by hashing
  • dotenv: it is used to store our secret key and URL of MongoDB
  • express: it is a node.js framework.
  • express-validator: it is used to validate the user’s input data like email and phone number.
  • jsonwebtoken:  used to authenticate and authorize users
  • mongoose: it connects MongoDB to our Application.

Further, if any module is required we can install that in the same manner.

Output:

installing-modules

Step 3: Creating Server

It’s time to create our server. Create a server.js file in the current directory. Import the express library, create an app using it, and listen to the server on port no. 3000. Add the below code to the server.js file

server.js

const express = require('express');

const app = express();
const PORT = process.env.PORT || 3000;

app.use(express.json());


app.listen(PORT, () => {
    console.log(`Server started on port ${PORT}`);
  });

  module.exports = app;

Now we will run the file by entering the below command on the terminal.

Output:

3-server-starting-Output.png

Congratulations!! Your server has started.

Step 4: Create a Database

 So we will use MongoDB Atlas to create our social_media database. We are using its website. 

After login into MongoDB click on Create which is shown in the image below

create-new-DB

4.1. Click on Create Cluster

create-cluster

4.2. Create a new project named ‘social_media’.


create-new-project

4.3. Save the username and password shown below which will be used to connect with DB.

create-User

4.4. Go to Network Access then select edit and allow Access From Anywhere and then confirm.

Allow-Network-Access-to-connect-DB

4.5. Now you have to add this database to your application by adding a link which you will find by going to Database -> connect -> Compass and you will see the below image:

save-compass-Link

Step 5: Connecting MongoDB to the Application

For this, we will create a new file ‘db.js’  in the same directory and write the connection code there and after that, we will connect this file to our server.js file.

Now make a db.js file in the same directory.

db.js

const mongoose = require('mongoose');

const connectDB = async () => {
  try {

    await mongoose.connect(process.env.MONGODB_URI, {
      useNewUrlParser: true,
      useUnifiedTopology: true,
 
    });
    console.log('MongoDB connected');
 
  } catch (error) {
    console.error(error.message);
    process.exit(1);
  }
};

module.exports = connectDB;

 Here we need the mongoose library to connect with the database. ‘process.env.MONGODB_URI’ will give the link stored in the .env file which connects our server with the database. And in case of any error, it will catch and show us on the console.

Create a .env file in the same directory to store the secret key and the URL to connect MongoDB to make the connection secure.

.env

MONGODB_URI="mongodb+srv://<replaceyourusername>:<pasteyourpassword>@cluster0.g73tlip.mongodb.net/?retryWrites=true&w=majority"

JWT_SECRET=mysecret

Here replace your username with <replaceyourusername> and replace your password with <pasteyourpassword>.

Now connect the db.js file to the server.js file by adding the below code to the server.js file.

server.js

const connectDB = require('./db');
require('dotenv').config();
connectDB();

See the final updated server.js file at the end of this section.

Now we will run our server.js file.

Output:

mongoDB-connected

Here you can see our database has successfully connected.

Step 6: Create schema for users, and posts

As of now, our database is connected so it's time to create the schema for our Users and the posts they will create.

Users will contain 4 fields - name, email, password, and posts. The schema for users will look like this:

{
  name: {
    type: String,
    required: true
  },
  email: {
    type: String,
    required: true,
    unique: true
  },
  password: {
    type: String,
    required: true
  },
  posts: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Post' }]
}

Here name, email, and password are mandatory for a new user to register.

Posts Schema will contain 4 fields:- author, title, description, and createdAt and it will look like this:

{
  author: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'User',
    required: true
  },
  title: {
    type: String,
    required: true
  },
  description:{
    type: String,
    required: true
  },
  createdAt: {
    type: Date,
    default: Date.now
  }

We will create the User and Post Schema in different files and to create these files we will create a directory named ‘models’ inside our main directory which contains the users.js and posts.js files which will have the respective schemas and models.

userSchema.pre() and postSchema.pre() are used to perform operations to the data before adding to db.

In the user.js file bcrypt is used to hash the password to make it more secure. We will convert the password using hashing and then store it in the database.

Create a user.js file for User schema.

models/user.js 

const mongoose = require('mongoose');
const bcrypt = require('bcrypt');
const userSchema = new mongoose.Schema({
  name: {
    type: String,
    required: true
  },
  email: {
    type: String,
    required: true,
    unique: true
  },
  password: {
    type: String,
    required: true
  },
  posts: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Post' }]
});
userSchema.pre('save', async function (next) {
    const user = this;
    if (user.isModified('password') || user.isNew) {
      try {
        const hash = await bcrypt.hash(user.password, 10);
        user.password = hash;
      } catch (error) {
        return next(error);
      }
    }
    next();
  });


const User = mongoose.model('User', userSchema);

module.exports = User;

Just before adding the post, it will update the new post in userSchema using postSchema.pre().

Create a post.js file for Post schema.

models/posts.js 

const mongoose = require('mongoose');
const postSchema = new mongoose.Schema({
  author: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'User',
    required: true
  },
  title: {
    type: String,
    required: true
  },
  description:{
    type: String,
    required: true
  },
  createdAt: {
    type: Date,
    default: Date.now
  }
});
postSchema.pre('save', async function() {
  try {
    // Find the user document and update its posts array with the new post
    const user = await mongoose.model('User').findByIdAndUpdate(
      this.author,
      { $push: { posts: this._id } },
      { new: true }
    );
 
  } catch (err) {
    console.error(err);
  }
});
const Post = mongoose.model('Post', postSchema);

module.exports = Post;

Now our directory will look like this:


directory-structure

Step 7: Create/ register new users

We will create 2 new users using the POST method and add them to our database.

Syntax of POST method:

router.post(route, (req, res)=>{
...
})

For adding users we will create another directory ‘routes’ which will have all the routes and our users.js file.

routes/users.js

// Import necessary modules
const express = require('express');
const router = express.Router();
const User = require('../models/users');

// Create a new user
router.post('/register', async (req, res) => {
  const { name, email, password } = req.body;

  // Create a new user with the provided name, email, and password

  const user = new User({ name, email, password });
  await user.save();

  // Return the new user as JSON
  res.json(user);
});
module.exports = router;

When the user calls the /register API since it is the POST request so it will carry some data along with it. Fetch the data using req.body and Assign the data to {name, email, password} and then add this data to the schema.

To connect the routes/users.js file to the server we add the following code to our server.js file:

server.js

const userRouter = require('./routes/users');
app.use('/api',userRouter);

See the updated code of server.js at the end of this section.

Now when we hit this route and send data as a request to the server using the POST method it will store our data in the database.

Now using Postman create 2 users:

After logging into Postman create a new collection named social_media, there create a new request, after that select the POST method, and in the body select raw where change the TEXT to JSON format, and in the input field add the data of a new user.  

Now add the URL of api/register and hit the send button.

Create-a-User

In the output body, we will see the data stored in our DB in JSON format.

Similarly, Create another User.

Create-another-User

Go to social_media database and If we refresh our Browse collection on the database we find data of 2 users in JSON format.

checking-user-in-Database


Step 8: Getting the Detail of a User

Now we will fetch all the details of a user using the GET method. But before that, we will check if the user is authentic or not, for this, we are using a middleware ‘auth’ which will check if a user is authentic or not by using JSON Web Token.

So first create another directory ‘middleware’ which contains the ‘auth.js’ file.

It will take a token and check if it exists then create a userID using this token and check whether a user exists with this userID and if it exists then pass the user or else throw an error.

middleware/auth.js

const jwt = require('jsonwebtoken');
const User = require('../models/users');

module.exports = async function(req, res, next) {

  if(!req.headers.authorization){
    return res.status(401).json({ message: 'Unauthorized' });
  }
  const token = req.headers.authorization.split(' ')[1];;
//   console.log(req);

  // Check if the token exists
  if (!token) {
    return res.status(401).json({ message: 'Unauthorized' });
  }

  try {
    // Verify the token
    const decoded = jwt.verify(token, process.env.JWT_SECRET);
    // console.log(decoded);
    // Add the decoded user information to the request object
    const user = await User.findById(decoded.userId);
    if(!user){
    return res.status(400).json({ message: 'User does not exist' });

    }
    req.user = user;


    // Call the next middleware function
    next();
  } catch (err) {
    res.status(401).json({ message: 'Invalid token' });
  }
};

We take a token from the registered user and check if the user is the same or not if the user matches then it will allow the request to proceed further else throw an error.

Here we are generating tokens manually, To generate tokens, create a ‘auth.js’ file in the ‘routes’ directory which will check the details of a user and generate the token if the user exists.

When we hit the /authenticate and provide email and password it will then check whether the email exists or not with the required password and if the user exists then return a JSON Web Token as a response.

routes/auth.js  

const express = require('express');
const jwt = require('jsonwebtoken');
const User = require('../models/users');
const bcrypt = require("bcrypt");
const router = express.Router();

router.post('/authenticate', async (req, res) => {
  const { email, password } = req.body;
  if(!email){
    return res.status(400).json({ message: '"email" is required' });
  }
  if(!password){
    return res.status(400).json({ message: '"password" is required' });
  }
  // Find the user by email
  const user = await User.findOne({ email });
  // If the user doesn't exist or the password is incorrect, return an error
  if(!user){
    return res.status(401).json({ message: 'Email or password is incorrect' });
  }
  const validPassword = await bcrypt.compare(password, user.password)
  if (!validPassword) {
    return res.status(401).json({ message: 'Email or password is incorrect' });
  }

  // Generate a JWT token with the user ID as payload
  const token = jwt.sign({ userId: user._id }, process.env.JWT_SECRET);

  // Return the token as JSON
  res.json({ token });
});


module.exports = router;

Link the above file to server.js by adding the below code to the ‘server.js’ file:

server.js

const authRouter = require('./routes/auth');
app.use('/api', authRouter);

See the final updated code of the server.js file at the end of this section.

Now to get the details of users we have to create a route /user which will check if the user is authentic using middleware and then return the details of users.

Add the below code in ‘routes/users.js’ to get the detail of a user

routes/users.js

Cout auth= require(‘../middleware/auth’);
router.get('/user', auth, async (req, res) => {
    try {
      const userId = req.user.id;

      const user = await User.findById(userId);

      const userName = user.name;


      res.json({ name: userName });
    } catch (err) {
      console.error(err.message);
      res.status(500).send('Server Error');
    }
  });

Now let's look at the postman:

First, create a token for the user for which you want the details using the /authenticate route in the auth.js file:

Create a new request, select POST method, and in the body got to raw and select JSON format and add {email, password} in the input field as JSON. Add the URL of api/authenticate and enter the Send button, it will generate the Token as an Output.

generating-token

Now take this token and send it as a request while authenticating in middleware when we hit this user route on Postman to get the user's detail, so we will pass the token as a bearer token in authentication in Postman as shown in the image below:

User-detail-in-Postman

Hence as a response, it will show us the details of users as an output.

Step 9: Create a post for a user

Similarly, we can create posts for a specific user using the POST method. Now we will create another file ‘posts.js’ inside routes which contains the routes of creating posts.

Creating a ‘posts.js’ file inside routes that contain the route. Here we are using one of the important library ‘express-validator’ which add a middleware ‘check’ to the route and validateResult will check whether the request is giving any error or not and after that create a new post by taking the data from the request.

routes/posts.js

const express = require('express');
const router = express.Router();
const auth = require('../middleware/auth');
const { check, validationResult } = require('express-validator');
const Post = require('../models/posts');

router.post('/posts',
  [auth, [check('title', 'Title is required').not().isEmpty(), check('description', 'Description is required').not().isEmpty()]],
  async (req, res) => {
    // Check for validation errors
    const errors = validationResult(req);
    if (!errors.isEmpty()) {
      return res.status(422).json({ message: 'Invalid inputs'});
    }
 
    try {
      // Create a new post
      const post = new Post({
        title: req.body.title,
        description: req.body.description,
        author: req.user.id
      });

      // Save the post to the database
      await post.save();

      // Return the new post object
      res.json({
        id: post.id,
        title: post.title,
        description: post.description,
        createdAt: post.createdAt
      });
    } catch (err) {
      console.error(err.message);
      res.status(500).send('Server Error');
    }
  }
);


module.exports = router;

Connect this file with the server.js file by adding the below code to the server.js file:

server.js

const postRouter = require('./routes/posts');
app.use('/api',postRouter);

See the final updated server.js file at the end of this section

Now first create a token on Postman for the user you want to create a post

generating-token-for-post

Take this token, create a new request and add it to the bearer token of the authentication section, and hit a post request with the data of the post in JSON format 

creating-post-using-postman

Then refresh the Browse collection in the database and you will find that the post is created and stored in the database successfully, as shown in the image below:

checking-post-in-Database

Step 10: Delete a Post 

Now let’s delete a user’s post by post ID using the DELETE method. Create the route inside the ‘routes/posts.js’ file.

Firstly we will check if the postID exists or not using findOne. If it exists then delete it using the deleteOne function

Add the below code to the ‘routes/posts.js’ file after the ‘/posts’ route: 

routes/posts.js

// DELETE a post by ID
router.delete('/posts/:id', auth, async (req, res) => {
    try {
      // Find the post by ID and verify it was created by the authenticated user
      const post = await Post.findOne({ _id: req.params.id, author: req.user.id });
      if (!post) {
        return res.status(404).json({ message: 'Post not found' });
      }

      // Delete the post and its associated comments
      await Post.deleteOne({ _id: req.params.id });

      resstatus(204).json({ message: 'Post deleted' });
    } catch (err) {
      console.error(err.message);
      res.status(500).send('Server Error');
    }
  });

First create a token for the user, for which you want to delete the post

generate-token-to-delete-post-in-postman

Now take the id of the post which has to be deleted:

taking-id-of-user

Now create a new DELETE request and add the token to the bearer token at authentication and add the id to the route and send it.

deleting-post-in-postman

Now if you refresh and see the Browse collection in the database then Post does not exist:

checking-the-deleted-post-in-Database

The post has been deleted. Now if you look at the final structure of the directory, it will look like this:

Final-directory-structure

We have completed the social_media API project. Final Updated files which are used multiple times:

server.js

const express = require('express');
const connectDB = require('./db');
const authRouter = require('./routes/auth');
const userRouter = require('./routes/users');
const postRouter = require('./routes/posts');

const app = express();
const PORT = process.env.PORT || 3000;



require('dotenv').config();
connectDB();

app.use(express.json());

app.use('/api',userRouter);
app.use('/api',authRouter);
app.use('/api',postRouter);

app.listen(PORT, () => {
    console.log(`Server started on port ${PORT}`);
  });
 
  module.exports = app;

Best Practices and Tips For Building API

Building an API requires detailed planning and commitment to best practices by developers to make it more secure, user-friendly, and structured. Here are some of the best practices tips followed by the developers working in the software industry during API development:

  1. Follow RESTful Principles: Today REST(Representational State Transfer) principles are followed by the software industry. So, design your API that follows REST principles. Also, use clear and meaningful resource naming and responses should have suitable status codes.
  2. Use Versioning: if you implement versioning from the start, then it will allow you to make necessary changes and add new features without breaking existing API integration.
  3. Add Authentication and Authorization: it is easy to understand that giving access to your data and functionalities to anonymous users can be harmful. So, implementing strong authentication for secure access to your API is recommended, and based on the user role, access should be authorized.
  4. Error Handling and Status Code: To make a smooth user experience with your API use proper HTTP status code for the success and failure of requests. Implement proper Error handling to give meaningful and understandable error messages and error codes to help developers.
  5. Testing and Improving your API: Test your API regularly to fix any issue and implement the necessary changes to improve it. You can conduct load testing and performance testing to test your API.
  6. Analyze API Usage: Monitor your API by implementing the necessary mechanism to track performance, errors, and API usage. Collect this data and analyze that to gain insights to improve your API.
  7. Scalability of API: Design your API in such a way that if demand increases in the future then you can scale your API such that it can handle increasing traffic along with good performance.
  8. Create Documentation: Provide complete and clear documentation for your API. Explain the endpoints request and response format, authentication required, and any other important information guideline which is required to use your API effectively and efficiently.

Hence, these are some of the tips which you can follow to build a scalable, secure, and developer-friendly API.

Conclusion

In this article, we have learned how APIs are very useful for developers to build large scalable systems. We have built a social_media API from scratch and did some CRUD operations on the MongoDB database lastly, we saw some best practices to build good APIs.


Next Article
Budget Tracking App with Node.js and Express.js

H

harshintotfv
Improve
Article Tags :
  • GBlog
  • Project
  • Web Technologies
  • Node.js
  • Node.js - Projects

Similar Reads

    AI and Machine Learning

    • AI Whatsapp Bot using NodeJS, Whatsapp-WebJS And Gemini AI
      This WhatsApp bot is powered by Gemini AI API, where you can chat with this AI bot and get the desired result from the Gemini AI model. This bot can be used in groups or personal chats and only needs to be authenticated using the mobile WhatsApp app. Output Preview: Let us have a look at how the fin
      4 min read

    • AI-Powered Chatbot Platform with Node and Express.js
      An AI Powered Chatbot using NodeJS and ExpressJS can be created using the free OpenAI's API Key that is provided for every user login. This article covers a basic syntax of how we can use ES6 (EcmaScript Version 6) to implement the functionalities of Node.js and Express.js including the use of REST
      4 min read

    • Book Recommendation System using Node and Express.js
      The Book Recommendation System aims to enhance the user's reading experience by suggesting books tailored to their interests and preferences. Leveraging the power of machine learning and natural language processing, the system will analyze user inputs and recommend relevant books from a database. In
      4 min read

    • Movie Recommendation System with Node and Express.js
      Building a movie recommendation system with Node and Express will help you create personalized suggestions and recommendations according to the genre you selected. To generate the recommendation OpenAI API is used. In this article, you will see the step-wise guide to build a Movie recommendation sys
      3 min read

    Web and API Development

    • How to build Node.js Blog API ?
      In this article, we are going to create a blog API using Node.js. A Blog API is an API by which users can fetch blogs, write blogs to the server, delete blogs, and even filter blogs with various parameters. Functionalities: Fetch BlogsCreate BlogsDelete BlogsFilter BlogsApproach: In this project, we
      5 min read

    • RESTful Blogging API with Node and Express.js
      Blogs Websites have become very popular nowadays for sharing your thoughts among the users over internet. In this article, you will be guided through creating a Restful API for the Blogging website with the help of Node, Express, and MongoDB. Prerequisites:Node JS & NPMExpress JSMongoDBApproach
      6 min read

    • Build a Social Media REST API Using Node.js: A Complete Guide
      Developers build an API(Application Programming Interface) that allows other systems to interact with their Application’s functionalities and data. In simple words, API is a set of protocols, rules, and tools that allow different software applications to access allowed functionalities, and data and
      15+ min read

    Finance and Budgeting

    • Budget Tracking App with Node.js and Express.js
      In this article, we’ll walk through the step-by-step process of creating a Budget Tracking App with Node.js and Express.js. This application will provide users with the ability to track their income, expenses, and budgets. It will allow users to add, delete, and view their income and expenses, as we
      15 min read

    • Razorpay Payment Integration using Node.js
      Payment gateway is a technology that provides online solutions for money-related transactions, it can be thought of as a middle channel for e-commerce or any online business, which can be used to make payments and receive payments for any purpose. Sample Problem Statement: This is a simple HTML page
      15 min read

    Communication and Social Platforms

    • How to Create a Chat App Using socket.io in NodeJS?
      Socket.io is a JavaScript library that enables real-time, bidirectional, event-based communication between the client and server. It works on top of WebSocket but provides additional features like automatic reconnection, broadcasting, and fallback options. What We Are Going to Create?In this article
      5 min read

    • How to make a video call app in node.js ?
      For making a video call app, It is required that each and every client send their video and audio stream to all the other clients. So for this purpose we are using Peer.js and for the communication between the clients and the server we are using WebSocket i.e. Socket.io. Prerequisite: 1. Node.js: It
      5 min read

    Health and Medical

    • Health Tracker App Backend Using Node and Express.js
      A Health Tracker App is a platform that allows users to log and monitor various data of their health and fitness. In this article, we are going to develop a Health Tracker App with Node.js and Express.js. that allows users to track their health-related activities such as exercise, meals, water intak
      4 min read

    • Hospital Appointment System using Express
      Hospital Appointment System project using Express and MongoDB contains various endpoints that will help to manage hospital appointments. In this project, there is an appointment endpoint for user management and appointment management. API will be able to register users, authenticate users, book appo
      12 min read

    • Covid-19 cases update using Cheerio Library
      In this article we are going to learn about that how can we get the common information from the covid website i.e Total Cases, Recovered, and Deaths using the concept of scraping with help of JavaScript Library. Library Requirements and installation: There are two libraries that are required to scra
      3 min read

    Management Systems

    • Customer Relationship Management (CRM) System with Node.js and Express.js
      CRM systems are important tools for businesses to manage their customer interactions, both with existing and potential clients. In this article, we will demonstrate how to create a CRM system using Node.js and Express. We will cover the key functionalities, prerequisites, approach, and steps require
      15+ min read

    • Library Management Application Backend
      Library Management System backend using Express and MongoDB contains various endpoints that will help to manage library users and work with library data. The application will provide an endpoint for user management. API will be able to register users, authenticate users, borrow books, return books,
      10 min read

    • How to Build Library Management System Using NodeJS?
      A Library Management System is an essential application for managing books, users, and transactions in a library. It involves adding, removing, updating, and viewing books and managing users. In this article, we will walk through how to build a simple Library Management System using NodeJS. What We
      6 min read

    • Student Management System using Express.js and EJS Templating Engine
      In this article, we build a student management student which will have features like adding students to a record, removing students, and updating students. We will be using popular web tools NodeJS, Express JS, and MongoDB for the backend. We will use HTML, CSS, and JavaScript for the front end. We'
      5 min read

    • Subscription Management System with NodeJS and ExpressJS
      In this article, we’ll walk through the step-by-step process of creating a Subscription Management System with NodeJS and ExpressJS. This application will provide users with the ability to subscribe to various plans, manage their subscriptions, and include features like user authentication and autho
      5 min read

    • Building a Toll Road Management System using Node.js
      In this article, we are going to build a simple Toll Road Management System using Node.js, where the data will be stored in a local MongoDB database. Problem Statement: In a toll tax plaza, it is difficult to record all the transactions and store them in a single place, along with that, if required,
      15+ min read

    • How to Build User Management System Using NodeJS?
      A User Management System is an essential application for handling user accounts and information. It involves creating, reading, updating, and deleting user accounts, also known as CRUD operations. In this article, we will walk through how to build a simple User Management System using NodeJS. What W
      6 min read

    • User Management System Backend
      User Management System Backend includes numerous endpoints for performing user-dealing tasks. The backend could be constructed with the use of NodeJS and MongoDB with ExpressJS . The software will offer an endpoint for consumer management. API will be capable of registering, authenticating, and cont
      4 min read

    File and Document Handling

    • Build a document generator with Express using REST API
      In the digital age, the need for dynamic and automated document generation has become increasingly prevalent. Whether you're creating reports, invoices, or any other type of document, having a reliable system in place can streamline your workflow. In this article, we'll explore how to build a Docume
      2 min read

    • DOCX to PDF Converter using Express
      In this article, we are going to create a Document Conversion Application that converts DOCX to PDF. We will follow step by step approach to do it. We also make use of third-party APIs. Prerequisites:Express JS multernpm Preview of the final output: Let us have a look at how the final output will lo
      4 min read

    • How to Send Email using NodeJS?
      Sending emails programmatically is a common requirement in many applications, especially for user notifications, order confirmations, password resets, and newsletters. In this article, we will learn how to build a simple email-sending system using NodeJS. We will use Nodemailer, a popular module for
      5 min read

    • File Sharing Platform with Node.js and Express.js
      In today's digital age, the need for efficient File sharing platforms has become increasingly prevalent. Whether it's sharing documents for collaboration or distributing media files, having a reliable solution can greatly enhance productivity and convenience. In this article, we'll explore how to cr
      4 min read

    • React Single File Upload with Multer and Express.js
      When we want to add functionality for uploading or deleting files, file storage becomes crucial, whether it's for website or personal use. The File Storage project using Express aims to develop a web application that provides users with a secure and efficient way to store and manage their files onli
      5 min read

    Entertainment and Media

    • Music Playlist Manager with Node.js and Express.js
      In this article, we’ll walk through the step-by-step process of creating a Music Playlist Manager with NodeJS and ExpressJS. This application will provide users with the ability to register, log in, create playlists, add tracks to playlists, update playlists, delete playlists, and manage their user
      14 min read

    • Sports Score Tracker with NodeJS and ExpressJS
      In sports, real-time updates and scores are very important for fans so that they can stay engaged and informed. In this tutorial, we'll explore how to build a Sports Score Tracker using Node.js and Express.js. Preview Image: PrerequisitesJavaScriptNode.jsnpmExpress.jsWorking with APIsApproachProject
      4 min read

    Task and Project Management

    • Task Management System using Node and Express.js
      Task Management System is one of the most important tools when you want to organize your tasks. NodeJS and ExpressJS are used in this article to create a REST API for performing all CRUD operations on task. It has two models User and Task. ReactJS and Tailwind CSS are used to create a frontend inter
      15+ min read

    • Task Manager App using Express, React and GraphQL.
      The Task Manager app tool is designed to simplify task management with CRUD operation: creation, deletion, and modification of tasks. Users can easily generate new tasks, remove completed ones, and update task details. In this step-by-step tutorial, you will learn the process of building a Basic Tas
      6 min read

    • Simple Task Manager CLI Using NodeJS
      A Task Manager is a very useful tool to keep track of your tasks, whether it's for personal use or a work-related project. In this article, we will learn how to build a Simple Task Manager CLI (Command Line Interface) application using Node.js. What We Are Going to Create?We will build a CLI task ma
      5 min read

    • Task Scheduling App with Node and Express.js
      Task Scheduling app is an app that can be used to create, update, delete, and view all the tasks created. It is implemented using NodeJS and ExpressJS. The scheduler allows users to add tasks in the cache of the current session, once the app is reloaded the data gets deleted. This can be scaled usin
      4 min read

    • Todo List CLI application using Node.js
      CLI is a very powerful tool for developers. We will be learning how to create a simple Todo List application for command line. We have seen TodoList as a beginner project in web development and android development but a CLI app is something we don't often hear about. Pre-requisites:A recent version
      13 min read

    Real-Time Applications

    • Real Time News Aggregator with NodeJS and ExpressJS
      In this article, we will create a real time news application with the help of NodeJS and ExpressJS. This article consists of several main functionalities. First, we will display the news article. Then we have implemented the search functionality to search news based on the title of the news. Then we
      4 min read

    • Real-Time Auction Platform using Node and Express.js
      The project is a Real-Time Auction Platform developed using Node.js Express.js and MongoDB database for storing details where users can browse different categories of products, view ongoing auctions, bid on items, and manage their accounts. The platform also allows sellers to list their products for
      12 min read

    • Real-Time Polling App with Node and React
      In this article, we’ll walk through the step-by-step process of creating a Real-Time Polling App using NodeJS, ExpressJS, and socket.io. This project will showcase how to set up a web application where users can perform real-time polling. Preview of final output: Let us have a look at how the final
      5 min read

geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences