Posted on Leave a comment

HRM application built using React, Node.js, and MongoDB

Here is a basic HRM application built using React, Node.js, and MongoDB.

  1. Frontend (React):
import React, { useState, useEffect } from 'react';
import axios from 'axios';

function App() {
  const [employees, setEmployees] = useState([]);
  useEffect(() => {
      .then(res => {
      .catch(err => {
  }, []);

  return (
      <h1>Employee List</h1>
          { => (
            <tr key={employee._id}>

export default App;

2- Backend (Node.js + Express + MongoDB):

const express = require('express');
const mongoose = require('mongoose');

const app = express();

mongoose.connect('mongodb://localhost:27017/hrm', {
  useNewUrlParser: true,
  useUnifiedTopology: true

const employeeSchema = new mongoose.Schema({
  name: String,
  age: Number,
  designation: String

const Employee = mongoose.model('Employee', employeeSchema);

app.get('/employees', (req, res) => {
  Employee.find({}, (err, employees) => {
    if (err) {
    } else {

app.listen(4000, () => {
  console.log('Server started on http://localhost:4000');

This is a very basic HRM application and can be enhanced further as per the requirements.

Posted on Leave a comment

How do I create a login and signup page in react JS and node js with mongodb?

To implement a login and signup system with authentication in React and Node.js using MongoDB, you can follow these steps:

  1. Set up a MongoDB database and connect to it in Node.js using the Mongoose library.
  2. Create the schema for your user collection, including fields such as username, email, password, and any other relevant information.
  3. Implement the signup endpoint in Node.js that allows users to create an account. You should hash the password and store it securely in the database.
  4. Implement the login endpoint in Node.js that authenticates a user based on their email and password. You should compare the hashed password stored in the database to the hashed password sent by the client.
  5. In React, create a form for users to sign up and another form for users to log in.
  6. Use Axios or another HTTP client to send API requests to your Node.js server for authentication.
  7. Implement client-side authentication with JSON Web Tokens (JWT) and store the JWT in local storage.
  8. In Node.js, use the JWT to authenticate requests and ensure that only logged-in users can access protected endpoints.

These are the basic steps to create a login and signup system with authentication in React and Node.js using MongoDB. There are many ways to improve and extend this system, but this should give you a good starting point.

Posted on Leave a comment

Advantages of MongoDB and Mongoose

Let’s now take a look at the advantages of both the databases – MongoDB vs Mongoose.


  • Flexible schemas
  • Holds huge amounts of data
  • Easy to scale and change-friendly
  • Schema less because it allows to store different documents in one collection
  • Powerful, dynamic, and deep query


  • Chained functions making code flexible and readable
  • Eliminates the need to use named collections
  • Performs bulk tasks of incorporating default values for properties and data validations
  • Easier to define schema
  • Features likes type casting, data validation, query building and more
Posted on Leave a comment

What is a Database Management System (DBMS)?

To understand what a DBMS or a database management system is, we must understand what a database is. A database is nothing but an organized collection of structured data or information that is generally stored in a computer.

A database usually interacts with a database management system (DBMS) to let the user control and manage the data stored in it. A DBMS is nothing but software or interface that allows complete control over the data such as creating, reading, editing, deleting, etc. It also facilitates access control systems and other services like backups, reporting, storage, security, and more.

Posted on Leave a comment

Difference Between MongoDB and Mongoose: Synopsis

Just like any other comparison guide, this one on the difference between MongoDB vs Mongoose begins with a crisp synopsis.


MongoDB is a document-oriented database management system that stores data in the form of BSON documents. It is a NoSQL also known as a Not-only SQL type database allowing users to store gigantic amounts of data. Unlike SQL databases where data is stored in the form of tables, a NoSQL database stores data efficiently as documents inside collections.

The MongoDB database management service is developed and managed by MongoDB Inc. It was first launched in the February of 2009 and is currently managed under SSPL (Server-Side Public License).

MongoDB is recognized by developers worldwide not only because of the efficiency and smoothness it provides when handling data, but also because of its driver support for popular languages like Nodejs, PHP, Java, Go, .Net, C, C++, Python, Ruby Scala, C#, Perl, Swift, Motor, and Mongoid.

Top firms like Facebook, Google, Adobe, Nokia, and many others have chosen MongoDB as their DBMS.


Mongoose is an ODM or Object Document Mapper. It is also referred to as an Object Modelling Tool. It is built on top of the MongoDB driver for MongoDB and Node.js. It helps developers to model their data, define the schema for documents inside a collection, and manage relationships between data.

Mongoose allows users to conveniently create and manage data in MongoDB. While it is possible to manage data, define schemas, etc. using MongoDB APIs, it is quite difficult to do so. Hence, Mongoose has made lives easier.

However, if our collection holds an unpredictable schema for the documents, MongoDB driver is then the simplest option to choose.

Now that we have seen quite a decent synopsis of the difference between MongoDB and Mongoose, let us understand what they do at their core. To do this, we will need to understand what a database management system is to understand MongoDB, and what an Object Document Mapper (ODM) is for Mongoose.