
Set up the client and server for a React and Next.js app by bootstrapping Next.js, initializing npm, and creating a home page in pages.
Learn to add Bootstrap CSS to a Next.js React app, set up page navigation, and apply global styling with Bootstrap CSS while planning global state with React hooks and useReducer.
Create a bootstrap-styled navigation bar using next/link for seamless client-side routing, plan to extract it into a reusable component, and set up login and registration with Firebase.
Learn to set up a Firebase-based login and registration system within a Next.js project, including creating a Firebase project, obtaining configuration credentials, initializing Firebase, and preparing authentication flows.
Create a global state with useReducer and useContext by building a Context and Provider to store the user, expose dispatch for login and logout, and share user data across components.
Reuse a single form for login and registration, wired to Firebase authentication using email and password, with local context-driven state and post-login routing.
Separate your login and register forms with distinct state for emails and passwords, refactor into a reusable login/register component that receives props, and wire submit handlers to Firebase authentication.
Register a user with email and password using Firebase, then log in to authenticate and access the dashboard. Enable Google login and handle errors with in-app notifications.
Learn to implement global toast notifications for login and register flows in a React Next.js app, including import placement, showing success and error messages with color cues.
Discover how to persist Firebase authentication state in a React app by building a Firebase state component that tracks the user and token and wraps the app.
Enable login with Google using Firebase authentication, then verify the token on the backend to retrieve and save the user, and return the response to the client.
Set up a node server with express to validate Firebase tokens on backend and return user data, using dotenv, mongoose, and nodemon, with cross-origin support for localhost 3000 and 8000.
Learn to build an Express server, create a dynamic endpoint, handle requests with request and response, return JSON, and use PORT from environment variables to run on a port.
learn how to connect a node app to mongodb using atlas or a local installation, create a database user, whitelist ips, and use a connection string with mongoose.
Discover how middleware intercepts requests and responses, use next to continue, and apply app-wide middleware like cors and morgan, then adopt import-export syntax.
Learn to use import/export syntax with ES modules in a production-ready Node.js project, replacing require and refactoring code with imports like mongoose.
Modularize your code by moving routes into a routes folder. Auto load them from that directory, prefix with API, and load each route with require, exporting via module.exports as middleware.
Move business logic into controllers, create a controllers folder, and export a request handler function to manage authentication, token verification, and user data flow between Firebase and the database.
Receive the frontend token in the backend, validate it with the Firebase admin tool, fetch the user data, and synchronize it with our database and context state for login.
Learn to use Firebase Admin in a Node.js server to verify tokens and manage users with a current user endpoint, using Axios to post the token.
Verify the token on the server with admin to retrieve the user, then fetch or create the user in MongoDB by email and return it to the frontend.
Configure axios with public and token-enabled instances and interceptors to auto-attach Firebase tokens to headers for protected routes, using env-based base URL to avoid hard-coded domains.
Implement conditional navigation that shows login or logout based on user state, using React context and Firebase sign-out, with programmatic redirects to the home page after login.
Store the login token in cookies and verify it on the server with getServerSideProps using cookies, protecting pages and redirecting unauthenticated users to login.
Learn to implement a private route with server-side token verification in a React Next.js app, using cookies to verify login, call a backend endpoint, and redirect unauthorized users to login.
Learn to configure environment variables in Next.js to replace hard-coded values, enabling environment-specific API endpoints and token handling for development and production.
Define a Mongoose user schema with name, email, and picture, plus optional seller and stripe data, add timestamps, and save or fetch the user via the current user endpoint.
Save Firebase users to MongoDB by checking email, fetch or create the user, and include name and avatar using Firebase data or a default image.
Implement a find-or-create user middleware that attaches the current user to the request object, enabling protected routes and consistent access across the app, regardless of login state.
Protect routes by moving middleware into a dedicated folder, applying it to private routes, and using server-side redirects to login when no valid current user token is present.
Add a hotel submission link with conditional navigation based on login status and implement a loading spinner for Firebase authentication, enhancing user feedback as you build the marketplace.
Build a reset password page in a React Next.js app using Firebase to send a password reset link via email, integrated with login and registration flows.
Build a password reset flow using Firebase to send a password reset email, protect routes from logged-in users, and redirect to login after reset with loading and toasts.
React Next.js Firebase Node.js MongoDB Ultimate Authentication for Production Apps
Do you want to build a production ready authentication system for your production app
or for all your future projects?
This course has everything you need to build a rock solid authentication using React Node Next.js MongoDB Firebase
I will be using free Firebase authentication to get token and use that to get user info in server side
then use that information to find or create user in our own MongoDB.
This way you use Firebase authentication system but still use your own server with MongoDB for building
MERN Stack / FullStack apps.
This is the best way to build the authentication system without writing your own complicated authentication system
and you never have to worry about adding social login, refreshing the token, forgot and reset passwords,
sending emails and other security issues.
let firebase handle all that for you...
So you can use this project as a base project to start any future MERN stack apps. It has separate frontend
built using React, Next.js and context and reducer hook which will give you a redux like state management.
And it has totally separate API that will validate firebase token and find or create user in MongoDB.
There is not much code in this project, not too many files... so that you can build complex apps on top of this... or even modify the code if needed.
It's built in a flexible way so that you can build any projects in future, without having to write your own complicated login/register system.
Don't waste your valuable time writing incomplete, insecure, half baked authentication system for your future projects. Learn the core concept of building secure apps and use this project as a base project for all your awesome projects starting today. Are you ready for this adventure?