implements user authentication and session management using Express.js, MongoDB, and secure cookies

Overview

Auth-Flow

This project is a simple user authentication system that uses Express.js and MongoDB to store user data. The system allows users to sign up and log in, and it also includes session management and rate limiting to prevent brute-force attacks.

Dependencies

This project uses several dependencies, including:

  • express: A web framework for Node.js
  • mongoose: A MongoDB ORM library
  • body-parser: Middleware for parsing HTTP request bodies
  • cookie-parser: Middleware for parsing HTTP cookies
  • express-session: Middleware for managing sessions
  • express-rate-limit: Middleware for rate limiting HTTP requests
  • morgan: Middleware for logging HTTP requests

Getting Started

To get started with this project, follow these steps:

  1. Clone the repository and navigate to the project directory:
git clone https://github.com/0xAbdoAli/Auth-Flow
  1. Install the dependencies using npm:
npm install
  1. Start the server:
npm run start
  1. Open a web browser and navigate to http://localhost:3000

Usage

The user authentication system includes several endpoints for signing up, logging in, and logging out. Here is an overview of each endpoint:

  • GET /: Redirects to either the login page or the home page, depending on whether the user is logged in.
  • GET /login: Renders the login page.
  • POST /login: Logs in the user and redirects to the home page.
  • POST /logout: Logs out the user and redirects to the login page.
  • GET /home: Renders the home page.
  • GET /signup: Renders the signup page.
  • POST /signup: Signs up the user and redirects to the login page. The system also includes session management to keep users logged in across requests. If a user is not logged in and attempts to access the home page or log out, they will be redirected to the login page.

Security

To improve the security of the user authentication system, several measures have been implemented:

Session management using express-session. HTTP cookies with the httpOnly and secure flags. Rate limiting using express-rate-limit.

You might also like...

This will create a REST API using Express JS and MongoDB removing the hassle of creating everything from scratch.

rest-api-init Fastest way to create REST API with Node.js, Express.js & MongoDB. Prerequisites Node.js needs to be installed. MongoDB Compass needs to

Dec 3, 2022

A full CRUD application built using the MELN(MongoDB,Express,LiquidJS,Node) stack.

A full CRUD application built using the MELN(MongoDB,Express,LiquidJS,Node) stack.

Pokedex Your mission is to be the very best, like no one ever was, at making a Pokémon manager (a Pokédex). Learning Objectives Full CRUD App Prerequi

Sep 23, 2022

A package to enable feature-flag support on Next.js via cookies and environment variables

next-feature-flags Add support for feature flags on Next.js based on cookies + environment variables. How it works It reads from cookies and Next.js's

Aug 10, 2022

Fully undetected stealer (steals wallets, passwords, cookies, modifies discord client like piratestealer etc.)

Fully undetected stealer (steals wallets, passwords, cookies, modifies discord client like piratestealer etc.)

doenerium (CURRENTLY NOT WORKING BECAUSE OF OBFUSCATION; fixing later) Fully undetected stealer (0/67) I obfuscated this to prevent my stuff being ski

Nov 12, 2022

Prefill forms based on URL-parameters, cookies or the sessionStore.

Form prefill plugin for jQuery Built by more onion as a part of Campaignion. Installation import { formPrefill } from "path/to/formprefill.min.js"; No

Sep 6, 2022

Fully undetected grabber (grabs wallets, passwords, cookies, modifies discord client etc.)

Fully undetected grabber (grabs wallets, passwords, cookies, modifies discord client etc.)

⚔️ TurkoRat 🛡️ Telegram server: https://t.me/turcoflex Discord server: https://discord.gg/v6xwtcgrQ5 🌐 〢 Content 📁 Setting up ⚔️ Features 📸 Screen

Dec 20, 2022

A sample code that implements a simple Web app using AWS CDK v2

A sample code that implements a simple Web app using AWS CDK v2

A sample code that implements a simple Web app using AWS CDK v2. This code will be introduced in a live coding session at AWS Summit Online Japan 2022 Developer Zone in 2022/5/25.

Dec 5, 2022

The Frontend of Escobar's Inventory Management System, Employee Management System, Ordering System, and Income & Expense System

The Frontend of Escobar's Inventory Management System, Employee Management System, Ordering System, and Income & Expense System

Usage Create an App # with npx $ npx create-nextron-app my-app --example with-javascript # with yarn $ yarn create nextron-app my-app --example with-

Jan 2, 2023
Owner
Abdelrahman Ali
Backend Developer | Bug Bounty Hunter
Abdelrahman Ali
A Secure Web Proxy. Which is fast, secure, and easy to use.

Socratex A Secure Web Proxy. Which is fast, secure, and easy to use. This project is under active development. Everything may change soon. Socratex ex

Leask Wong 220 Dec 15, 2022
The LMS (Life Management System) is a free tool for personal knowledge management and goal management based on Obsidian.md.

README Documentation | 中文帮助 The LMS (Life Management System) is a tool for personal knowledge management and goal management based on Obsidian.md. It

null 27 Dec 21, 2022
Custom Remix stack using Clerk for authentication and full user management.

New Wave Stack Learn more about Remix Stacks. For more on our thoughts on the New Wave Stack check out our blog post. To view this template in deploym

Charles Wefso 11 Oct 11, 2022
Firebase Angular Skeleton - Quickly create an application with a fully functional authentication, authorization and user management system.

FAngS - Firebase Angular Skeleton FAngS lets you quickly create an application with a fully functional authentication, authorization and user manageme

Ryan Lefebvre 7 Sep 21, 2022
A dockerized express mysql starter using typescript which iclude user management

A dockerized express mysql starter using typescript which iclude user management

Nimatullah Razmjo 2 Jan 26, 2022
A bodacious, secure, headless content management system.

A bodacious, secure, headless content management system. Cassiopeia allows you to create your blog with a customizable interface and comes with a dyna

bear 4 Jan 6, 2023
We are creating a Library that would ensure developers do not reinvent the wheel anymore as far as Authentication is concerned. Developers can easily register and download authentication codes that suits their need at any point.

#AuthWiki Resource Product Documentation Figma Database Schema First Presentation Live Link API Documentation Individual Contributions User Activity U

Zuri Training 17 Dec 2, 2022
Authentication system made with NodeJS and MongoDB.

Auth-API A authentication system made with NodeJS. It's a service where you can register your user, then use the credentials to login . What I used in

Luiz Sanches 8 May 18, 2022
A developer directory built on Next.js and MongoDB Atlas, deployed on Vercel with the Vercel + MongoDB integration.

MongoDB Starter – Developer Directory A developer directory built on Next.js and MongoDB Atlas, deployed on Vercel with the Vercel + MongoDB integrati

Vercel 246 Dec 20, 2022
Mongo Strict is a TypeScript based smart MongoDB ORM, It makes the usage of MongoDB safer, easier and faster with a better performance...

mongo-strict mongo-strict is compatible with mongo >= 5 Mongo Strict is a TypeScript-based smart MongoDB ORM, It makes the usage of MongoDB safer, eas

Mohamed Kamel 4 Sep 22, 2022