3.94 out of 5
3.94
8 reviews on Udemy

Build Unofficial Udemy clone Application in Next.js v13

A complete guide to build full-stack unofficial Udemy clone web application in Next.js v13 and Prisma
Instructor:
Haider Malik
69 students enrolled
English [Auto]
Routing
Pages and Layout
Linking and Navigation
Loading UI
Error Handling
Rout Handlers
Rendering Fundamentals
Server and Client Components
Static and Dynamic Rendering
Data Fetching
Streaming and Suspense
Generate static Params
API Routes
CSS Modules
Global CSS
React Bootstrap
Images
Deployment
Prisma
CRUD API development with Prisma
Postgres Database integration

The React Framework for the Web

Used by some of the world’s largest companies, Next.js enables you to create full-stack web applications by extending the latest React features and integrating powerful Rust-based JavaScript tooling for the fastest builds.

In this course, You will learn all the latest features of Next.js like app directory, pages, data fetching in a new way.

You will learn these concepts in this course:

  • Client and Server Rendering

  • Nested Routing

  • Data Fetching

  • Built-in Optimization

  • Typescript support

  • API Routes

  • Middlewares

  • Deployment

  • CSS styling

  • Caching

  • Using database

One of the main benefits of Next. js is that it enables server-side rendering. This means the server can generate the HTML for a page and send it to the client, rather than the client generating the HTML using JavaScript. This can improve the performance and SEO of your app.

One of Next.js’s best features is file-based routing. Instead of dealing with complicated route settings in a program like react-router, routes can be specified using the directory project structure. By adding an entry point to the directory page, you can create a new path.

Next.js 13 includes updated file routing with the new directory. The optional app directory introduces a new layout structure as well as several new features and improvements.

The directory structure has undergone minor changes due to the new routing mechanism. Each path in the route has a dedicated directory with a page.js file that serves as the content entry point in Next.js 13.

What’s most exciting about the new version of Next.js is the expanded support for React server components. Server components let us run and render React components on the server side for faster delivery, a smaller JavaScript bundle, and less expensive client-side rendering.

In addition, depending on the kind of data required to generate a route, server components are automatically cached at build-time or runtime for added performance benefits.

Combining server and client components allows you to use server components for fast-loaded, non-interactive parts of your program while using client components for interaction, browser APIs, and other features.

When constructing client components for your Next.js application, you can designate them as such by using the ‘use client’; directive at the top of the file. However, if you utilize any third-party packages, you might need to create a client wrapper.

In addition, Next.js 13 introduces async components, a fresh approach to data collection for server-rendered components. When using async components, we can render systems using Promises using async & await.

Introduction

1
What is Next.js

Next.js is an open-source web development framework created by Vercel enabling React-based web applications with server-side rendering and generating static websites.

2
Next.js Fundamentals source code
3
Getting Setup

Routing

1
File based Routing

The new router works in a new directory named app. The app directory works alongside the pages directory to allow for incremental adoption. This allows you to opt some routes of your application into the new behavior while keeping other routes in the pages directory for previous behavior.

2
Dynamic Route

When you don't know the exact segment names ahead of time and want to create routes from dynamic data, you can use Dynamic Segments that are filled in at request time or prerendered at build time.

A Dynamic Segment can be created by wrapping a folder’s name in square brackets: [folderName]. For example, [id] or [slug].

Dynamic Segments are passed as the params prop to layout, page, route, and generateMetadata functions.


3
Route Groups

The hierarchy of the app folder maps directly to URL paths. However, it’s possible to break out of this pattern by creating a route group. Route groups can be used to:

  • Organize routes without affecting the URL structure.

  • Opting-in specific route segments into a layout.

  • Create multiple root layouts by splitting your application.


Pages, Layout, and Navigation

1
Pages and Layout

A page is UI that is unique to a route. You can define pages by exporting a component from a page.js file. Use nested folders to define a route and a page.js file to make the route publicly accessible.


2
Navigation using Link Component

The Next.js router uses server-centric routing with client-side navigation. It supports instant loading states and concurrent rendering. This means navigation maintains client-side state, avoids expensive re-renders, is interruptible, and doesn't cause race conditions.

There are two ways to navigate between routes:

  • <Link> Component

  • useRouter Hook

This page will go through how to use <Link>, useRouter(), and dive deeper into how navigation works.


3
Programatic Navigation

The useRouter hook allows you to programmatically change routes inside Client Components.

To use useRouter, import it from next/navigation, and call the hook inside your Client Component:

4
Dynamic segment

When you don't know the exact segment names ahead of time and want to create routes from dynamic data, you can use Dynamic Segments that are filled in at request time or prerendered at build time.


Server vs Client Component, Data Fetching

1
Server vs Client Component

Server and Client Components allow developers to build applications that span the server and client, combining the rich interactivity of client-side apps with the improved performance of traditional server rendering.

This page will go through the differences between Server and Client Components and how to use them in your Next.js application.


2
Data Fetching
  • This new data fetching model is currently being developed by the React team. We recommend reading the support for promises React RFC which introduces async/await in Server Components and a new use() hook for Client Components.

  • While you can try it out, it is not yet stable. We'll keep these docs updated to reflect the latest developments.

API Routes, Loading, Error Handling

