Skip to content

probyto/mern-fullstack-boilerplate

Repository files navigation

MERN JWT Auth

ACKNOWLEDGMENT: This is a public repo obtained from github and it is used only as reference for internal process at probyto. Probyto does not own or claim ownership of this code. The complete credit goes to the owner of the repo (https://github.com/vishalnagda1/mern-jwt-auth.git)

GitHub license Repository version

MERN JWT Auth is a minimal full-stack login/authorization app developed using the MERN stack (MongoDB for our database, Express and Node for our backend, and React for our frontend). Also integrate Redux for state management for our React components.

MERN JWT Auth app will allow users to

  • Register
  • Log in
  • Access protected pages only accessible to logged in users
  • Stay logged in when they close the app or refresh the page
  • Log out

Requirements

Prerequisites

You should have at least a basic understanding of fundamental programming concepts and some experience with introductory HTML/CSS/Javascript. And the knowledge of MERN stack (Mongo, Express, React, Node) is an advantage.

Install

Lastly, make sure you have the following installed.

Getting Started

  1. Either you can clone or download repository from GitHub.

    • Clone with HTTPS (required git installed in your system)

      git clone https://github.com/probyto/mern-fullstack-boilerplate.git
    • Clone with SSH (required git installed in your system)

      git clone git@github.com:probyto/mern-fullstack-boilerplate.git
    • Download Zip

  2. Navigate to project directory in the terminal or command prompt.

    cd mern-jwt-auth
  3. Install project dependencies

    npm i && npm run client-install
  4. Create a keys.js file in config directory

    • If you are using Windows Command Promtp or Powershell

      copy config/keys.sample.js config/keys.js
    • If you using Mac or Linux

      cp config/keys.sample.js config/keys.js

    Note: update keys.js file variables as per the requirements.

  5. Run the project server

    • Run development server (it runs both frontend and backend server together at same time)

      npm run dev
    • Run backend development server

      npm run server
    • Run frontend development server

      npm run client
    • Run production server

      • Build and run the production server

        npm run build-prod

      OR

      • Create build first

        npm run build

        Run the production server

        npm run prod
  6. Project server is running at:

Backend APIs

  1. Register

    • Endpoint - /api/users/register

    • HTTP Method - POST

    • Payload

      {
          "name": "Vishal",
          "email": "test@test.com",
          "password": "test123",
          "password2": "test123"
      }
  2. Login

    • Endpoint - /api/users/login

    • HTTP Method - POST

    • Payload

      {
      	"email": "test@test.com",
      	"password": "test123"
      }

Contributing

  1. Fork it ( https://github.com/probyto/mern-fullstack-boilerplate/fork )
  2. Create your feature branch (git checkout -b <yourname>)
  3. Commit your changes (git commit -am 'Add assigment code')
  4. Push to the branch (git push origin <yourname>)
  5. Create a new pull request.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published