
Already know some of this? A 2-minute test skips the lessons you know.
Take the placement testA free 26-lesson course built from Dave Gray's 7h 51m of YouTube video. 5 days at 90 minutes a day, with study notes and a quiz in every lesson. A 2-minute placement test skips what you already know.
Taught by Dave Gray on YouTube. Videos play in YouTube's own player, so the creator keeps every view.
Understand the MERN stack components, full-stack architecture, REST API basics, CRUD operations, and set up the backend project with Node.js, Express, and Nodemon.
Configure the Express server with static file serving, routing for the root and index pages, and a 404 error handler for unmatched routes.
Learn about built-in, custom, and third-party middleware; create a custom async logger middleware using date-fns, uuid, and fs.promises to log requests with timestamps and UUIDs.
Build a custom error-handling middleware to log errors and send appropriate responses; configure CORS with allowed origins and credentials for cross-origin requests.
Use dotenv to manage environment variables, create a MongoDB Atlas account, set up a free cluster, create a database user, and obtain a connection string for the TechNotesDB database.
Define Mongoose schemas and models for User (username, hashed password, roles array, active status) and Note (user reference, title, text, completed status, timestamps) with proper data types and references.
Implement the user controller with full CRUD logic: create (with bcrypt hashing), read (with lean/exec), update (with duplicate username check and optional password re-hash), and delete (preventing deletion if notes are assigned).
Test all user endpoints (GET, POST, PATCH, DELETE) using Postman, verify error handling for missing fields, duplicates, malformed JSON, and confirm async error handler integration.
Initialize the React frontend with Vite, configure React Router for public (home, login) and protected (dash) routes, and set up a feature-based folder structure (auth, notes, users).
Create the protected dash layout with header, footer, and outlet; install Font Awesome React packages and add a home navigation button to the footer.
Build the welcome page with formatted date and navigation links; create a prefetch component to manually subscribe to notes and users queries on protected routes for instant data access.
Develop NotesList and UsersList components using RTK Query hooks (useGetNotesQuery, useGetUsersQuery) and entity adapters; implement sorting (open notes first) and grid-styled tables with edit actions.
Create controlled form components for new user, edit user (with active toggle), and delete user; integrate RTK Query mutations (useCreateUserMutation, useUpdateUserMutation, useDeleteUserMutation) with validation and error handling.
Build NewNote and EditNote forms with user assignment dropdown; implement role-based filtering in NotesList so employees see only their notes while managers/admins see all.
Distinguish authentication (verifying identity) from authorization (verifying access); explain JWT access/refresh token flow, HTTP-only secure cookies, and token expiration strategies.
Implement auth controller methods: login (bcrypt compare, issue access/refresh tokens, set HTTP-only cookie), refresh (verify refresh token, issue new access token), logout (clear cookie with same options).
Create verifyJWT middleware to extract and validate Bearer tokens from Authorization header; apply to notes and users routes via router.use to protect all endpoints in those files.
Build the login form with controlled inputs, handleSubmit using try/catch and dispatch(setCredentials); create usePersist hook (localStorage) for 'Trust this device' checkbox to persist login across refreshes.
Create PersistLogin wrapper component that verifies refresh token on mount (if no access token but persist=true), uses useRefreshMutation with extra isTrueSuccess flag to allow credentials time to set, and handles React 18 strict mode double-mount.
Implement role-based UI (show/hide buttons based on isManager/isAdmin), protect routes with RequireAuth component that redirects unauthenticated users to login, and fix error message display with optional chaining.
Fix duplicate username checks with MongoDB collation (locale 'en', strength 2) for case insensitivity; make roles optional in user schema; replace express-async-handler with express-async-errors package applied globally in server.js; add isError:true flag in error handler for RTK Query compatibility.
Move validateStatus inside query objects; replace manual pre-fetch component with RTK Query's built-in prefetch (apiSlice.util.prefetch); add React.memo to Note/User components; fix keepUnusedDataFor defaults; disable React DevTools and Redux DevTools for production.
Push code to GitHub; deploy frontend as static site on Render (build: npm run build, publish: dist); deploy backend as web service (start: npm start); configure environment variables (NODE_VERSION, DB_URI, token secrets); update CORS allowed origins for production domain.