
Explore full-stack authentication and deployment using the MERN stack, including React, Node, Express, and MongoDB. Learn prerequisites like HTML, CSS, and JavaScript, and engage in hands-on authentication with practical scenarios.
Prepare the MERN app backend by installing core dependencies (bcryptjs, config, express, express validator, jest, json web token, mongoose) and development tools (concurrently, nodemon), and configure package.json for server.js.
Create and initialize an Express server in server.js, define a Hello world get route, and configure port handling (including a Heroku port) to deploy the mern stack api.
Create a MongoDB Atlas account and set up a free cloud cluster. Add a database user, enable access via IP whitelist, and prepare to connect your app.
Connect MongoDB Atlas to your app using a config-based mongoose setup, handle errors with try-catch, export a connect DB function, and invoke it from server.js.
build data models with mongoose by creating a user model, defining a user schema with name, email, and password fields, enforcing required fields and unique email.
Build api routes with express router for a mern project, creating api/users with a public get test route and a post route to register users with bcrypt password hashing.
Validate the request body with express validator in the user route, check the validation result for name, email, and password, and return 400 with an errors array when checks fail.
Configure JWT authentication in a MERN app by signing a payload with the user id and a secret, with expiration via config, and returning the token for client use.
Create and apply authentication middleware with JWT, extracting tokens from request headers, validating via config.getJWTSecret, and setting req.user for protected routes.
Learn how to set up unit tests with Jest by converting it from a regular dependency to a development dependency, using npm uninstall and npm install -D.
Prepare dependencies for mern app by installing axios, react-router-dom, redux, and redux devtools. Set up scripts and proxy, then run dev to start client on 3000 and server on 5000.
Create a home page and nav components for a MERN app, clean up the project, and prepare the initial structure for routing and tailwind styling.
Configure React Router 6 to enable navigation between home, login, and register pages, and set up login and register components in app.js with routes for a MERN stack authentication workflow.
Learn to configure registration and login forms in a MERN stack app using React hooks, form state with useState, onChange and onSubmit handlers, and basic password confirmation validation.
Configure a Redux store for a MERN app by creating reducers, wiring a root reducer, applying thunk middleware, and wrapping the app with Provider to enable Redux DevTools debugging.
Implement a MERN authentication flow with reducers and actions, defining reg_pass and reg_fail, updating local storage token, and wiring Redux to manage isAuthenticated, loading, and user.
Configure React user authentication by wiring token validation with the backend, loading user data on app start, and implementing login, logout, and auth state with Redux and axios headers.
Style the home page and navbar in a MERN app using Tailwind CSS, applying full-screen gray backgrounds, flex layouts, and white text with button styling in App.js, Navbar.js, and home.js.
Style the register and login pages in a MERN stack authentication app by applying a bg white class and setting height in register.js.
Deploy a mern application to the cloud using Heroku, create a GitHub repo with gitignore, configure production scripts, and push to master for a live app.
The MERN (Mongo, Express, React, and Node) stack is an excellent choice for building powerful and flexible data-driven web applications. In this 20-video course, leaners will discover how to employ different technologies that make up the MERN stack to build a basic authentication application for full stack development.
Begin by examining key considerations to observe when planning a MERN app, then create a MongoDB Atlas account and a working cluster for a MERN app. Connect to MongoDB Atlas and explore how to handle errors. Learn how to build data models for a MERN app by using MongoDB and Mongoose, validate request body payloads, and configure JWT (JSON Web Token) authentication. Next, you will learn how to create and use middleware, and create unit tests by using the Jest unit testing framework.
Examine how to configure React and Redux and use type checking with PropTypes, and how to manage state by using reducers and actions. The course concludes with a demonstration of deploying a MERN application to Heroku cloud-based platform as a service.
Mastering the MERN stack opens up a world of possibilities for developers to create modern, scalable, and efficient web applications. MongoDB, Express, React, and Node.js work harmoniously together to enable seamless data management, robust backend logic, captivating user interfaces, and high-performance server-side operations. By harnessing the power of the MERN stack, developers can unleash their creativity and build cutting-edge web applications that cater to the demands of today's digital landscape.
Whether you are a seasoned developer or just starting your web development journey, embracing the MERN stack can be a game-changer. Dive into the world of MongoDB, Express, React, and Node.js, and embark on a journey of building modern web applications that will leave a lasting impact.