Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rugvedb/mern-boilerplate

MERN stack boilerplate with store implemented using useReducer + useContext api
https://github.com/rugvedb/mern-boilerplate

authentication boilerplate higher-order-component jsonwebtoken mongodb node-js nodejs react-hooks react-js store usecontext usereducer

Last synced: 3 days ago
JSON representation

MERN stack boilerplate with store implemented using useReducer + useContext api

Awesome Lists containing this project

README

        

MERN-Boilerplate

[![](https://img.shields.io/badge/Made_with-Nodejs-green?style=for-the-badge&logo=node.js)](https://nodejs.org/en/)
[![](https://img.shields.io/badge/Made_with-ReactJS-blue?style=for-the-badge&logo=react)](https://reactjs.org/docs/getting-started.html)
[![](https://img.shields.io/badge/Database-MongoDB-red?style=for-the-badge&logo=mongodb)](mongodb.com "MongoDB")

### Features

- This boilerplate contains react hooks components, higher order components ,mail verification (sign up ,password reset) ,login ,sample secured and open routes.
- No user with non existing mail id will have access to secured routes.
- No need to use complex redux boiler plate for creating store.
- Store is implemented using useRedux + useContext.
- Ready to use for any MERN stack project.
- Responsive.
- Error handled with proper actions(Eg redirect to login page when trying to access authenticated pages).

------------------------------------------
### Demo



------------------------------------------
### Tech stack
`Backend` : NodeJS

`Database` : MongoDB

`Frontend` : ReactJS

------------------------------------------
### Installation

Clone the repository and install node modules
```
git clone https://github.com/RugvedB/MERN-Boilerplate.git
cd MERN-Boilerplate/
cd client
npm i
cd ../backend
npm i
```
Now create .env file
```
touch .env
```

Fill .env with relevant information as follows
```
PORT=8000
mongoURI= ENTER YOUR MONGOURI HERE
server_base_url=http://localhost:8000
mail_id= ENTER YOUR MAIL ID FROM WHICH VERIFICATION,PASSWORD RESET MAIL WILL BE SENT.
mail_pass= ENTER PASSWORD OF YOUR MAIL ID
SECRET_KEY= somerandomcomplexstring
```

Now we can start the backend server by using the following command
```
node index.js
```

To start frontend server go to root directory and follow the steps(on a new terminal)
```
cd client
npm start
```

Checkout the site on http://localhost:3000/register

------------------------------------------

Developed with :heart: by Rugved