
Learn to build a full stack ebook platform with mern: sign up with email links, publish books, sell and read purchases, add to cart, stripe payments, cloud storage.
Install node.js on Windows from nodejs.org with the long-term support version and verify with node -v; npm and npx come bundled.
Install and configure MongoDB on Windows, including the community server and MongoDB compass, to run a local database, view data, and connect via the local URL.
Install VS Code on Windows to streamline project workflows. Download the installer, accept the agreement, and create a desktop shortcut to open folders with VS Code.
Learn how to install TypeScript on Windows, adding type annotations to JavaScript, by globally installing TypeScript via npm and running the install in the terminal.
Learn to install Node.js on macOS by downloading the pre-built installer for the correct macOS version, running it with necessary permissions, and verifying the installation with node -v and npm.
download, install, and launch vscode on macOS, selecting the mac intel option, unzip the zip, and drag vscode into the applications folder for Launchpad access.
Install TypeScript globally on macOS by downloading the installer, running the terminal command with sudo, and verify the install with tsc -v.
Set up GitHub on macOS by using Homebrew to install git. The process may require Xcode command line tools and can take time; verify installation with git version.
Learn to install and run MongoDB on macOS with Homebrew, start the service, and use MongoDB Compass to connect and view data.
Access final code from a GitHub repo and run a React app without building an API, then configure a dot env with MongoDB, maildrop, cloudinary, AWS, and stripe.
Access the course source code via the resources section, learn to download from GitHub, explore commits, and use QnA to get help when you’re stuck.
Explore npm, the node package manager, to install packages like express, initialize projects with npm init and package.json, and learn why using industry tools speeds building a MERN ebook platform.
Initialize your project with npm init using defaults to create package.json in the e-book store server; install express and TypeScript as dev dependencies, and manage dependencies in node_modules.
Install dev dependencies and create tsconfig.json to enable strict type checking, set the root src and dist outputs, and configure path aliases with tsconfig-paths and tsc-alias for the project.
Explore commands and TypeScript workflow by creating an src root directory and index.ts, then use npm run dev and npm run build to transpile to dist and run on node.
Install git on Windows, set up GitHub, and configure git bash with Visual Studio Code as the default editor to securely upload code to a remote server.
Integrate GitHub into your project by initializing git and configuring user details. Create a remote repository, commit changes, and push to origin while ignoring node_modules, dist, and env.
Discover how the server APIs power the frontend UI for an ebook platform, with MongoDB as the database, Express.js routes, and features like cart, reviews, signup, and payments.
Build an express.js server in a TypeScript project by installing @types/express, creating app with express(), setting a port (8989), and defining home and login routes that respond with messages.
Learn to use environment variables with dot env in a node.js server to keep secrets like database URLs, mailtrap credentials, AWS keys, and port numbers separate from the front end.
Discover how to optimize VSCode workflow with prettier, format on save, spell checker, auto rename tag, and React Redux snippets.
learn to implement magic-link authentication in a react front end, send login links via mail trap, verify tokens, and organize scalable MERN routes with a dedicated auth router.
Send a post request to /auth/generate-link to generate an authentication link and email it to the user, implemented in controllers/auth.ts with typed express request and response and a request handler.
Learn to test backend endpoints with postman, send json data in a post request to generate a link, and read request.body using express.json and express.urlencoded.
Learn how middleware functions operate in node.js and express.js, control flow with next(), and apply universal middleware via app.use to parse and handle request.body data.
Use middleware to validate emails in the auth router, applying a regex pattern, returning a 422 error for invalid input before calling the next controller.
Learn to validate input in a MERN stack using a validation library in Node.js/Express by creating a schema, validating email input, and returning structured error responses via middleware.
Design Zod schemas and a reusable middleware to validate incoming data with safe parse, transforming request.body and returning errors or calling next.
Generate a unique token with crypto random bytes and store it securely in MongoDB. Build an auth link with the token and user info, then email and notify.
Connect a Node.js application to MongoDB using mongoose, configure a Mongo URI in an env file, and implement a db connect function to handle local and cloud URIs.
Create a verification token model with Mongoose by defining a user ID, token, and expires fields, then export the model to a models folder.
Define a mongoose user model with name, trimmed unique email, and a role enum of user or author, defaulting to user, enabling verification token generation tied to the user ID.
Create a verification model and securely store a unique token by linking it to a user found or created by email, then hash the token for safe storage.
Hash the verification token with bcrypt using generate salt and compare sync, implement a pre save hook and a compare method on the verification token schema.
Store the generated token in the database and send a verification email using mailtrap and nodemailer. Include a link with the token and user id to the verify endpoint.
Refactor the email sending into a reusable mail utility with node mailer, hide credentials in env vars, and centralize verification mail logic with a transporter for future provider changes.
Learn to handle errors in a MERN stack app by wrapping code in try-catch, sending error responses, and converting controllers into middleware with an error request handler.
Create a middleware-based error handling flow by building an error.ts and an error handler. Integrate express-async-errors to forward errors to the centralized handler via app.use.
Implement a token verification flow in a full stack web development course by creating a verify endpoint and validating token and user id from the query.
Define a verification token doc interface with user id and token, implement a compare method in TypeScript, and cover token validation, user lookup, error handling, and invalidation for MERN.
Learn how authentication works in a MERN app: verify the user via email, generate a JSON Web Token, sign with a secret key, and store it in cookies.
Store the JWT auth token in a cookie with httpOnly, secure, and sameSite settings and a 15-day expiry. Redirect to the front end and return a formatted user profile.
Explore how authorization governs user actions based on roles, enabling normal users to view and update profiles or purchase books while authors manage books, via token-based middleware and profile routes.
Read the auth token from cookies, extract the user id from the jwt payload, and verify the token with the server secret in middleware.
Enable express.json and add cookie-parser in index.ts to read cookies; install and import cookie-parser, add types for cookie-parser, and use app.use(cookieParser()) to access request.cookies for the auth middleware.
Learn token-based authentication in a MERN app by verifying tokens, fetching the user by payload user ID, extending the Express request with user data, and handling 401 unauthorized responses.
Handle JSON web token errors in the error middleware, distinguishing 500 internal server error from 401 unauthorized and returning responses for invalid tokens to protect access to profiles.
Learn to implement a secure logout in a MERN stack app by clearing the auth token cookie, protecting routes with auth middleware, and testing the logout flow via Postman.
Explore uploading files in Next.js using cloud storage, comparing AWS S3 and Cloudinary options, including the free tier and its card requirements, and learn to read incoming files with middleware.
Learn how to read incoming files in an express server using formidable, compare with Multer, install formidable and its types, and implement a file parser middleware.
Read incoming data by parsing form data with formidable, extract fields and files, and populate request.body and request.files through middleware, then test with postman.
Explore updating user profiles with a put route, using a file parser to handle incoming images and data, authenticated access, and avatar management with signed up flow and validation.
Update the authenticated user’s profile by finding the user with request.user.id, updating the name and the signed up property, and returning the updated profile while handling not found errors.
Configure Cloudinary with cloud name, API key, and API secret from .env file, upload an avatar with cloudinary.uploader.upload, and save the secure URL and public ID to the user profile.
Learn how to remove a previous profile image before uploading a new one using Cloudinary, including using the destroy method, updating the avatar, and preparing a reusable upload helper.
Create an aws s3 bucket for public data in a full stack web development project, upload files, enable public access, and configure a bucket policy to allow get object.
Create a new IAM user named ebook admin, assign the S3 full access policy, and demonstrate the user’s access to the bucket while avoiding root account risks.
Learn to upload a user avatar to an aws s3 bucket using the aws sdk, generate a unique file name, and update the user profile with the avatar url.
Remove the previous user avatar from S3 before uploading a new one by issuing a delete object command with the bucket name and user avatar id.
Refactor avatar upload to AWS S3 with put/delete commands, while keeping a Cloudinary path; generate unique file names with slugify and return the avatar id and URL.
Refactor the format user profile method to include an optional avatar URL in the auth middleware and update the helper to send the user avatar URL to the frontend.
Fix avatar upload handling by making the avatar file optional, updating the file parser to allow undefined, and aligning upload and update avatar methods for AWS or Cloudinary.
Register authors by adding an author route in express and wiring the author router to index. Use validation middleware with a new author schema to handle author registration.
Define and implement an author model in mongoose using TypeScript, linking to the user, with slug, about, social links, and books references, and enable timestamps.
Validate an author model in a MERN stack app, enforcing name requirement, about length, and social links as URLs, with TypeScript typing for request bodies.
Infer request body type from a validator schema to enable a custom request handler. Refactor to object schemas and create a type-safe author handler for name, about, and social links.
Register a new author only after the user is signed up; capture name, generate a unique slug from the name and id, and save the author linked to the user.
Add an optional author id to the user model as an object id, reference it when creating an author, and update the user profile to set the role to author.
Learn to build an author details route in a MERN app using a slug param, query the author model, handle not found, and return id, name, about, and social links.
Create book model in a MERN app, with author as an objectId reference and fields like title, slug, language, published at, genre, price (mrp and sale), cover, and file info.
Leverage a TypeScript interface to Java schema conversion to build a book schema with title, slug, description, language, genre, publication name, and trimmed validations with custom required and invalid messages.
Learn to handle complex data validation in a MERN ebook platform, using json stringify for form data, json parse, and layered validation for price, MRP, sale price, and date fields.
Validate a file info object with name, size, and type, stringify its value, apply detailed error messages for missing or invalid fields, and align with book creation routes and types.
Create an express book router with a create route requiring authentication and author, apply file parsing and validation against a new book schema, and implement the create new book controller.
Learn to create a new book by destructuring request data, enriching a book document with title, description, genre, language, and file info, then generate a unique slug and save.
Upload book covers to Cloudinary using a dedicated asynchronous function, handling single file inputs, returning the public ID and secure URL to store with the book.
Learn to serve epub files from a node.js API without aws by storing them in a books folder and exposing them at /books with express.static and path joins.
Upload files to a Node.js app using formidable, configure upload directory, handle form data, ensure unique file names, and store them in the database for ebook access.
Upload and save a book file to a local directory, creating a books folder, generating a unique epub file name, validating mime type, and handling invalid uploads.
Refactor the book upload flow to save files in a local directory, generate a unique file id and url, and update the book and author records.
Demonstrates uploading a book cover to aws s3, including handling cover types, creating a putObjectCommand, uploading to a book public bucket, and generating a public url via a helper function.
Identify and fix image upload validation issues in a MERN ebook platform, ensuring mime type checks, slugify file names, and correct cloud storage bucket usage for book covers.
Refactor the AWS cover upload by introducing upload_book_to_aws with file path and unique file name, updating cover info, and comparing server-side versus alternative upload methods.
Generate a time-limited signed URL on the server to let the front end upload files directly to AWS, bypassing the server and protecting secret keys.
Generate a signed upload URL for front-end data by building a PutObjectCommand with bucket, a unique key, and content type, then obtain the signed URL using the getSignedUrl function.
Create a private S3 bucket for ebooks, set up environment variables and permissions, and generate a file upload URL to upload epub files from the front end to AWS.
Create a new book with AWS by configuring and saving data (title, description, genre, language) and uploading a cover and epub. Validate routes and test with Postman.
Fix access errors by using env-based AWS public bucket URLs and push the new book ID into the books array of the author.
Implement a refactor that adds an upload method enum to support AWS or local uploads, validates the input, and branches the code path accordingly.
Update books via a patch request to the book endpoint, enforcing authentication and author checks, with optional file updates and a shared update schema using slug validation.
Update a book by finding it with its slug and author, then update title, description, language, publication name, genre, published at, and prize, handling file or cover changes.
Learn how to upload and update a book file in local storage, remove the previous file, and manage file paths with slug and id.
Update ebook covers and files using a local upload method with Cloudinary, validating mime types, removing old covers, and updating file info and size for seamless book updates.
Update AWS files by deleting the old S3 object, generating a signed url for a new epub file, and validating mime type using the book id and title.
Learn how to update a book cover using AWS by removing the old cover from the cloud, uploading a new one with a unique file name, and saving the changes.
Explain uploading files to local or AWS storage, updating a front end variable, and sending a response, with guidance on when to skip AWS steps.
Create and export a new review router with a post route guarded by authentication. Implement middleware to verify book purchase and apply data validation before adding the review.
Create a review model by defining a review document with user object ID, book object ID, a rating number, and optional content, using mongoose references and timestamps.
Learn to implement a review validator in a MERN app, defining a Joi schema for rating (1-5), optional content, and a bookId with ObjectId validation and custom errors.
Destructure request body to extract book id, rating, and content; upsert a review by book and user, returning updates, with auth and purchase verification to prevent spam.
Implement a purchased-by-user check in a MERN ebook platform by extending the user model with a books array of object ids and a middleware to validate access.
Set up a get review route on review router to fetch a book's review by id (authenticated) and return content and rating, with 404 not found and 422 invalid id.
Learn how to generate, export, and import multiple book reviews as JSON, ensure timestamps, and compute and store the average rating for a book in a MERN app.
Explore MongoDB aggregation by building a pipeline of stages, such as match, project, lookup, and group, to compute total ratings and prep for calculating the average rating.
Learn to compute and format the average rating for books in a MERN app using MongoDB aggregation, updating the book model, and returning a precise value such as 3.3.
Design and implement a history model in a mern ebook platform to store each reader’s last location, selection highlights with fill color, and associated book.
Develop the history router and history model to handle post requests for creating and updating book history, ensuring user authentication and that the history is purchased by the user.
Validate and update user reading history by verifying the book id, optional last location and highlights, and enforce a history schema with highlight selections and colors.
Update or create user history by handling book highlights and last location, linking history to the book and reader, and saving the changes as a unified history record.
Fix type errors by updating the history route to use book ID in the request body. Update the validation, controller, and model to use book ID and show missing books.
Learn how to update the history by removing highlights with a filter-based approach, validate a mandatory remove boolean, and update the history in the controller.
Create a secured route to read a user's authenticated, stored book history by dynamic book id, validating the id and returning a formatted last location with highlights as json.
Unlock the power of full-stack development with our comprehensive course, "MERN Master Stack - Build E-Book Selling/Reading Platform." This course is designed to guide you through building a feature-rich e-book platform using the MERN stack. Whether you're an aspiring web developer or an experienced programmer, you'll gain hands-on experience and valuable skills to master both front-end and back-end development.
Tools Used In This Course: Node JS, Express, TypeScript, MongoDB (Mongoose), AWS, Cloudinary, Mailtrap, Stripe, React, Redux ToolKit, Tailwind CSS, Next UI, TipTap etc.
What You'll Learn:
Complete MERN Stack Mastery: From MongoDB to Express.js, React, and Node.js, you'll dive deep into each technology, mastering the essentials of full-stack development.
User and Author Registration: Learn to implement robust password less role based authentication and authorization features, allowing users to register as either normal users or authors.
Dynamic User Interface: Create a beautiful, responsive UI using React and Tailwind CSS. Enable users to browse the catalog seamlessly and discover new e-books.
Author Capabilities: Teach authors how to manage their books, including uploading new content, updating existing books, and handling other essential tasks.
Book Management: Discover how to upload and manage books, either through AWS or directly via Node.js for those without an AWS account.
Purchasing and Reviews: Implement secure checkout and payment processing using Stripe. Enable users to purchase books, leave reviews, and rate content.
Personalized Recommendations: Leverage MongoDB aggregation to generate personalized book recommendations based on user reviews and preferences.
Reading Experience: Allow users to read purchased books within the React app, with features like saving highlights, tracking the last page visited, and maintaining a reading history for a seamless experience.
Magic Link Email Notifications: Learn to send magic links to users' registered emails using industry-standard tools. These links provide a seamless login experience and can be utilized for various purposes, such as passwordless authentication and account verification.
By the end of this course, you'll have built a fully functional e-book platform and gained the skills needed to tackle any web development project. You'll understand how to integrate front-end and back-end technologies seamlessly, manage databases, handle authentication and authorization, and much more.
Join us and become a MERN stack master, ready to take on the world of web development!