Releases: vishalnagda1/mern-jwt-auth
Releases · vishalnagda1/mern-jwt-auth
MERN JWT Auth
MERN JWT Auth Backend
MERN JWT Auth is a fully MERN application. In this version we have implement the frontend of the application using React.
Release Notes:
- Set up the frontend using
create-react-app
- Created static
components
for the Navbar, Landing, Login and Register pages - Setup
Redux
for global state management - Link
Redux
to with the components - Display errors from our backend in the
React
forms - Create protected routes (pages only certain users can access based on their authentication)
- Keep a user logged when they refresh or leave the page (in other words, until they either logout or the
jwt
expires)
Installed Packages:
- Install axios because it is promise based HTTP client for making requests to our backend.
- Install classnames package as it is used for conditional classes in our JSX.
- Install jwt-decode package as it is used to decode our JWT so we can get user data from it.
- Install react-redux package as it allows us to use Redux with React.
- Install react-router-dom package and it is used for routing purposes.
- Install redux package as it is used to manage state between components.
- Install redux-thunk package because it is a middleware for Redux that allows us to directly access the dispatch method to make asynchronous calls from our actions.
MERN JWT Auth Backend
MERN JWT Auth Backend
MERN JWT Auth Backend
Release Notes:
- Initialized the application using
npm
and installed necessary packages - Set up a MongoDB database
- Set up a server with
Node.js
andExpress
- Created a database schema to define a
User
for registration and login purposes - Implement the
user registration
API. - Implement the
user login
API. - Set up three API routes,
register
,login
, andcurrentuser
usingpassport
+jsonwebtoken
s for authentication andvalidator
for input validation
Installed Packages:
- Install bcryptjs package to hash passwords before we store them in our database.
- Install body-parser to parse incoming request bodies in a middleware.
- Install concurrently to allows us to run our backend and frontend concurrently and on different ports.
- Install express so on top of Node it make the routing, request handling, and responding easier to write.
- Install is-empty as global function that will come in handy when we use validator.
- Install jsonwebtoken for authorization.
- Install mongoose to interact with MongoDB.
- Install passport to authenticate requests, which it does through an extensible set of plugins known as strategies.
- Install passport-jwt so passport strategy for authenticating with a JSON Web Token (JWT); lets you authenticate endpoints using a JWT.
- Install validator to validate inputs (e.g. check for valid email format, confirming passwords match).
- Install nodemon as dev dependency to track changes and restart the server.
Future Implementations:
- Implementation of React client app.
- Integration of redux for state management.
- Integration of Backend APIs in the react client.