Sayan-Maity / mern-auth

:closed_lock_with_key: MERN authentication flow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MERN Authentication/Authorization

πŸ” MERN authentication & authorization flow using a simple TODO app!

Using Application

Prerequisites

  1. Clone this repository.
    git clone https://github.com/ABSphreak/mern-auth.git
  2. Install all the dependencies in root & client folder.
    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:
      PORT=6969
      MONGO_URI=mongodb+srv://<user>:<pwd>@<cluster>-onltw.mongodb.net/<collection_name>?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!

About

:closed_lock_with_key: MERN authentication flow

License:MIT License


Languages

Language:JavaScript 93.1%Language:HTML 6.9%