
Learn to build secure, scalable rest APIs for social media apps using node.js and express, covering authentication with JSON web tokens, posts, comments, follows, image uploads, and deployment to AWS.
Learn a basic full stack architecture with a Node.js API on a server, connected to MongoDB, using Express and Validator to handle http requests and user creation.
Set up MongoDB community edition on macOS with brew, install and start the service, and explore Atlas and AWS hosting options for social media applications.
Learn to visualize and manage your MongoDB database with MongoDB Compass, connect to your local MongoDB instance, and explore data through a graphical user interface.
Download and set up Postman to build and test your Node.js social media API, create a collection, add get users, and learn best practices for endpoints, body, and responses.
Install and open Visual Studio Code, the recommended source code editor, and configure themes and extensions including Node.js support to prepare your Node.js advanced backend for social media apps.
Download npm and NodeJS, install npm with npm install, and verify the installed versions using node -v and npm -v to ensure the API backend can run.
Set up the Node.js backend project by creating a folder structure, initializing index.js, and organizing routers, utils, models, middleware, db, and config, with a ready package.json.
Set up a node.js express server by initializing npm and installing express. Start the server and test a basic get request to fetch data from port 8000.
Create and expose a first get request with app.get, returning a text response showing the current time via a test endpoint on your node server.
Hook up your Node.js backend to MongoDB using the Mongoose module, creating a reusable Mongoose client with a connect function that handles errors and confirms database connected successfully.
Define a mongoose user model with username, email, and password validated by validator, trimmed, lowercased, and unique. Hash passwords with bcrypt in a pre-save hook before exporting the model.
Create a user endpoint with express router and mongoose, validate unique username and email, handle errors, save the user, and return the created user without the password.
builds authentication with json web tokens, enabling login, logout, and per-user permissions using a tokens array and a generate auth token method through a login route and user model.
implement the authUser middleware in node.js to verify bearer tokens with JWT, extract the user id, and attach the user to the request before actions like posting or fetching profiles.
Implement a universal api error class and integrate it with the authUser middleware, raising 401 unauthorized errors for missing or invalid tokens and standardizing json responses.
Create a mongoose user post model with a required title, an image field (url storage preferred), a user ObjectId reference, a virtual relation to the user, and export the model.
Create a secured user post route with Express, using the user post model, authenticating with a bearer token, saving new posts to the database, and returning the created post.
Implement a get feed endpoint to fetch all user posts in createdAt descending order, convert them to JSON with a toJSON method, and handle errors.
Implement api error handling in login, wiring an api error with http status codes, enforce max login attempts, handle not found and invalid credentials, and reset attempts on success.
Learn to implement pagination for user posts in a social media feed on a Node.js backend, delivering an unlimited chronological post feed with page, limit, skip, and infinite scroll.
Explore how to upload images directly into a database with multer and sharp, including resizing to 350x350, converting to PNG, and storing the binary data in a user post.
Create a get route to fetch a user post image by id, return the image with a proper content-type header, and handle missing images or errors for seamless client display.
learn to create a comment model and comment router in a node.js backend, linking comments to users and posts with mongoose schemas, likes, timestamps, and token-authenticated posting.
Learn to implement a get comments route in Node.js by fetching post-specific comments using the post ID, handle missing data with 400/404/500 errors, and test with Postman.
Reorganize the api with type-based folders and dedicated validators to improve scalability and routing. Implement Joy-based input validation for user data and modular router configuration.
Implement a Joi-based validate middleware that uses a pick helper to validate request schemas, handle errors, and attach validated data to the request before routing.
Learn to reorganize a Node.js backend by separating login logic from routers with dedicated handlers and validation middleware, using a generic response and a centralized routes file.
Create a user endpoint by implementing a router and handler, use a service to get user by email or username, then save to the database and generate an auth token.
Implement a protected list users endpoint with an auth user middleware, a list users handler and query that returns all users, handling not found errors with an api error.
Fetch multiple users by IDs via a post route, validate the ID array from the body, then return the matching users as JSON under bearer authentication.
builds a new user post structure with a dedicated post route, validator, and handler, secured by auth middleware, to create posts saved to the database.
Create a get route to fetch posts with authentication and a paginated list sorted by creation date from newest to oldest. Implement page and limit handling for pagination.
Learn to fetch a post image by ID via a get request in the post router, with validator and handler logic for not found cases.
Implement the create comment flow by adding the comments model, routes, validators, and handler with auth user and post existence checks, saving and returning the new comment.
Learn to get comments by post using a get request, validate the post id, authenticate the user, and return comments in newest-to-oldest order.
Create a delete comment endpoint in Node.js: validate the comment id, authenticate the user, fetch by id, and perform find one and delete with proper error handling and success response.
This lecture adds a follow feature to the node.js user model, introducing followers and followings arrays. It builds a follow route with authentication, validation, and error handling to update relationships.
Implement the unfollow function by reversing the follow flow: reuse the same validator and handler, switch push to pull, and update both followers and followings lists in the database.
Implement like and unlike post routes in a node.js backend, validating post id and updating the post’s likes array with the authenticated user. Mirror follow logic with robust error handling.
Deploy a Node.js API on AWS EC2, connect to a MongoDB Atlas database, and use PM2 for persistent runs, enabling cloud testing with Postman.
Unlock the secrets of popular social media platforms like Twitter and Facebook in our comprehensive course on API development using Node.js! This extensive course is designed for learners at all levels, from complete beginners to advanced developers looking to enhance their skills.
APIs (Application Programming Interfaces) are crucial for modern web applications, and this course offers you a unique opportunity to understand how major platforms build and manage their APIs. Whether you’re starting with zero knowledge or you have some familiarity with Node.js, this course will guide you through everything you need to know about creating powerful and efficient APIs.
Here's what you'll learn:
Introduction to Node.js: Basics and core modules
API Development: Principles of RESTful and MVC API design
Real-World Examples: Learn how Twitter and Facebook architect their APIs to handle millions of users
Working with Express.js: Simplify your API development
Authentication and Security: Protect your APIs as seen in industry-leading platforms
Data Handling: Manage user data, sessions, and cookies effectively
User Engagement: Techniques for handling notifications, newsfeeds, and real-time data streams
Server-Side Utilities: Image File uploads and Image Editing on Node.js
Database Integration: Using NoSQL database (MongoDB) for robust data management
Deployment and Testing: Deploy and maintain your Node.js applications with confidence using AWS EC2 and MongoDB Atlast
This course not only delves into the theoretical aspects but also engages you in building practical projects that mimic real-world applications like Instagram and Twitter. These projects will utilize all the features discussed, giving you hands-on experience in a realistic setting.
If you’ve ever wondered how top social media platforms manage their backend operations smoothly, this course is for you. From setting up your development environment to deploying and scaling your applications, we cover it all. Join us to transform into a skilled Node.js developer capable of building enterprise-level APIs.