Agentic AI for beginners — what actually separates an AI agent from a chatbot, and why the distinction matters. The word "agent" gets attached to everything now, which makes it hard to tell what's genuinely different about systems that plan, remember, use tools and act on their own.
💎 Want the full library? Premium AI courses on every major tool, all in one place. 👉 https://MyAiForThat.com
No prerequisites beyond curiosity — the course starts from AI and LLM basics before reaching agents.
⚠️ Before you give an agent real access: an agent that can use tools can also use them wrongly. Start with read-only permissions, approve actions until you trust the pattern, and don't connect anything holding client or confidential data until you've watched how it behaves.
ℹ️ This course is independent and is not affiliated with, endorsed by, or sponsored by any framework, platform or tool mentioned. For educational purposes only.
Let's talk about what AI agents actually are,
how are they different from automations,
and when would you actually use them.
The simplest way to think about an AI agent
is that it's like a smart minion.
You give this minion a goal, maybe some memory,
and a few tools, and it's going to go off
and do the work for you.
Now, unlike a chatbot where you send a text
and it replies with a text, an AI agent can
think, decide, and act.
And the thinking part and the deciding part on its own
is where it differentiates from other things.
AI agent can hold context, follow up, call APIs and adapt based
on what it's seeing, all without hard coding every single step.
Now, how is it different from traditional automation?
because if you think of something like Zapier
where you can automate a bunch of your tasks
or even like Cronjobs
where you could automate and get a script to run
at a specific time period.
The main difference is that automations are rule-based.
When this happens, do that.
They're great for repetitive, predictable flows
but AI agents are different.
They shine when the task is more open-ended,
messy or decision heavy for example in our case
the code review whenever we want to review code
and point out subtle bugs give more personalized advice
or feedback then in that case you would
use AI agents or even adapting how they help based
on who's asking you would use AI agents for that
automations won't be able to do this type
of work the other question you may have is well
But if you just go to chatgpt.com,
you can just ask ChatGPT and ChatGPT also feels like
quite open-ended and it's going to do the same thing.
Well, like I said, because AI agents build on top of context,
memory, it will call APIs
and so on, it has access to a bunch of different tools.
And you can sort of think of that if this is an AI agent,
then we are going to give
it context we're going to give it memory we're going
to give it access to APIs but also we can
give it access to a bunch of tools that it can use
to let's say search the web and so on as well
so all of this makes AI agent special
so here's my question for you now that you know the difference
between what automations
are versus agents where would you use AI agents and so on what kind of
agent would you like to build it could
be something very simple or something ambitious
i would love to hear what you would create now
for example Convex is the open source reactive
database for application developers it is fully open source
so it's really freaking awesome
and it is a reactive database
which means that whenever you update a row remove a row add a row
and so on in the Convex database it is automatically going
to remove that from your front end because
of the provider that it comes with it's fully type safe
and these are a few reasons i also think
Convex is really useful for us especially
when you're building AI agents it's fully type safe
so whenever you update a type and update a row type
or anything like that in your database then
your UI is automatically going to have updated types
so you're never going to be in a spot where
your backend is not synced with your front end
which is really cool and like i mentioned it's
fully open source. And lastly, and more importantly,
it is really ideal for AI agents because of a
bunch of different packages and components that it provides us.
For example, Convex provides us
agents as well as workflows that we'll take a look
at that makes it really seamless for us to use
and build AI and AI agents. So let's bootstrap our application.
First of all, let's just head
over to the documentation for Convex.
And they have a bunch of quick start guides for a bunch
different front-end tooling that you like we're going
to go with Next.js because that's the
framework we are going to use to build our application.
It has a loading state, it has a
handle review handler and it's setting loading to true forever
and then if it's loading we're
showing a loader otherwise we're showing the text review file.
This is the function we need to use
to invoke our AI functionality.
But let's take a look at the agent architecture now. So let's take
a look at the agent workflow
and then build it piece by piece first step the client which is a
user is going to press the review file button
which will then create a new code review thread
this is a trigger to call our convex action called
as create thread now remember i said that convex
has three types of functions query mutations
and actions this is going to be an action that we are
going to use. And an action means that whenever you want
to make a call to a third-party API,
third-party code, then you would use an action.
Then this specific convex agent is going to send
the code review prompt that say, hey, here's some code,
please review it, to the OpenAI model
called as text embedding.
The OpenAI model is going to use its memory or semantic search,
whatever we have asked it to do,
will use the text embedding model, and then it will use this
will enable and help the agent to understand
the meaning across messages and then that specific
model is going to respond with feedback such as suggestions,
best practices and any sort of bug
alerts that it has found.
Convex bundles this into a structured result and returns it. The Convex
agent then returns the feedback to the client
and the user then sees the code review results in the
UI. And all of this is automatically handled.
The backend part of it is automatically just
handled by Convex. And we'll take a look at how
So first, let's just go ahead and create a thread
and create some sort of a way for us to interact with the model.
So we are going to use the AI
agent with Convex, which is a really powerful platform
that you're going to take a look at
to build an AI agent, for example,
the AI agent has two core components. It has an agent component
and a workflow component. In this case, each one has its own purpose.
A convex agent is a structured
way, or you can think of it like a wrapper
that is going to turn open AI into a stateful memory
capable agent that you can call anywhere you like more likely inside
of your buttons for example
it allows you to maintain memory across conversations
which is why we are going to
invoke the create thread function it will automatically store
and retrieve message
history and so on and convex is going to do all
of that because it gives us this package to us
and maintains all of that on the other hand workflow
is useful to build these long-running
multi-step background logic
so whenever you want to run multiple ai steps in sequence you would
want to do that so you can think of it like
an async task manager for your agent's brain
you want to run logic over time with retries
and so on then you want to use workflow in our case
we are going to need agent because we
when we click a button is when we want things to happen
versus an async task manager that runs for in your agent
in our agent's brain so if we take a look
at the documentation so let's create
our AI agent now now let's just click on AI agent and this is
a package called as Convex Dev Agent that will allow you
to automatically store the chat history
Convex is going to manage all of that you can think
of this as an AI agent framework built on
top of Convex so it's going to do all
the data manipulation for us for example it's going to
remember the history search for messages generate all
the steps necessary and we're going to walk
through this step by step
but if we scroll down we need to install the package we go back here
stop the server and paste it let's just install
that then we need to create a new file inside of
the convex folder called convex config.ts file let's copy
this this is where we are going to
define an agent, for example, the config for agent.
So let's create a convex.config.ts file
and paste that. Now that we have defined this,
let's go ahead and configure our agent. So as
you can see, we can define an agent.
We can pass in whatever context we want. We can pass in the
storage options here and start the thread,
continue the thread and expose the agent as a
convex action. That's exactly what we are going to do.
So let's go ahead and configure our agent.
So first let's just copy all of this, go back here,
go to the agent file and paste it. Now we
definitely need the AISDK slash OpenAI.
For example, if you don't have that already, go back
to the terminal and npm install it.
So we can say npm install AI SDK slash OpenAI. After we do,
we just need to define an agent and then declare it
and there's a bunch of options here so we're
gonna i'm gonna walk you through it step
by step now over here let's just create a support agent
and then let's call this new agent
and this is where we are going to basically say components
.agent and this comes directly from Convex
because this is the components architecture we
talked about we are going to use GPT-4o mini
this is a much way cheaper model compared to a lot of
other ones and this is the embedding that we are going to use
and this is literally the steps that
we essentially are following based on this diagram
so now instead of saying you are a helpful
assistant we need to give it a prompt saying that you
are a code review assistant you are acting it
acting as a senior software engineer
so copy this prompt from the cheat sheet and this will give you
a really good starting point for a prompt
to give constructive feedback and for how your
code review agent can give you feedback.
We have created our first Next.js application together.
Before we dive deeper into the build,
let's take a moment to really understand how Next.js works
under the hood. Because once you get the architecture such as routing,
rendering, caching,
everything else you build just flows more naturally.
This foundation is what separates
a project that works from one
that's truly production ready to start off let's take a
look at the routers in Next.js Next.js has two routers the pages router
and the app router in
this specific crash course we are going to focus on the app router
and here's why because app router
is the recommended router by the Next.js team it has all
the latest capabilities such as the server
components client components partial pre-rendering
and so on while pages router is being supported
by many companies still, App Router is the best way
to stay up to date with Next.js. In the App Router,
every folder in the app directory becomes a route.
It uses a file-based routing system.
Each folder contains a page.tsx
which renders the UI for that route and different files mean
different things. For example, page.tsx.
This will render the UI for that route. For example,
if you go to localhost 3000 it in fact points to page.tsx
and that's because it's in the root
of the app directory similarly if we go to about
and add a page.tsx inside there so that means
there's a new folder called about
and inside that there is a page.tsx and you could easily just
navigate to localhost 3000 slash about that is going
to render the UI for that specific route
the file system files equals routes you don't need any configs
no imports is just going to work
provided we follow the naming convention the next file
is the layout file now for example layout is
what wraps your entire application
this specific root layout has the html and body elements
and all the children inside of this means all
the routes such as the about page or the root
page that we talked about
and so on this specific layout will wrap your entire application but
layouts are more than just a wrapper if you want
to add a component that needs to be visible in
every page inside the application
then you can add them in a layout for example let's say this
is a web page and if you want a header as well
as a footer to show up in every single page inside
of your website then you could just simply add header
and footer component inside the root layout
and it will automatically be visible throughout your application.
Now, Next.js also gives you smooth app-like transitions
with the link component.
Let's say you want to go from this card to another page.
Instead of using the browser anchor tags,
you could simply use the Next.js link component here.
Whenever you hover over that link,
Next.js actually prefetches that target route.
So when you click on that, the page will load instantly right here.
That's why the navigation inside
of Next.js feels very native is because it's doing the heavy
lifting. Now I'm going to use Cursor
which is a AI code editor but feel free to use whatever code
editor you may like. One of the most popular ones are VS Code
or WebStorm or whatever you like.
Now I've opened up the project inside of Cursor.
Let's close this AI pane because we won't need it
And now you can see these are all the files
and folders that Next.js has bootstrapped for us.
We are going to use the Next.js app router
because when you pick the default settings
for bootstrapping your Next.js application,
you are saying yes to the app router.
Let's go over these files one by one.
First off, if you go to the page.tsx,
this is the default file in your application.
Next.js uses file-based routing system.
So you simply create a new file whenever you want to route to it.
In this case, whenever you want to expose a route publicly and you want
to tell the Next.js app router that, hey, I want you to expose
this specific page, then you can simply create a page.tsx file.
Now you can see this is the default page.
So let's just go ahead and remove all of this.
And now let's say div and h1 and let's just say hello world.
All I just say hello Next.js.
let's remove this unused import because we don't need it
and now if we go back to the application
you're going to see hello next.js right here now
this is the default page this is the index page
but if you go to the layout file this is a root layout file
for a reason because it has the HTML
and body elements this wraps
your entire application anything that you add here will be
shown in the entire application
so for example if i say i want to add a header but let's say i
built this is going to be here and as well
as a footer let i build this inc as we do that you can
see we have i built this as a header
but also i built this as a footer now if i go to slash a
route that does not exist yet you will see
that i build this as the header and if you scroll down
i build this inc is the footer
because all the routes now will have a header and a footer
simply because we added in layout SEO
that is search engine optimization is extremely important
it is the language that we used to tell
the browsers what our website is all about just like
you and i study english b you need to use
a language using the Open Graph protocol to tell
the websites exactly what the website is all about
and that is simply adding specific tags
and using pure HTML now every route define its own metadata
or SEO specific tags for social sharing
and so on simply just add title and description
which will automatically change the title and
description inside of your page the layout file
also exposes this metadata tag this allows you
to extend the browser metadata head element
and add more information to it simply by changing this
for example i'm going to say i build this is the title
and the description is a platform for
building and sharing your own projects with the world for now
so now as i do that go back to home
and open up our browser developer tools
and let's take a look at the head element and you're gonna
see if we take a look at the title it has now changed
to i build this as well as you could
also take a look at this title here the description
with the metadata name description has also been
updated you could also update the favicon as we like as well
because this is the favicon that it
points to but inside of layout
or any of the pages we could simply expose this specific constant
metadata and it's just simply going to work for us
and then it's we'll be able to update the SEO
tags as we like and we'll talk about SEO
a bit later next.js layout file also allows us to set
up fonts so this way we could change whatever fonts we like
and it also has this package called
as next font and it has a slash google tag
which allows us to import any google fonts as well for
instance if i want a font let's say Inter
then i could just import that remove all of this and now
i could just say i want Inter subsets latin
and right now we have two options with the font we
could just say variable is going to be font Inter
and here we can say Inter dot variable or if we
want the font to be applied to the entire application
then you could remove this variable
altogether and now simply add Inter dot class thing
and now the same font will be applicable
to the entire application
so for instance if i go back here let's inspect element you're going to
now see Inter as the font now versus
the other font next we have the globals or CSS file this
is where Tailwind is in fact set up now we have
these different attributes such as the theme
attribute these media elements
so we could pass in the necessary colors and so on as well as a
body tag here globals
or CSS is your global file for CSS configuration we are going to always
revisit this file whenever we want
to update any styling we already talked about favicon this is
the favicon that's currently being used
but we could update it to whatever favicon we like but
to simply dragging and dropping a new favicon in this folder
Next is the public folder.
This allows us to expose any public assets that we like.
For example, whenever we have any images or specific files
that are okay to be accessed publicly,
we can simply drag and drop them here.
Then we have the git ignore file,
which tells Git to ignore all these files and not to check them in
We have eslin config file,
where you could simply add more information
for how you want your project to be set up and then leave it as is.
We have the next config file
and next config file is a TypeScript file
which means if you click on it you can already see
all the different options you could pass in in your next config file.
Next config file is your
next.js configuration file.
So anytime you want to tell next.js to perform a specific way
you could simply come to next config file
and see the different options that are available
and we will be coming here for a few things such
as updating URLs for images to tell Next.js that
hey, it's okay to use a specific URL and so on.
So at this point, we have the React compiler as true because remember,
we said yes to React compiler
So now over here, if we go ahead and look for React compiler,
then you can already see the documentation here for it
and you could read more information there as well.
then we have the package.json file
and these are the different scripts in the package.json file
which allows us to run a development server
with npm run dev and a build server with npm run build
start the already built files inside of the build with npm run start
and to lint our project with
lint ESLint we have the post CSS config file
that Tailwind uses to basically convert Tailwind code into
CSS code and it needs a specific package
to convert that we have the README file which
includes all the information about how
the specific projects should be set up as soon as
you onboard other developers as well as a tsconfig.json file
which tells how we should be able to
configure TypeScript in our project now these are all
the different files and folders inside of
Next.js. So now the real magic begins.
Server and client components. By default, every single file
inside of Next.js is a server component.
So if we take a look at this diagram, this entire page is
a server component. But what about this add to cart button?
This definitely requires the browser
as the user is going to interact with it
and there needs to be some sort of JavaScript that
needs to run but in that case we can mark
that specific button as a client component so by
default everything in Next.js is a server component
that's rendered on the server and then it's going
to be streamed to the browser
and client components are the are only for interactive pieces things
like forms models animation these buttons
that need specific interactivity and so on so let's
take a look at when things need to be rendered
on the server can be server components versus what
things need to be client components.
By default in Next.js all components are server components
they don't re-render that means whenever you want re-rendering
if you want specific data to change
dynamically then you definitely need to opt into client components.
Server components are not
included in the browser bundle
which means that you could store your API keys on the server in
server components because they won't get exposed to the browser.
Server components has something
called as the React server component stream
which is a special stream that may look like JSON
but it's a special stream that React uses
to basically figure out what needs to be server
components rendered on the server versus what needs
to be in the client side and you cannot
pass a function as a prop inside of a server component.
You cannot also use any browser APIs
as well whenever you use server components
because think about it server components are getting
rendered on the server so they don't have access to the browser
which is why no browser APIs. In
order for you to use the client component you need
to use the directive 'use client'. Client components
can be rendered which is amazing for interactive applications
but you want different interactive
pieces things like modals forms animations
and so on client components definitely get included in
the browser bundle which is why any expensive library
that you are using needs to be extracted
out as a server component
and don't worry you will learn all of that in this specific course
any type of life cycle hooks such
as use effect use state all of those need the client that is
a browser because they are part of the re-rendering cycle inside
of react which is why they need to be
client components you cannot have server component
as a child of a client component which we'll take
a look at a bit later but that is also one of the limitations
so you have to always make sure
that client components are the leaf node inside of the tree
and browser apis are allowed inside
of client components so whenever you need
to access the window object perform anything that
needs the browser you could use a client component.
So these are the few differences. Now obviously
we're going to go through all of this in depth inside the course
but this is what you need to
know about server and client components.
Now let's talk about data fetching. Next.js has extended the
browser fetch API. Now Next.js has three different types
of data fetching static site generation
incremental static regeneration and server-side rendering.
With static site generation you could
essentially cache your entire data by using
a property called as cache force cache with
incremental static regeneration you could add
this property next revalidate and the time you could
say how long you want this data to be cached
so that means anytime a user makes a request
the first time the user is going to see the stale data
but the next time is going to see the fresh
data then we have server-side rendering wherein
you don't need any caching it's going to fetch
every single time and this is for the specific fetch API request
so all of this gives us a
flexible rendering spectrum static means you can pre-build
and cache forever dynamic means you
could re-render per request revalidated means it can
be rebuilt periodically streaming means you
get progressively streamed chunks
so the client components that get shown to the browser are
progressively streamed in.
Now we talked about how Next.js uses special file names such as
page.tsx whenever we want to expose a public route.
The fact that page.tsx is inside the app
folder makes this specific page the default page.
However if we go ahead and add a new folder and
let's just call this folder products
and let's add another file called as page.tsx. This means
we would be able to route to this specific route
and whatever we add in here will automatically
get exposed the fact that we have called this page.tsx
so now we can just say products and if
we head back we can say localhost 3001 slash products
and this time you can see products text
has been has already appeared here
but also notice that i build this header with i build this inc
footer also there because we have added header
and footer in layout all righty so that's how
named routes work inside of next.js
but if you want to create dynamic routes for example
instead of products if you want to say hey i want
a dynamic product ID you would use something
called as a box bracket and create a ID here
and inside that again we can create a page.tsx file
Now again, we can expose that and now becomes each one product.
Now, if you want to access this specific ID,
then you could just simply add params, params with ID.
However, params is in fact a promise.
So in order to access it, we need to await the params.
And now in order to access it, we need to await the params.
And this means we need to turn
this specific page into a async function.
and now we could simply just say product ID let's take
a look this time if i say slash product slash
one you're gonna see product one or product two
and so on if i say product anki then you're gonna
see product anki there because now it becomes a dynamic route
because of the fact that we have
used these box bracket with ID inside of it now there's
a lot more routing that we will cover
throughout this Next.js crash course
but these are just the basics that we would need to learn
a bit more about routing inside of Next.js.
But Next.js has another way that you could simply
interact with your data and cache it
and which is what Next.js 16 introduced called as the cache
components and partial pre-rendering.
First let's talk about the cache components. If you add this
specific property cache components as true inside
of next config file you could essentially cache
any of your components at different levels
the page level component level or at a function level
these let you wrap your entire sections of your UI
in a persistent cache boundary for example you
can cache it as a file level by adding use cache
or at a component level or at a function level
right here. Depending on this directive use cache
you could cache anything you like inside of Next.js
and partial pre-rendering is huge
because cache components the minute you enable them you also
get partial pre-rendering by default and this is huge
because it allows Next.js to pre-render the
static content and when the dynamic content is ready
to be streamed in it is automatically going
to show that to you for example the static content showing up
and when the dynamic content is ready
here it's going to show up as well this is huge
because it allows Next.js to pre-render most of
the page statically as you can see over here
but then keeping small parts dynamic like user specific
data user analytics counters
and so on you can think of it as the perfect middle ground between
static site generation and server-side rendering.
The app is going to load fast but still feel alive
and we'll be using this later for things like real-time updates
which we'll take a look at later
for a counter inside of Next.js.
Anytime you want to cache the data you could add the use cache
directive but anytime you want to mark the data
to be partially pre-rendered then you could wrap
it inside a suspense boundary here.
So in this specific example we have cached the page but we
still have this dynamic component data
which we have wrapped around a suspense boundary and now
let's just extract this whole thing out
and create a new component here and paste it we need that
wrapper div here so let's paste it
and also let's grab these imports here as well there we go let's
add the hero section here
and import it you're going to see we're still back to where we were
now back to the hero section this one is going
to be a section semantically so let's create a
section here and in terms of class name we're going
to have relative overflow hidden bg-minie
r-2 from backgrounds via background
and this just adds the different color stops to muted 20
and this just reduces the opacity you can already see there's
this nice little background here
for the hero section and now let's talk about
the badge before we do let's also create a wrapper div
and this specific wrapper div is already provided
in the global search CSS so if you look for
wrapper you're going to see wrapper is already here
so you don't have to worry about it so we
can just wrap this entire thing around with the wrapper div
this will give us the padding necessary
as well now let's also add more padding to the top
and to the bottom because it's looking too
tight right now so we can say flex flex col item center justify center
also let's give it in
whenever it's larger devices let's give it
a padding vertical of 24 otherwise 3 by 12 and
also align the text to be center as well.
Let's close this div here too. There we go. It's looking
way better. Now let's talk about styling the badge.
Now we're going to have a lot of styling here so
we could extract this into a little tiny live badge function.
And here we can say exactly this
and use live badge here. Simply just extracting it out.
There you go. And now this badge is not
going to have any background
so we could just use variant outline here and let's give it a class
name because again we want a bit more padding
so we can say px4 py2 mb8
text sm backdrop blur sm
and that's it you can already see it's looking
so much better now let's add another span and
the span is going to be for this element right here
which lets you show this ping animation and
for that Tailwind does provide us with a utility that we will leverage
but first off let's create
the necessary circle for it.
So here we can say we're going to have two things we are going to
have two spans here one span would be a circle
and the other one will also be a circle so that
we could give that animate ping effect.
Both of them would be absolute position, inline flex,
h-full, w-full, and this is where we are going to say rounded-full,
and bg-primary, and opacity
is going to be 75.
If we go here, you can already see the ping animation.
And the other one is going
to be relative positioning inline-flex rounded-full as well
which gives it the round shape and
h-2 is going to be h-2 and w-2 height
and width are going to be h-2 and w-2 and again bg-primary there
we go and let's remove this so since it doesn't
have any element we can just close it right away
alrighty and now for this one specifically
for joining thousands of creators this text
we could also give it
a text-muted-foreground color there we go it's looking way better now
our badge is ready to go
so now we could focus on h1 for h1 we can say text-xs small text
text-xl large text-7xl
so that for different breakpoints the text is going to be bigger and
bigger tracking is going to be tight mb-6
so you can already see the changes over here and then
it's going to have a max-w-5xl this way it does it's
not too big it's not too wide then
you're going to have another class name
of text-lg sm:text-xl text-muted-foreground mb
10 max-w-2xl leading is going to be relaxed
there we go next let's style the buttons obviously
we need to give it some styling
so that it's not so tight right next to each other so we can say
on mobile it's going to be column but on desktop
or bigger devices it's going to be row and mb is
going to be 16 and that's it
and let's wrap it up right here you can already see it's looking so
much better and this specific button
is not necessarily a button right to click on explore
project you are seeing that it's more
so a link than it is a button so what we could do is use
the variant link use a property called as child
this allows you to render a link inside a
button so we can but it still looks like a button
so you can say size is large and class name is
going to be text base px8
and shadow it's going to be large there we go and since we said it's
going to be a child we still need to render that child
so it's going to be have a link component
from next js and wrap it up now obviously it needs
an href that's what it's complaining about here we
can say it's gonna go to slash submit similarly let's copy
this whole thing explore projects as
well which will go to slash explore all righty
but the second button is not going to be exactly
the same so we could just use
a different variant here now we don't need to use the variant outline
we could use the variant secondary there we go all right
so now you also see that there are these
icons here right there's an icon here there's an icon here
so for that we're going to use the
Lucide React icons so we could simply just use sparkles icon
and class name is size five for
the icon similarly for explore projects
as well we don't need an icon here but we need an icon
after so we can just say arrow right icon
and class name is size five there we go so you can
already see it's looking
so much better now we have the badge we have the text we have these
elements too but now you can already see
that the font doesn't match to what we have so we could head
to layout and change the font
and the font that i really like is called Outfit with next.js
fonts you could just simply use google fonts inside
of next.js by using the package next font
slash google and simply import the font the font
that you end up using is the only one that's going
to be included here we could simply add outfit
and then wrap it with outfit this could be outfit
as well now let's use that directly there we go
you can already see it's looking so much better
simply by using a different font
and in order for us to use any font inside of next.js you could
just simply do outfit.classname
and if you have multiple fonts that you want to use then you could
also expose a variable that you could simply use
that variable in other places. So you can just say
this specific text will have that one variable
but the other text has some other variable. So now
that we are in layout let's also update
this to be share your creations discover new launches
and then in terms of description it's simply we can just use this.
Now you can already see that
the title has automatically changed because we updated the metadata.
So now going back to our
hero section we already have a lot done
but we still need the stats here which is the last part
of our hero section. So let's create
a simple component here called as stats card.tsx. This
component will have all the information about the stats card
because then we could have additional
styling as hero section is already getting a lot longer.
So let's create a stats card add that to
the hero section. So right underneath here we could just add
the stats card. There we go. Now if we go
back here you're going to see the stats card here.
Now for stats card we're going to need three things
the icon, the text, and this other text.
So we could just create a constant here called as
that's data, which is going to have three elements,
an icon, which is going to be referencing the
Lucide React icon. So we could say rocket icon.
Then it's going to have a value, which is going
to be 2.5k plus. And it's also going to have a label,
which is going to be projects share.
Then we are going to have another element so that we could loop
through all of these later and render the stats component.
So here we are going to have user icon or users icon.
And instead of 2.5k, it's going to be 10k plus.
This one is going to have active creators.
Similarly, we are going to have another object here,
which is going to be an eye icon.
this one is going to be 50k plus
but this time it's going to be monthly visitors well i really
hope that all our projects are this successful all right
so now let's just loop through it so
we can just loop through this item
and map through it give it a key then spread the rest
now as we do here we need to define
that so here we can say icon is going to be Lucide icon
so here it's going to be icon value label
and then the type for this is going to be icon which
is going to be Lucide icon let's remove
this so we could import this from Lucide React and the value
is going to be string, label is going to be string as well
and then we could simply render it now we
going to have div within a div
and this div will have a flex item center justify center gap two
again we're rendering all of that over here
but since we're not rendering anything yet we're not
seeing any data but this is where we'll render
the icon from lucid react so we cannot declare
a react element or a JSX element to be just a lowercase
so we could just give it an alias
called as icon this way we could just simply use it
and here we can say size five text primary
and that's it, three icons are rendered now we need to give it a p tag
which is gonna be text three
excel small it's gonna be text four excel fonts bold
and the what we're going to render here
a value there we go so we have a div here
and now we're going to have another p tag which is going
to be label there we go and this p tag will have
a styling of text sm text muted foreground there
it is we still need to give it some sort of a grid
so we could say grid grid cols one but
small onwards it's going
to be grid cols three gap eight small onwards it's going to be gap 12
max w 2xl w full and so on the render
the stats card there we go it's looking so much
better now but stats card also has this border
which only the second element has so we could
just introduce a has border equals true
this automatically gets passed since we are passing
it in but we just define it and make it optional.
The fact that this is a boolean
value has border will always be false
and over here in this div we could use
the cn function from shadcn/ui
that allows us to merge a bunch of tailwind
styles. This is how it is gonna work.
We can say space-y-2 it's gonna be the
default style but we could
also just pass in comma and any condition that we
want so we can see if it has border
then it's gonna have a border-x which is border horizontal
and then this is going to be the color of it
that's it that's all we need and our hero section
is ready to go now let's go ahead
and build the featured section next it's time to build
our featured section so this specific section has
a similar title to this one it has the same design
icon text some description icon text description
so you can already see we could extract it out
into a common element but it also uses this card if we go here
and look for Card that's exactly what
we need to render that specific card
so we don't have to build anything let's copy it let's stop
the server add the card
and restart the server that's it let's close all of this now
let's go to page and here let's create
a new component called as our featured products and
for now let's just move this inside featured-products.tsx and create
the component import it and
so on go back to the page we have featured
products rendered right there now when it comes
to featured products this is going to be a section
and i have it i have a class name here by20 bg
muted 20 for example i guess we have to change
the background color of this one but we'll tweak
that in a second and then we
also need a wrapper div like we did in the other cases so we have a
wrapper div here now we need a div for the top section
which is going to be item center this
entire section here is going
to be flex item center justified between mb8 and let's wrap that
up entirely then we need to build the icon the text the description
so let's add that like i
said this is going to be a section header
so we could create a common folder here and move all
the common components
that here we can say section header dot tsx this is gonna have
keep it simple let's hit on it for now
and this is going to be a section header and don't worry
we have not worked on the styling for that yet
but we will so title is going to be featured today
so now in the section header let's see
so first off this is not going to be any of the flex
elements but we can just do the mb12 you're going
to have a title for sure but it's going to be an
h2 not an h1 you're going to have another div
which is going to be flex item center gap 2 and
mb3 wrap that up around the title on top
of this we're going to have a icon again same idea like
we did in the other case the stats card we are going
to pass the icon here so here you're going
to say it's going to be an icon like the star icon for example you're
also going to pass the
description here as well
which is going to be top picks from our community this week so now
let's render the icon which is going
to be size six text primary wrap that up the icon is not
necessarily created yet so we just need to declare it.
So here we can say icon is
going to be icon like we did earlier
and this is going to be an import from
Lucide react