1
Create your first API Route
  • API routes should still be defined in the pages/api/* directory and not moved to the app directory.

  • Route Handlers are available on next@canary. This replaces API Routes from the pages directory.

  • Some use cases where an API route was used to keep access tokens secure when calling an external API from the client can now be done directly in Server Components.

2
Access Dynamic Route Segment
3
Loading

Next.js 13 introduced a new file convention, loading.js, to help you create meaningful Loading UI with React Suspense. With this convention, you can show an instant loading state from the server while the content of a route segment loads, the new content is automatically swapped in once rendering is complete.

4
Streaming

To learn how Streaming works in React and Next.js, it's helpful to understand Server-Side Rendering (SSR) and its limitations.

With SSR, there's a series of steps that need to be completed before a user can see and interact with a page:

  1. First, all data for a given page is fetched on the server.

  2. The server then renders the HTML for the page.

  3. The HTML, CSS, and JavaScript for the page are sent to the client.

  4. A non-interactive user interface is shown using the generated HTML, and CSS.

  5. Finally, React hydrates the user interface to make it interactive.

5
Error Handling

The error.js file convention allows you to gracefully handle runtime errors in nested routes.

  • Automatically wrap a route segment and its nested children in a React Error Boundary.

  • Create error UI tailored to specific segments using the file-system hierarchy to adjust granularity.

  • Isolate errors to affected segments while keeping the rest of the app functional.

  • Add functionality to attempt to recover from an error without a full page reload.

Create error UI by adding an error.js file inside a route segment and exporting a React component:

Styling

1
Global Styling

bal styles can be imported into any layout, page, or component inside the app directory.

Good to know: This is different from the pages directory, where you can only import global styles inside the _app.js file.

2
CSS Modules
3
Installing Bootstrap with Next.js

You will learn how to install Bootstrap in Next.js v13

[Unofficial Udemy Clone] - Project Setup

1
Getting setup

In this video, you are going to install Next.js in your application. You will clone the repository from Github and run npm install

2
Install Bootstrap and React Bootstrap in Next.js

In this video, you are going to learn how to use Bootstrap with Next.js v13. You will install bootstrap and react bootstrap

React-Bootstrap replaces the Bootstrap JavaScript. Each component has been built from scratch as a true React component, without unneeded dependencies like jQuery.

As one of the oldest React libraries, React-Bootstrap has evolved and grown alongside React, making it an excellent choice as your UI foundation.

[Unofficial Udemy Clone] - Building Frontend

1
Build Navigation

In this video, we are going to build the navbar using react bootstrap navbar component

2
Design Home Page

You will add categories of courses on the home page. We will use Bootstrap Container, Row and Col component to build our home page

3
Render courses against each Category

In this lesson, we are going to render all the courses against each category. We don’t have any course right now on the backend. We did not create backend yet. We will just render the dummy course against each category

4
Create single course details page

Now our goal is to display the course title, description and the video. We are going to use vimeo for the video. You can place any vimeo video url or video id. I want you to create a new account at vimeo and upload a video. You need the id of your uploaded video.

5
Add Learning Outcomes

Now our goal is to add what you will learn section in the course details page.

I will be using React ListGroupItem component to display the list of learning outcomes.

We have to use this LearningOutcomes component inside the course/[slug.tsx] file

6
Add Course Content Section

Now we need to add course content section. I am going to use React Bootstrap Accordion component.

7
Add to Cart Button

Now we need to add the Add to Cart button and price section in Coursedetails page. You need to update the second Col in the Row and add course pricing and button. I have also added the total number of students and course author.

[Unofficial Udemy Clone] - Building Backend

1
Install Prisma

In this video, we are going to add Prisma ORM inside our existing Next.js application

2
Create Course Model

In this video, we are going to create a new course model in the schema file. You will learn how to use migrate command. I will also teach you how to define the route to fetch all courses

3
Create GET API endpoint to fetch all courses

Route Handlers allow you to create custom request handlers for a given route using the Web Request and Response APIs.

The following HTTP methods are supported: GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS.


4
Creating Schema Design

We will think about what type of models we need. You learn about how to design the schema for your application

5
Creating Schema in Prisma

In this video, we are going to create Course model, Video model, Topic model, Section models in Prisma. You will learn how to migrate these models into tables

6
Create Dynamic Route segment

You will learn how to create the dynamic route on the based on slug

7
Fetch single course based on slug part 1

You will learn how to perform relational queries in Prisma

8
07-Fetch single course based on slug part 2

Learn how to use include during queries

9
Fetch courses based on Topic

A user can view all the courses on the topic. We need to create a backend API endpoint to fetch all the courses on the based on topic

Fetching data on the frontend

1
Make API Call to render courses Part-1

You will learn how to fetch the data in next.js application by using fetch()

2
Make API Call to render courses Part-2

You will learn how to fetch the data in next.js application by using fetch()

3
Make API Call to render courses Part-3

You will learn how to fetch the data in next.js application by using fetch()

4
Fixing SSRProvider Error with React Bootstrap

In this video, we are going to fix this issue

When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.



5
Create Course Card Component

In this video, we are going to create a card component in react


6
Adding PropTypes

We are going to add proptypes for our React components.

7
Render Courses in CourseCard part 01
8
07-Render Courses in CourseCard part 02
You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!
3.9
3.9 out of 5
8 Ratings

Detailed Rating

Stars 5
3
Stars 4
3
Stars 3
0
Stars 2
2
Stars 1
0