Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/absphreak/mern-auth

:closed_lock_with_key: MERN authentication flow
https://github.com/absphreak/mern-auth

Last synced: about 1 month ago
JSON representation

:closed_lock_with_key: MERN authentication flow

Awesome Lists containing this project

README

        


MERN Authentication/Authorization


:closed_lock_with_key: MERN authentication & authorization flow using a simple TODO app!

## Using Application

### Prerequisites

1. Clone this repository.
```shell
git clone https://github.com/ABSphreak/mern-auth.git
```
2. Install all the dependencies in `root` & `client` folder.
```shell
npm install
cd client
npm install
```
3. Create a `.env` in `root` folder.

These environment variables are required:
- `PORT` → Mention a custom port for running the Express server (default is 5000).
- `MONGO_URI` → Put your MONGO_DB connection string here.
- `JWT_SECRET` → Put anything you like, it will be used for `auth_token` validation.

- Format:
```shell
PORT=6969
MONGO_URI=mongodb+srv://:@-onltw.mongodb.net/?retryWrites=true&w=majority
JWT_SECRET=RandomTextString
```

### Scripts Available

#### ⫸ `root` (backend)

1. `npm run dev` → Runs the server in development mode.
_(Highly recommended if you want to tweak API)_
- Uses `nodemon` to monitor changes to the API.
- Uses `morgan` to log the request data.
2. `npm start` → Runs the server in production mode.
_(Mostly going to be used for deployment to cloud)_

#### ⫸ `client` (frontend)

1. `npm start` → Invokes `react-scripts start`.
2. `npm build` → Invokes `react-scripts build`.
3. `npm test` → Invokes `react-scripts test`.
4. `npm eject` → Invokes `react-scripts eject`.

### Branches

For now there are two ongoing branches:

1. `master` → Has the Bootstrap based client application.
2. `material-ui` → Has MaterialUI based client application.

More info coming soon!