https://github.com/bezkoder/node-js-express-login-mongodb
Login and Registration example with Node.js Express and MongoDB using Mongoose, JWT, HTTP Cookies
https://github.com/bezkoder/node-js-express-login-mongodb
authentication authorization express express-js expressjs login mongodb mongodb-database mongoose node node-js nodejs rest-api
Last synced: 2 months ago
JSON representation
Login and Registration example with Node.js Express and MongoDB using Mongoose, JWT, HTTP Cookies
- Host: GitHub
- URL: https://github.com/bezkoder/node-js-express-login-mongodb
- Owner: bezkoder
- Created: 2021-12-10T05:23:28.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-04T08:31:17.000Z (almost 2 years ago)
- Last Synced: 2025-06-22T18:09:01.246Z (6 months ago)
- Topics: authentication, authorization, express, express-js, expressjs, login, mongodb, mongodb-database, mongoose, node, node-js, nodejs, rest-api
- Language: JavaScript
- Homepage:
- Size: 34.2 KB
- Stars: 62
- Watchers: 4
- Forks: 46
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js Express Login and Registration example with MongoDB and JWT
- Appropriate Flow for User Login and Registration with JWT and Cookies
- Node.js Express Architecture with CORS, Authentication & Authorization middlewares & Sequelize
- How to configure Express routes to work with JWT
- How to define Data Models and association for Authentication and Authorization
- Way to use Sequelize to interact with MySQL Database
## User Registration, User Login and Authorization process.
The diagram shows flow of how we implement User Registration, User Login and Authorization process.

For more detail, please visit:
> [Node.js Express Login and Registration example with MongoDB and JWT](https://www.bezkoder.com/node-js-express-login-mongodb/)
Working with Front-end:
> [Angular 12](https://www.bezkoder.com/angular-12-jwt-auth-httponly-cookie/) / [Angular 13](https://www.bezkoder.com/angular-13-jwt-auth-httponly-cookie/) / [Angular 14](https://www.bezkoder.com/angular-14-jwt-auth/) / [Angular 15](https://www.bezkoder.com/angular-15-jwt-auth/) / [Angular 16](https://www.bezkoder.com/angular-16-jwt-auth/) / [Angular 17](https://www.bezkoder.com/angular-17-jwt-auth/)
> [React](https://www.bezkoder.com/react-login-example-jwt-hooks/) / [React Redux](https://www.bezkoder.com/redux-toolkit-auth/)
## More Practice:
> [Node.js, Express & MongoDb: Build a CRUD Rest Api example](https://www.bezkoder.com/node-express-mongodb-crud-rest-api/)
> [Server side Pagination in Node.js with MongoDB and Mongoose](https://www.bezkoder.com/node-js-mongodb-pagination/)
> [Node.js Express File Upload Rest API example](https://www.bezkoder.com/node-js-express-file-upload/)
> [Node.js + MongoDB: User Authentication & Authorization with JWT (using HTTP headers)](https://www.bezkoder.com/node-js-mongodb-auth-jwt/)
Associations:
> [MongoDB One-to-One relationship tutorial with Mongoose examples](https://www.bezkoder.com/mongoose-one-to-one-relationship-example/)
> [MongoDB One-to-Many Relationship tutorial with Mongoose examples](https://www.bezkoder.com/mongoose-one-to-many-relationship/)
> [MongoDB Many-to-Many Relationship with Mongoose examples](https://www.bezkoder.com/mongodb-many-to-many-mongoose/)
Fullstack:
> [Vue.js + Node.js + Express + MongoDB example](https://www.bezkoder.com/vue-node-express-mongodb-mevn-crud/)
> [Angular 8 + Node.js + Express + MongoDB example](https://www.bezkoder.com/angular-mongodb-node-express/)
> [Angular 10 + Node.js + Express + MongoDB example](https://www.bezkoder.com/angular-10-mongodb-node-express/)
> [Angular 11 + Node.js + Express + MongoDB example](https://www.bezkoder.com/angular-11-mongodb-node-js-express/)
> [Angular 12 + Node.js + Express + MongoDB example](https://www.bezkoder.com/angular-12-mongodb-node-js-express/)
> [Angular 13 + Node.js + Express + MongoDB example](https://www.bezkoder.com/mean-stack-crud-example-angular-13/)
> [Angular 14 + Node.js + Express + MongoDB example](https://www.bezkoder.com/mean-stack-crud-example-angular-14/)
> [Angular 15 + Node.js + Express + MongoDB example](https://www.bezkoder.com/angular-15-node-js-express-mongodb/)
> [Angular 16 + Node.js + Express + MongoDB example](https://www.bezkoder.com/angular-16-node-js-express-mongodb/)
> [Angular 17 + Node.js + Express + MongoDB example](https://www.bezkoder.com/angular-17-node-js-express-mongodb/)
> [React + Node.js + Express + MongoDB example](https://www.bezkoder.com/react-node-express-mongodb-mern-stack/)
Integration on same Server/Port:
> [Integrate Vue with Node.js Express](https://www.bezkoder.com/serve-vue-app-express/)
> [Integrate Angular with Node.js Express](https://www.bezkoder.com/integrate-angular-12-node-js/)
> [Integrate React with Node.js Express](https://www.bezkoder.com/integrate-react-express-same-server-port/)
## Project setup
```
npm install
```
### Run
```
node server.js
```