Transcripts
1. Introduction: In this class, you will
learn about AI coding and how to create apps
using cursor IDE. Even though we are using Cursor, the same process and prompt
can be also applied in other IDs like Winsorf or
VS code with AI extensions. This course is a
practical one where we are focused on building
full stack applications. In this case, we'll build a SAS, which stands for
software as a service. It's an app that you create, set up a payroll for, and users can access it
after subscribing. You will learn about cursor
and how to use it for AI coding and to get ready to
start building on your own. We will learn an
effective way how to build chip SAS applications, how to implement the
subscription management, authentication provider, database, and test the
applications, end to end. We'll be learning
this on SAS that we will create
together from scratch. We will cover how to set up
Stripe for subscriptions, a customer portal
to manage them. How to work with Super
baase and much more. We will cover the
functional testing, so you are able to test your application by yourself later. Overall, the skills
demonstrated in this session can be applied
to your other projects. Let's talk about the
approach that we will use for building
the projects with AI. The goal is really to
get you to the point where you enjoy building
your own products, your own size and where you don't reinvent the wheel
and create a new backend for your applications
when we are talking about authentication and
subscription management. If you can just set one
up and then reuse it. Later on, after
we'll build a SAS, you will also learn how to do the functional testing on the
newly created application, so you will test the payments,
subscriptions, database, set everything locally,
so you can test locally and fix before
you deploy to production. You will learn how
to test webhooks, like if the payments with
Stripe are successful, if the subscription is
mapped in database and if the authentication with
clerk works properly. AI didn't lose you there and you would like to build
applications with AI, have some fun and just
build products that you have in mind and get your
ideas into production. I'm looking forward to see
you in the next lesson.
2. SaaS Project Demo: Now let's proceed to the demo. We are on the landing page, and the main thing there is the code to action and a teaser. We have the demo showcasing
the functionality that the user will get after subscribing to our
SAS application, and we want to subscribe, and I'm redirected
to the signup page. I will continue with Google. The user was saved
also in our database. We cannot use the product yet. We first need to subscribe. Let's hit the
subscribe to access. There we are on
the pricing page. We will select subscribe. Now we can see the
payment was successful. We will go to Dashboard, and there we have to
product ready to use, and let's try it. You can select between
the Deese reasoner and Desk chat models, and I will show you first the functionality with
the design mode. I will click there,
Activate Design mode. And when I will send
there, for example, a paragraph, the assistant will know that it should respond with a code styled with tailwind CSS. I will hit Send and you
can see as a response, I go this paragraph design
with the tailwind CSS. The next feature is that I
have there some templates, for example, I have
their template for stripe integration, so I will click it, confirm, and now AI will generate the response for the
stripe integration. If I would like to cancel the
subscription, I can do it. I would just go there on
managed subscription. It will redirect me to
the customer portal, and there I can set.
3. AI IDE - What to know: Let's first talk about AI IDs, and then the approach that I will be using for
building the projects. We have quite a few options. I'm using and I will use
cursor because for me, I started with it, and I think it really has
everything I need. Simple. It works, and for me, that's pretty much enough. There are other options like VSCde where maybe if you
are already programming, you'll be most
comfortable because probably you use
it in past years. And there are extensions that
you can use, fine, Ru code, and I also heard about augment then we have the windsurf which is also
a pretty good AI IDE. And then we have here cursor. And cursor is the one IDE I will be using
through this course. But from my perspective, I think it's not the
most important thing which IDE you have. It's about with which ID
you feel most comfortable, which ID you like to use. And basically, you are curious
about few features that are coding agent that will
help you code the application. Some chat, which is some additional feature that cursor has where you
can ask questions, and it won't directly
update your code, but it will give you the answers that you can then
apply, I think, WinSerf and mentioned extensions in VS code also have
a similar feature, and the third feature
is when you will tag code and you will
do some shortcut, for example, in
cursor in Sutter K, you can edit the selected code. But most probably
only the AI agent is the one that will help you the most and that you really need, if you want to be effective and use AI coding to build
your applications. The question is,
do you need AI ID? And the answer is, yes, if you want to be
effective, you need it. But of course, it's also possible to do this
just with a browser, chat GBT, for example, or clot or any other model
that you would like to use. But then you will do a
lot of copy paste thing, but it's still kind of possible. But there is no reason
to not use AI ID.
4. Build & Ship Approach: Let's talk about the
approach that we will use for building
the projects with AI. The goal is really to get
you to the point where you enjoy building your own
products, your own sauce, and where you don't reinvent the wheel and create
a new backend for your applications when
we are talking about authentication and
subscription management. If you can just set
one up and then reuse. Later on after we
will build the SAS, you will also learn how to do the functional testing on the
newly created application, so you will test the payments,
subscriptions, database, set everything locally,
so you can test locally and fix before
you deploy to production. You will learn how
to test webooks if the payments with
Stripe are successful, if the subscription is
mapped in database and if the authentication with
Clerk works properly. What we will do to
create our applications, we will use third parties for authentication
or our project, we'll be using clerk for setting up the
subscription management, we'll be using Stripe
and for database, we'll be using SupAbse. And all of these three
providers already have existing documentation
about how to implement this and make it
work with your application. That means we basically just
need to create some Next JS, starter kit because
we will build our application with Next JS. And then after we will set the subscriptions, database
and authentication, we will be coding just the MVP because
then we will be able to test with the core
functionality if our product is successful or not and
deploy to production. And in case we will
get the users, we can start building on top of it and add more
and more features. With this approach, we can
ship more products and make our building journey as
effective as possible. So AI didn't lose you there and you would like to build
applications with AI, have some fun and just
build products that you have in mind and get your
ideas into production. I'm looking forward to see
you in the next lessons.
5. Cursor Crash Course: Get cursor IDE. You will head to cursor.com, and there you will download it. After you download it, create a new folder for my application, and I will move to
folder to Cursor. I will drag and
drop it and it will open the folder in Cursor IDE. Now there is the
folder, and inside, we can start creating the files. Our applications will be
created with Next JS. The command will set up all
the necessary files for us, and then I will be just adding the necessary components so our page will get
the desired look. Now, to show you what you
can do there with Carolus I, you will open this chat. There you can see
you have the agent, and he can create
the code for you. If you will switch
there, you can just ask, and this won't create any code. For example, please, how to
create next JS application. With this, he won't be
running the commands for you, but he will just tell you
which command you should use. You can also directly
run it from there, but if you want to have it under control, you can
just click copy. Then you will open terminal. You can use a shortcut or you can just do terminal,
new terminal. And before using this command, what I like to do
the most and it's actually not use AI for
this command because I rather go on
Talen CSS and check the most up to date command there for just creating
the application, it's possible that
they do update for the new tailwind version, and it's not yet
caught in the model, and it's just much easier
instead of the prompt AI, then you will page the command. Instead of the Mapp,
you will put there a dot that will create
this app in your folder. You will hit Enter, then you
will do yes to tailwind, no to source directory, no to turbopek, no to AIS. It will install
the dependencies, and then from now on, we will be using AI. And if we will switch
back to agent, we can start with
our first prompt. And it will be a testing
prompt because I want to show you what we can do there in
cursor and some real basics. If you would just like to ask AI and not let it
update your code, you will switch to ask, and there please how to update my lending
page, for example. Instead of just quickly changing all your code
on your lending page, it will just tell you
how you can do it. Which is good if you maybe want to learn programming,
for example, there you can see,
I just gave us the answer. Also some proposals. We can also apply it, but it didn't do anything. If you put there the
agent and there, please change my landing page, the agent will start
and then of course, we can still reject, but you can see it already
started to change the code. In some cases, of course, if you want to implement some
feature for application, it starts adding the folders, and yeah now it's up to us if we want to
accept it or not. So for this one,
I can do accept, and there if I'm not
happy with the output, I can do Restore Checkpoint
then I will continue, it will just reset it,
and now the code is gone. Next cool thing is that you can also insert
a picture there. So if you have some idea of how you would like your
page to look like, you can send there the
page, and it will copy the layout at least and try
to do a similar design. If you want to ask about any specific file,
you can edit there. We're going to files
and folders and just edit the file or
direct to the folder. But mostly, you will be
really using just this agent, putting there your prompt, then accepting it,
double checking it, and building the
application step by step, not putting there something
crazy with, like, I don't 150 lines of prompt because then it will implement maybe
just a part of it. It will try to do
everything in a bad shape. I really don't
recommend it, and I recommend using smaller prompt. What I also like to
use after seeing some part that I don't
like, for example, let's say that I
won't like this div, I will just take it like this. Do sutural plus, and it
will open this window. In this window, I can put a prompt and edit
the sac that code. Usually what I'm doing is that
I find element like this, and for example, it
has a better layout. I need to do some small change, so I just want to pick something or I want
to refine something, and I will there, please update the design
of this element. And then it will start generating and just
update the selected code, which is great
because then it won't break any of your other code. In case you have some maybe
more complex implementation, if you will put this
into agent, yes, probably it will also update only the code you
really want to update. But it happened a lot of
times already that they just started to think and also created some
unnecessary changes, and then it break the code, and this is just a smoother
way of how to fix things in case you know where exactly is the problem
you want to solve. Now I can just accept
it, and that's it. No other code was changed,
and that's basically it. Taking the code using idol K, writing prompts here to
update the specific part, asking directly in the
composer, the agent, and mostly we are sending the prompts there and
then just accepting the code or ask in the chat in case you want to ask about some specific
functionality, brainstorm, or figure something out without changing
any of your code. This will be the cursor intro, and we will learn
more by building. See you in the next
lesson where we will actually start
building something.
6. Get AI API Key: We need to get ABI keys first, and then we can start
building the application. I will be using deepsk AIIBIKe, but you can use any AI API
key you'd like to use. For example, Gemini AI API, you can get free API
key that you can use, and after we will get it, we will store it somewhere. We will use it after we will start with development
in Cursor. Now let's first
get the API keys. We'll go on platforms.com. Then next important section is the API keys there where you
will create a new API key, and you will use this one
in the cursor or your IDE, where you will use the code
from the documentation. You can see there, I will
just create a new one. I can name it, for
example, cursor, but if you are using it in
different IDE, it's also fine. Quick note there, you can use any AI APIKey you
would like to use. For example, there's also
this Gemini free APIKey and if you will go to
astudio.google.com slash APIK, you will get on
this page where you will login with your
Google account, and then you will
create APIKey and you can also use this
Gemini API for free. Just bear in mind,
whenever I will talk about Deep Seek
or using Deep Seek, you will tailor the prompt
to use Gemini API instead. That's just information for you, so you can really easily
swap the AI providers. Now we will go to apitps.com, and there in your
first API call, we will have this
documentation that we will use to create
our first API call. We have there the base URL. API key is the one that
we just got on the page, and there we will be curious about this block of
code in a node JS.
7. Prompt 1: Core Functionality, Starting Point: Should now have the Next Jz
application from last lesson. If not, you can
create now with me. Also with trying to prompt, I will get us a command for creating the next
Jz with tailwind. There we will create a new NextGz project
also with tailwind. We will proceed. We will put a note source yes to a browser, and then the
recommended options. Now after it will finish, we will install the
Open AI library. The NPM I OpenAI, it will install this
and then we can start working with the code
we have in the documentation. We'll create an API
folder with Route Ts, and there we will
paste the code. Now I will change this
model to reasoner, as it's also there, and
I will get the API key. So I will go on the
platform deepsk.com. There. If you saved this key, you can just paste it and
we will put it there. It will be on this
position exactly there, and we will create a
folder, Deep Seek, and I will put the route there so we have better
folder structure. Now I will put that
into composer, act as an API endpoint to
interact with Deep Seek, and there you can
see it provided us with some code that
we can just accept. If you want to store
the deepsk API key in environment variables, you will just put it
there in dot N file. Otherwise, yeah, I can
now show you our API key. I will just delete it later,
so it doesn't matter. Now I will put there
a new prompt called Deep Seek API route from front
end to generate content. So this will create
a component for me where we will be able to prompt and get the
answers from Deepsek R one. Now we will also tell
Cursor to edit on the page. And now it should be ready. We will do NPM R on
deaf, open Local host. I can see there are some error, so let's just fix it with composer Now we are green,
so it should be fine. Now there is some
additional error, and before trying it, let's
just fix it with a composer. So it updated the route Ts. And now before we get to state where everything will
be nicely readable, I will just create
there a text file where I will show you
the prompt I made. So please generate a full
ing page in XS that will mainly display a chat window for interacting with Deep Skir. Page design should have
a modern futuristic, beautiful and minimalistic look. It should use Talen CSS,
dark them, and so on. We will paste it there, send, and let's see what ARO
will come up with. So it will paste the
answer of this component. There we get UI like
this, which is not bad. I will try to put
there another prompt with generating
some of the code. And you can see I'm getting the content that is something
we will need to fix in our code to get better
formatted responses and so on because he's giving
it to us in one row. We can actually ask
cursor to format it. There we'll just select
this, do CederK. Please format this. We can also try to switch the model for Deep Sk chat and we can do it
simply there in the model. Deep Sk chat instead
of the reasoner. If you'll save it
and prompt there Hello. Is this a reasoner
or a chat model? It will answer us that
this is a chat model. In case you would also
like to switch it, you can do it easily like this. But I will put it
back to resoner and we will now enhance the UI. Now we can try to
prompt with generate a responsive button component in Neck JS using talent CSS. So we are expecting a
component style with tailwind CSS to create a
subscription for our newsletter. Now we take a
screenshot of this UI, and I will provide it to
cursor and in composer, I will ask for enhancing the UI. So we are getting
these responses. Please create UI that will look better and will
increase the user experience. I want formatted
responses into code, better prompting experience with increasing the
lines when needed, better coloring, and so on. It will provide the
code for the component. We will accept it. And also, we need to install some plugins. So there as recommended, we will run the installation with the first command and now also the second one
or other way around. Now, it created additional
tailwind configuration file, so we will just merge it and we can delete
the Javascript one. And also, let's ask
for fixing this properly because we also need to install some other plugins. Now after setting this, we
will do NPM run Dev again. And it should work. So we have there our Deep Seek AI chat. I will ask for the component
for subscription newsletter, and let's wait for the response. And looking at the response, everything is
looking much better. I will now create
this newsletter component and put
there the code. I need to install this plugin, reactokFm so I can just do
it NPM I react took form. Everyone also helps us there saying how we
should install it. Then on the page, I will edit now before I will just
format this code. And we will edit there
below this paragraph. We also need to import. There we are just missing use client because this is a client component,
and now we have it there. And if we will send it, we should get the
success message. Now we want to implement
the remembering of the context of
our chat window. So in the composer, I will put a prompt to remember
the context, and there, I will now test it. Please generate the button with a simple functionality
with HTML and CSS. Everyone will generate
this button for us, and now we will ask you to
send it with tailwind CSS. That means he needs to remember
the last message what he sent and he needs to change
the CSS to tail end CSS. And as you can see,
he remembered it, and he provided us
with the button where we can see also
the tail end CSS. So now the context of
the chat is fixed.
8. Prompt 2: Design: We are to just stop at the basic chat
boood functionality and not go any further. Well now with the
second prompt at their switch and also
a templating feature. For switch, I want the
user to be able from switching from reasoner
to chat model. I just wonder some basic tagle that user will click
and he will have it. For templating, I want to
have there some template, for example, generate clerk
off for web application. And when user will
click that template, the boat will just answer him. With this, you can basically
add more and more templates, and then user can just be selecting the
template, clicking it, and the chatbad will be enwering and he
don't need to think, maybe you should generate
this, generate that, and so on, and we
will have there some basic structure of the prompt that user
can choose from. So let's take this prompt
and let's put it there. Now I'm in Crouser and I
will use the Deep Seek R one model but when you
use it on the website, if you don't want to use
Cursor or when you use it with raw code in VS code, should be also fine,
but you just need to provide the code to the tool
where you are using it. If on a website, you
need to just page there. In raw code, it can
also read the context. I will put it to composer
and we can see user wants to add two features
to our Next Jz application, and there it is,
we will accept it, and let's check the page
and see the new features. On our page, we have it there, and it looks like we can easily switch from
chat and reasoner, and let's try to put
there clerk of setup. It will paste the prompt. We need to update the UI still for this to be a bit more user friendly because you
can see there is the prompt for the
clerk of setup. So when user will want to implement it, he
will just click it. So what we would like is
to have this executed right away and not having additional step for the
user to click Sent also. And I would also like to put
this out of the chat window. So the selecting of the model somewhere
below or maybe above, and these templates I would put maybe on the left side or so
9. Prompt 3: Smaller features: Also enhanced this prom. I wrote it in more simple way, but then I sent this to AI, told it to enhance it for me, and now there we have it.
So let's go through it. First, I want to enhance the functionality of my project
by adding new features. What we need model selection. So I want to place this
outside of the chat window, and it's there
because I want user to be able to switch between
reasoner and the chat. For the second point,
the template features. So the template
features should be placed on the left hand
side of the interface. And there we want to also
add some stripe integration, prisma warm, environment
variables, and so on. You can add there more and more whatever comes in your
mind, you can add there. Yeah, it will be something what the admin will then
manage for his users. So I put there this example. Then what I'm missing there, to be honest, I cannot see the Let's continue,
and I will go back. But I think when
it was enhancing, it removed their functionality. Add functionality, I
will note it there, and I will get back to it.
Let's go to third point. Where is the new feature
to context Tuggle button. So this functionality should
add a button to interface. And when this is clicked, it will change a button
to indicate it's active. And when it's active, Deep
Seek should have a context of Make this AI modern and
minimalistic like Shed CN UI. The purpose is that when user paste code while
the mode is active, AI will return an enhanced
version of the code, improving its UI and usability to follow modern
minimalistic standards, for example, like in ChecN. Then I have there
also objective. So point of this
prompt is to create a feature each
interface where user have control over
module selection and last line we don't need. And now let's go back to the template features there
at the functionality. So what I did there,
the functionality is that when we
click the template, the deep Sk should start
responding because we don't want the additional step for
the user to hit also send. Now this is quite a prompt, but let's take it. Go to page. I will open a composer. By the way, you don't need to write prompts to
this prompts file. I'm just writing
it there for you. You can just copy paste it
from my Github and put it into your chat window with AI.
Let me paste it there. Let's see what Deep seek cooked. I will accept it. Now we should have it. Let's
go on the page. And maybe the coloring, I would use a darker one,
maybe the color details, we can get rid of them. Let's go back to ID. And now in composer, we will prompt that we want to update the UI of
our application, and I will put there that
I want subtle shadows, smooth transitions,
and rounded corners. You can put there the design
that you would like for your application or ask AI to enhance your prompt that will
update your application to some dark theme with detail colors that you
will mention and so on. Then I will take this prompt, put it into composer,
and let AI design. We will change just the
design, not the functionality. This is important
because we want to make sure that the functionality
won't be touched. So I will just ask for
removing the borders, I think we can do it. And to be honest, I
won't even prompt it, we'll remove this
Her border purple. David. What I will
also do is that I will change this deep seek thing because our page
is not deep seek. Our page is our page, we have whatever name
you will choose. Let's try something funny. So there in the header. I will do Cider plus
K. I can now change it to clothes because it will be just some
text generation. For the prompt, I would
like to change the name. So for example, I will use AI Fullstack Kitchen
and two description, something catchy,
used templates, built fast, ship today.
This is just an idea. Of course, up to
you what you will decide. I will save it. Now you can check back the page. Okay, maybe the
MOG is not a good. By will use this prompt. Maybe this heather nice,
modern, beautiful, catchy, minimalistic, futuristic,
and so on, but it works. So let's use this. I also prom there that currently it looks very basic.
I will accept it.
10. Prompt 4: Tweaks: What I know now is that probably this template
selection won't work, and I will also expand
the chat window because currently
it's on 1.5 line. Please refine current
functionality of prompt window in our component. Currently, the chat
prompt textbox in my chat application
displays just 1.5 line. And we want to improve this. The text window or the text
box should grow vertically, and I did something
like chat GBT. I also prompt there that maybe he also does
it on his website, but it's unavailable right now, so I cannot tell this will
allow for better UIC. Let's copy this prompt
and put it there. Hopefully I want to get
disconnected for this. No, but jokes aside, the reasoning is pretty awesome. Yeah, he's really on point. Everything makes perfect sense. I agree what he proposes. And so let's use the changes
he made. Let's accept this. Hopefully, he won't prank us because of the message.
Let's check the page. Now we will test the template, so I'll click there on Clark and you can see there
it's being sent, but you need to
click on the button one more time after you
click on it, the first one. We will need to implement
some confirmation at least, and it's actually
quite a good UX. So we can leave it like this, but we will implement also some confirmation layer on the top of the
selected template. Let's go with the
prompt five for the functionality when a
user clicks a template, and it appears in the textbox. Then when the user clicks it
again, add an enhancement. So user knows that he just
needs to confirm this. We will paste the prompt
there and we will send it to Deepsk There
we have the reasoning, and there is the output.
Let's accept it. This looks pretty good, but it's selecting almost
all the templates. That's something we need to fix, but otherwise it
looks pretty good. For the last template,
it somehow works, but we will manage to fix it. We are probably one prompt
away from making this work. Let's specify there
that for stripe N, this is working properly
for other buttons. When I click on them, it displays the conformation, but yeah, they are
tied together. We will again get the
reasoning of our one. What is there, the issue, how he needs to fix it and so on. Then we will accept all
now we will test it. Hey, and it looks good.
Now it's working properly. Let's try to confirm,
and it's being sent. And that means we
just implemented a new functionality
into our application. I will now test the design mode. Let's try to put there
some code and send it without context
and see what happens. And now I don't have the
active design mode checked. We'll first try it without it, and then we will check it.
There we have the code. You can see just
some answer what he can probably do with
this button that I sent for the prompt six. Let's put there when
design mode is activated, I want to return just enhanced
DI code with tailNCSS, no additional text
around and keep the good styling
practices as previously. I want to enhance this because when a user will use
this design mode, now you can set there anything
you would like for him. So for example, if you will have some TelnCSS context
for your application, you will just put
there, please use TelnCSS every time you
don't use pure CSS. You can set there
basically anything, and I really like this feature. I will put there for now the TelwnCSS and we will test it on a button that we sent before and we will check
what is the answer. Ideally, it should
be just a code with the tailwind classes.
And it works. Now we can in this use effect, update the output because I don't want these
codes start code end. We don't need that
because user would like to copy just the full answer
and put it into his code. He don't want to remove
code start and code end. He just wants to
send out the code, get the answer, copy
paste it, and that's it. I will prepare prompt because we need to have a copy
pasting feature. It will send us the answer. We will accept it.
Now we will test it, and we will copy this, and we should have it in our clipboard and
we can paste it. That means this
functionality is working and we will just add
a better UI to it. User will click on the
copy the clipboard. It will also change the icon. That will indicate that it
was successfully copied. Now we will enhance
the UI there. I will put change the color team to gray color with lime details. Then I will add a design
element, great background. You can just copy
this from my Git up. On the page, it will
look like this. We will remove some backgrounds. At some rounded Excel
classes to align our design, this will increase
the border radius. We have the back when we see a long message,
this will happen. We'll do the prompt seven. Please fix the issue where a user can write a long message, but it's not properly formatted causing the message to
expand, overflow, and so on. We will send it and
it should fix it. If you want to change the
color of the scroll bar, it's in Globals dot Css. By the way, for the role
there in the message context, we'll just fix it as
user or assistant.
11. How to Ship Apps Fast: Now it's time to add a back
end to your SAS applications. And what is the easiest way to actually at the
back end and have a working SAS application with already working
authentication, database, subscription
management system, and so on. It is using Strikit that you can reuse across your projects. There will be a core of
your SAS applications. Because once you have
this setup and ready, you can just build on top of
it multiple applications. You will just clone
the repository and you will build
application one, application two application
three, and so on. And like this, you can chip applications insanely fast
because it don't make any sense to reinvent
the wheel all over again each time you are
creating a new application. So now I will give
you two options. First one, use a Clerk building startikit which
is the simplest one, and second one, use the
Stripe Starter Kit. Berk Billing is using
Clerk Billing feature, which is implementing
Stripe on its own. There are some higher but still really small
fees per user. Basically, if you are building your first applications and we are talking about hundreds, maybe even thousands of users, I don't think there is that much change between these two. I'm personally using Clerk, but the Stripe Starter
Kit is quite fun. You have a bit more control. You are integrating
Stripe on your own, and it's still really good
to know how to use it. So you will get to
know how to use Clerk Billing or even a
Stripe SAS startukit. In the following lessons,
we will talk and go through this Clerk start okit that is the simplest
one that you can use. With Clerk Billing feature, there is really
nothing simpler to use for your AISAS application because you need to
handle only one thing or basically two things,
Supabase and Clerk. You will integrate these two, and they will work
seamlessly together, which is absolutely great because then you really
don't need to worry about the hassle with setting
up the webhooks for Stripe and Clerk,
which is great. So, in my opinion, this is
the best start tokit and these third parties
are the best ones that can start your
SAS shipping journey. I will explain to
you in the following lessons how you can use them. And then you can continue
with the AI videos I have on creating the
product itself later, and you can build on
top of the starter kit. So once you will understand the start ukit that I will
explain the next lessons, just prompt the AI, like
I will do on the project. And you will be building the features and the
functionalities, and then you will have
a working product. So now in following lessons, let's understand
the starter kit. Then let's use it.
Built on top of it in Cursor with prompts,
adding the features. Usually we are adding
them on the dashboard, and then you will have
working applications. Also, I will leave you a Stripe Starter Kit that you can use for the applications we are building later because when I was
building these applications, I was actually using
Stripe Starter Kit. But you can simply change it for the Clerk starter kit with
a Clerk billing feature. That is using Stripe, but a Clerk Billing is already
using Stripe itself, so you don't need
to worry about it. And it's really up to you
if you will stick with my original lessons
that you will see later and you will use the Stripe
Starter Kit that I will also link you in the
course resources. Just check the description. The link will be there, or if you will be using this
Clerk Billing one. In case you will be
using this first one, don't set up the webhooks
with Stripe and so on, and just check the
prompt videos and how I created the AI
applications later. So I will see you in
the following lessons where we will explain this
Clerk building start ukit. And the Stripe Starter Kit will be explained later or how to set the Stripe start
arquit will be explained later in the lessons
where we will be building the
applications itself.
12. Lets Build Reusable Backend for Our Apps: In this section, we will go over a starter
kit that we will use for our SAS application that we'll be creating with AI. In this section, we will make authentication work so we
can sign in and sign out. Also, we will make billing
work or subscription system, where we can subscribe
to a pro plan, and then we will get access to our product that will
be on dashboard, and we will also check how connection with
Superbase is working, how we can save data into
our SUPAbase database, and how we can get data
from this database.
13. Project 0 - Our Reusable Backend App, First Steps: We will go into VS code, and there we will open a
folder that we will create. I will create SAS, Dev, and here we can start. We'll first open a terminal,
and in this terminal, we will run a command or
creating a NextGs application. In best case with Tailwind CSS, where you can get this command. What I like to do is to go
on tailwind CSS website tailwncss.com there we
will click on get started. The framework guides, next JS. We are curious about this first. Now in terminal,
we will paste it, and we don't want
there to be my project because what this
would do is that it would create a new folder, my project inside
this folder that we already created for
our SAS application. So I will do there just
the dot and it will create a project inside our
folder. I will hit enter. Now it will ask me if it
should proceed, I will do yes. I want to do yes
for tailing CSS, no to source directory. No to Turbobek, no to Allis. Now it will install everything. After it's done, we can do NPN run deep to test our
new application. There we can see it
started running. And now I will go, for example, to app, page t six, and we there test and add the
text read 200 and save it. You can see Dalen is working because the
styling got changed, and we can continue and
start with the creation of the next JSAS starter kit that we will then use
for our application.
14. Project 0: Explanation of Architecture: Now let me explain how our
application will work. We have there our microsaS
and we have also clerk for off and Billing solution and SuperbaseO database where we
will store all the records. What will happen there? When we will first into our application, we will create user on clerk. It will be created only
there and not in Superbse. Our application will know
that the user is logged in, what's his name or
email, and so on. I can lead him, for
example, to use dashboard. Now there's also the
billing solution, and what the debt adds up is
that now we can also know if the user is paying for some pro plan or if
he's using a free plan, and that simplifies the
final application lot. Clerk will now check
if user is locked in. It will check if
he has a pro plan, and then based on that, we can display to
the user some pages, some sections to the user. So for example, we will let him go on dashboard after
he's logged in, but there will be, hey, if you want to continue using our product or some additional
features of our product, you need to get the pro plan
or however you will name it. Once he gets the plan, the information about
if he has the P plan, we don't need to
store in SupAbse. It will be stored in clerk and clerk will know
about our user, his email, and his plan version. Of course, you can
also know the name and other information, but the most important one is the email and which
plan is he paying for. And after we would like to store records that our user will
create in the product, we will need to communicate with Super Base and store
the records there. How you will know that this record is for
this and that user. How this will work is that
clerk will give us user ID, and we will store
it Super Base with also other information about the record we will be storing. For example, record ABC will be stored for user ID user ten. Which we will get from Clerk. Then let's say we will
move Super Base here, and we would like our
user to see product. Actually only user with pro
plan with based subscription. What will happen
in case this plan is free or anything
else than pro plan? Well, he's not
seeing the product, but in case he will
change to pro plan, our application will recognize
it and he'll be able to use anything where we will set that the pro plan is needed.
15. Project 0: Dependencies: Will install the dependencies. We will open a terminal, and we will paste there this command, and I will explain to you
what we are even installing. I will put it also the
dependencies dot text, but you don't need
to create this, I will be just storing there some handy files that I
will be sharing with you, what we are even installing. We are installing clerk, which is the authentication
and user management, but also the billing
that we'll be using Tupa base SSR
and Suba Base JS. This is a Super baase
client libraries for database and of class
variance authority. This is a utility for managing tailwind CSS class variance that you will understand a
bit later and you will see how we'll be
using it. CLA six. This is a utility for
conditionally joining class names. If something will be true, we will join some
Tailwind CSS class name, then framer motion. This will be
animation library for re that we will be
using for animating our components later
when we will be working on a better UI
for our lending page, it react icon library that we'll be using ripe we
don't actually need. They willnt merge. This
is a utility to merge. Ten CSS classes that we'll be also needing in case
we would like to add some additional DLN CSS
classes to an element where some Talen CSS classes will already be and
tailwind says animate. This is a prebuilt tailwind
animation utilities and that which is typescript
first schema validation. That means before we
will send some request, this can validate the form where we will be
putting the data, and, for example, will tell us, Hey, you need to fill
in this title or this description in order
to save this record. Now we have it there,
I will hit Enter and now it will install
all the dependencies. Now we will go to package dot JSON and there
instead of Sent we will put next int command what this means and
why we are doing this. We are using NextGS
and in this case, next Lind automatically uses Next JS configuration and applies some specific
Next JS lint rules. What is it good for? It will help us catch code issues early. Then when we will be doing the build, it will tell us, Hey, you need to fix this or that and after we will be
dpling our application, we won't run into any issues.
16. Project 0: Env Variables: It's time for environment
variable setting. What does it mean? It
means that we will create a new file and
we will call it dot NV. Now in Gignor, we can
double check that this file is here because we definitely don't
want to deploy this file later to our
Githup for example. You will have there
all the secrets and definitely don't
expose this file to anyone because then the person
who will get to this file can get access to your
clerk or Super Base, or maybe some AI API key
that you will paste there later for your application and you can take
advantage of it. Definitely don't do it. Going through this application, you will see the fake values
of my environment variables. But of course, for
learning purposes, I will leave this
file unblurred, but it will use fake values. There which values
we need to get in order to make our
application work. It will be just clerk
authentication, next public clerk publishable
key and clerk secret key. And then from Sup Base, we will need Superbase URL, Superbase anon key, and
Super Base service roll key. It's easy to get these keys. The only thing we need is to sign up or sign
in into Clerk and Super Base and get them there and paste it
into this Doden file. And now we will go
through this together and we will set these
environment variables.
17. Project 0: Supabase: After we will log
in to Supabase, we will create a new project. There I will name it SSNf. I will generate the password. I will copy it and
store it somewhere. Don't worry if you want to
store it or if you forget, you can generate a new password later in the settings.
It's no problem at all. Then I will choose a region and I will click
Create New Project. Now I have it there,
I can click Connect. I will click on App Frameworks, the NextJs using a
Brower with Supabase JS, and there in local, you have the secret keys, and you will opy them and paste them there
instead of these two, and now you will get
Supabase service Row Key. Now we will continue
into project settings. There we will continue
into API keys. And there we will reveal and
copy service all secret key. We will paste it
into our Doden file, and now we have all
secret keys for Supabase.
18. Project 0: Clerk Setup Test: Or Clerk, we will need
to sign in or sign up. I will continue with Git up. Then we will create application, and I will name this again de, I will enable login
with email or Google. I will create application and there I will
click on NextJs, and we already installed
this dependency. There we can copy the environment
variables and we can paste it into our Dudan file. We will paste it there
instead of these two. Now we should create
middleware file, file for this sign in, signup. There is also how we should
use this Clerk provider, how you can use sign in and
signup buttons, and so on. And we will set
this up together. What we need to
do is that first, we should create a new file
there in the root folder, middleware dot Ts, and we will paste there the code we have on the Clerk page setup guide. Then you can see we
will select a browser. And what we need
to do is that we need to go to layout TS six, and there we want to do the exact same steps
as are in this guide. But we will paste
the Clerk provider from Clerk NextJs library, and then we will wrap these HTML text we have in this return into the
Clerk provider text. I will put it like this.
Now I will format it, and in the end it
will look like this. Now our wall application is
in Clerk provider context. We can check if
user is logged in, logged out, and so on. For now, we can click their
continue NextJs Guide, and you can read there
more information. For example, how
you should create the sign in and
sign up pages.c6, and what we will do. We will create these sign in and sign up pages in our app. You will need to create this
off folder, or actually, you don't need to create
exactly this off folder, but I will explain why it's
good to create this one. We have this in parenthesis because it won't
actually get to URL. It won't be our page
of slash sign in, but just our page slash sign in. If it's in parenthesis,
it's just for us. We have a better
folder structure. That's a good approach.
We will put this off, and we will have the sign
in and signup folder. In sign in, we will also need to create another sign in
folder in this format. It is very important
to have it like this, and then in this folder sign in, you will create page T
six or sign up the same. So you will need to
create sign in folder. Inside this sign in folder, you will create sign in folder with these
square brackets, and there page t six inside. And what is the meaning of these square brackets
with these dots? It is an optional
catch all sub paths. It means when we have sign in verify or sign in
slash SSO callback, it will still fall into
this page dot Tsix. Now we can move to
page DTS six itself, and this is just copy pasted from the official
Clerk documentation. You can actually see
it on their page. And I just edit
some styling there. We added there flexbox layout, justify and items center. So the sign in or signup form is centered in the center of the page and it's
not aligned to left, like it would be if you didn't
add these tailint classes. And I also added the
minimum height screen. So it's not aligned to top, but it's in the
middle of the screen. And as there is no other
content on the page, I would add this minimum height. Now what if we test
our Clerk connection? So first thing, what we
will do is that we will go into app page dotTSix. This will be the
Landing page later, and there we can actually delete the wall next JS template. We can leave there just the
wrapping diff that's fine. And we can start with
importing there. Again, if you will
go on the page, you can get there Read session and user data in your NextJs
application with Clerk, and we can basically copy this, paste it there, and we
will just update it. We will paste it into page
Taix in our app, this one. And there what we will
do is that this import, we will paste on top, then we will take this and put it into our
export of the page. Now here we need to make this asynchronous and it will work and there is an error that the user can
be possibly null, so we can adapt
this question mark, it will be also taking
the null value. This question mark is
an optional chaining, and we can access first name now only if user is not
null or undefined. And if user is null, this expression will
become undefined, but our application won't crash. So it will display just welcome. But it shouldn't
matter because if the user won't be authenticated, it will return sign
in to view this page. Now as we saved this testing data that we got
there into documentation, we can actually
open our website. If you rerun the server or
didn't run NPM run Df at all, you can refresh the page and just make sure you are
on the correct local host. Let's give it some
better styling. Let's do text seven
Excel. We can see it. Let's give it text nine Excel. I will increase the text
size so you can see it nine Excel, enter with full. I can do the same thing
for this welcome, maybe seven Excel, and
this is just for testing. Now we can see sign
in to view this page. Of course, we are not signed in, so we cannot see this page. What we will do is
that in the URL, after our local host, 3,000, we will use
slash sign sign in. This will redirect us here. Now there we can sign in. But of course, we need
to first sign up, but Clerk does
this automatically if you do continue with Google, for example, but we can
also test it, sign up. You see there the layout
and how it is centered. I will now select the user
I want to sign up with, so I will continue
with Google and select some of my
Google account. And once I'm in, I can
see there welcome and the name of the account I
signed up and sign in with. I have there. Now we can
see that this is working. And if we will go into
Clerk and refresh, we can also see user that was logging in here in
our Clerk account.
19. Project 0: Clerk Billing: Now it's time to set
up Clerk billing. So we will go on subscriptions. We will click Get Started, and there we will create a plan. We will have their free plan. We can leave it. We will click Great a Plan. We will
name it to pro plan. We refer to this plan, we
will need to use Pro plan. We can put there
some description, but we don't need to do
it for now, to be honest. And monthly base fee, we can do or 99. And annually, $2.5. That will be $30 per year, and we are doing this on
purpose because we would like our users buy the annual subscription instead
of the monthly one. We can put there
a free trial for seven days, and
there on the bottom, we can add features for now, I will put there a full access. I will create a feature,
I will already there, and that will be enough.
I will hit Save. And with that, we created a
pro plan. Now it's saved. We can go back to plans. We have it here. Now we
will click Enable Billing. We have billing enabled
and we can create a pricing table on
our pricing page. We will go into a folder, and there we will
create a new folder, and there will be
a pricing folder. And inside, we will
create page Ta six. On this page TA six, we will return a div
where we will put this pricing table that we will get from
Clerk next to JS. We will import it there
and put it on the page. We can add some styling, so let's actually first
open the page. There on our page,
just do slash Pricing. There we will do maximum width. Let's do maximum
width three Excel. We can do background white, so we can actually
see our section. Now we'll do flexbox layout with justify center and item center to center it horizontally
and vertically. We also need to do
minimum height screen. And now what we
will actually do, let's take away item center. Instead of justify Center, let's do AMC Auto. Now it's in the middle.
We will delete background wide because we already
know where it is. And we can choose if we want
to have a free plan that is active for us right
now or new plan. Now, let's test to the plans, and I will just
delete these comments so we have it more clear and
we can test more easily. I will now add this has, and we will await of
where we can get this. And we'll be using this
for checking the plan. That means now we'll create
a constant, a pro plan, and we will with this has
check for the pro plan. Now, in case user is
without the pro plan, we will do an exclamation mark, so in case it's false, we will return you
don't have a pro plan. Now we will check if
user has a pro plan. So in case with this
exclamation mark, it basically flips the value. If this is false, it will return. You don't
have a pro plan. In case this is true, this if condition will
be skipped and it will continue into displaying
welcome user first name. Now we can go to our page. Let's remove the pricing,
and there we have it. Let's also add the text seven
Excel so we can see it. You don't have a pro plan, and that's true because we
have a free plan actually. Now we will go to Clerk and
there we will actually check, what is the API name
for the free plan? There we will go to configure
subscription plans, and the plan key is free user. That means we will
go back to our page. And instead of Pro plan, I will be looking for
a free user plan. Now I'm in because I'm on
the free user plan already. But we'll be checking
for a pro plan. But with this, we can do
conditional rendering based on plan of our user. It's easy like this,
and now we'll create a file in our newly created lip folder that
we will create together, and there we'll be checking
the plans of our user. So in our other files, we can reuse already created code that we will store
in a different folder, and we don't need to recreate
all of these lines again.
20. Project 0: Lib Folder and Subscription Util: We will create lip folder. This will be a
centralized location for utility functions, configurations, and shared code. Is purpose is to keep business logic separate
from UI components, house reusable utility functions that don't belong to
specific component, and also it can contain configuration files
or setup code. We will put there
database utilities, authentication helpers, API utilities,
validation schemas, constants, type
definitions, and so on. The benefits of
having our files in a folder like this
is reusability, so the functions can be imported across
multiple components. We will put there the
subscription checks of the plans, and we can reuse it across
multiple components. Of course,
maintainability because then we have a central
location for the logic. But when we will need
to do some updates, we can do it just in this file and not across
all the components, then that goes into a
clean architecture. But in the components, it
will be more about UI, and the logic will be in this
lip folder and type safety, because the shared types will ensure consistency
across the application. But for the types and all these other things I
mentioned, we will get later. Now we will do the subscription helper in this lip folder. Loop folder will be
created in root folder. That means inside
our SAS Def folder. And inside, we can start
with creating the file, and that will be
subscription dot Ts. In subscription Ts,
we can now start with creating this user subscription
management utility. This file will handle
the plan detection and validation using
Clerk authentication. It will provide us with
a utility to check the user plan status
and for us to control the access he will
have through the application. Inside subscription
TS, we will first import off from
Clerk NextJs server. Then we will define the possible subscription plan
types for type safety, and that will be free or P. Then we'll create
asynchronous function, get user plan, and this function should retrieve the current
user subscription plan. Basically, if user has pro plan, it will resolve in P.
If he has free plan, it will resolve free, and if user is not authenticated or has
no recognized plan, it will resolve Null. That's also why we
will put the promise, and this promise will
be to plan type, which is this for
your pro or Null. In simple terms, this
means that this function is promising that it will
return plan type or Null. We will destructure the he
method from Clerk of object. Destructuring means
extracting a property from an object and
assigning it to a variable. Here we are calling
off which will return an object from
Clerk with the user info, and we will extract its he
property into a variable. In case he will be
type of a function, we can continue with
checking if he has plan pro. And in case, yes, we will return Pro. In case it will have a free
plan, and in our application, free plan is under
API name free user. We will return free. And what if we don't have this? So user is not authenticated
or has no valid plan? Well, then it will skip this
part and we will return now. And now to test this, what we can do is that we
will go into our page, their app page, and I can now import this subscription
TS so I can import, get user plan from
subscription file. And there I can do const, and there I can create
a variable plan. I can await, get user plan, and there I can do
if plan is not. Pro, then display, you
don't have a Pro plan. Let's go to our page.
Now on our page. We will have it. If
we will do there, this shouldn't equal free, it will skip it and go on to welcome rendering because
our plan is currently free. What does it mean?
This means that now we will need for the
conditional rendering, need to do this plan is not equal free or is
equal pro and so on. To save some lines of code, and now actually we can delete this because we have
it in our subscription dots, but this file is just
for testing purpose. We will actually go there the UI for our lending page later. You can now see that we
will need to do this check. Hey, is it free, is it pro or so? What is a better approach
is that we will go into subscription dots and we
will create the new method. And that method can be export asynchronous
function, check pro plan. We will put our promise Bolin This will be returning
through or false. We will create a variable plan. We will await the function, get user plan, and we will
return through or false. And to say some
additional lines, we could also do variable, then save True or false based
if the plan is pro or free, but simply we can return the
comparing of plan to pro. So this will compare to strings, plan string and pro string. And in case the plan is pro, now in our case, the plan type, which is returned there
can be pro or free. In case it's pro, it
will return true. In case it's free, it
will return false. We don't need to import
to get user plan, but we will import
check Pro plan. Then we won't be
awaiting get user plan, but we will be awaiting
check Pro plan. And we won't be saving
this into a variable plan, but we will find a better
naming now maybe is pro user. And then we will put it
into this if condition. Now, in case it is pro user, it will return, you
don't have a pro plan, but we want to do that check. So it should be like in
case it's not a pro user, in case this is
pro user is false, it will display, you
don't have a pro plan, which is true because
we are free users. Currently, this value is false. And this if condition will happen only when
the value is true. That's why are we doing
this exclamation mark? Because otherwise
we would need to display in if condition
everything else. And this is much
simpler because now, in case user is not a pre user, we are just displaying
one sentence. And of course, just
to be totally clear, we can display the DIF and into this div we can put
much more things. This is how our
subscription TS file in Lip folder will work, and that will be it
for this lesson.
21. Project 0: Navbar: Start with creation
of a navigation bar. This component will be
shared across application. We will create a
components folder that will be in a root folder. So in our SAS Def folder, we will create components, and there we will create
Navbar dot Dasix. In this SNAP bar, we will
first define use client. That means this will be a
client component because it will be using Blind
site interactivity. For example, for the navigation, when we will be changing
closed and open navigation, we'll be using State Hook, for example, and I will explain
more on that in a while. Now let's continue with
importing ink from next Link. And why we will be using this link instead of
a normal anchor tech, it is because in the
next application, this is preferred over
a regular anchor tech or internal navigation. It will be faster,
better transitions, without full page reloads. Then we will import
sign in, sign out, sign in button, and sign out
button from Clerk NextJs. This we'll be using for handling the sign
in and sign out. Then we will import
icons from UCT react, menu and X icon, and U State Hook from react. Then we will continue
defining the Navbar function. And we'll create
export for Navbar. Inside, we can start with the first state that
will track whether the mobile menu is
opened or closed. We will create a state
variable is open, set is open, will be setting its value, and default state will be false. So default la, it will be
closed the mobile menu. Then we will create a
function, Google menu. And in this function,
we'll be using the set is open to set
is open state variable. This will be the toggle for it. There we will call set is open, and we will change
the value of I open. So if menu is open, it will close it and if it's
closed, it will open it. This toggle menu,
we will call from this menu icon that we'll
implement a bit later. Then we will create another
function, closed menu. And this function where
we set is open to falls, not to other value, simply to falls, and when we'll be using this
closed menu function. We'll be using this
when a menu link is clicked or when the
menu should be dismissed. User will choose a
dashboard or a pricing, then the menu will automatically get closed because that's
how the UIx should be. Doesn't make sense to just
redirect user to page, and then he needs to
do an additional click on closing the menu. That's some additional click, we definitely don't want. We'll use it like this
and now we can do return. And in this return, we can finally
start with Navbar. We will open the dif tech, and there we will
do the styling of the navigation bar that we
will be putting on our layout, and we will be using it
across all of our pages. For the navigation bar itself, we can now go to page t six, and there we can actually, you don't have a pro plan,
just next, for example, so it doesn't take and doesn't distract us
that much for now, then we can go back
to navigation bar. We can continue here. First thing that we
will actually do is to change this Diff
tech for a NAF tech, and then we will
continue with classes. First, what we will do is that
we will put there width to full xbox layout and justify center to center the
nav bar horizontally. Then we will continue with some pedding wi
pedding so bedding on top and bottom and
on medium screen, we can increase it, but we can play with these
values a bit later. Now inside, we will
create a dif tech. In this dif tech, we will
create some maximum width. Let's do for Excel. Now we can do some
different colors so we actually can
see it on the layout. But first, let's also add some horizontal
padding or padding four. So now if we add some content, you cannot see it yet because we need to
add it on layout. We'll go on layout to TS six, and we will add the
naugbr there above the body, we will hit Enter. Now it's imported
from components, and this means that
through our application, this will get rendered
on every page because it will be rendered at the same time with the
children every time, and the children will
be, for example, this page, but then also the
dashboard page and so on. That means now we
have the Navbar on our website on our page, you can see it there.
And we can continue. Next thing that I will do is
another div inside this div, I will put again, some bedding. I will put the horizontal
bedding six and vertical bedding four and flexbox layout center this vertically and justify
between horizontally. What this means is that if I will do their element
one, element two, and element three, they will have the eco spacing
between them. So if there will be like
this is an example, imagine there are three lines. Now, there will be three
line spacing also 2-3. So the spacing is always equal. That's good because imagine
there will be a logo, there will be menu
items on this element, and there will be
auto action can be Contact me button or
something like that. Let's move and go the elements. There we can start
with one for logo. Let's add a flexbox layout and item center to center
it vertically, then continue with another div, and into this div, we'll add
some width and some height. Round it full to make this
a circle, and for now, we can use background lime 400. Now, let's also at flux
Box layout and center this horizontally or
vertically and horizontally. Now we will put the logo.
I will put it like this. And let's actually
put there just a low, for example, and also
put there text black. It may be font bolt. Now you can see the logo
in our navigation bar. If you want to make
it nicer already, we can go to this div
below this Nap deck, and we can do the
backdrop blur to Excel, then round that Excel and decrease this background
green to lime 720, that will add to it 0.2 opacity, and backdrop blur now won't be visible because there is just a black
background behind it, but you can add it there
in case you will use some gradient background
or some different one. It will also have
the backdrop blur. Now we have it on our
page, and of course, we can even decrease
the opacity, maybe 0.2. 0.1 will be the best one. And if you would like,
you can also add border and border white. So you will now see the border. But of course, we
will add there lime 200 or let's use 500
with 0.1 opacity. Not a visible. Maybe we do 0.3. Yeah, something like this. And also, we can use the
background gradient. If you would like to
do background gradient for your navigation bar, you will just do background
gradient to write from lime and you can now choose
which tone it will be 100 or 900 or
something between, and then it's opacity, and
you can put there too. Let's put the test
color red 200. Now you can see
how it looks like, and you can also put there a, for example, orange, 300. Obviously, these colors won't
work together, just a test. But now I will put
there lime Lime, and I will go
through 600 to 500, and I will also add there
the opacity 2.1 and 2.1, I will have a color like this. Of course, this is background
gradient to right, so I can also change it to bottom or to left
or bottom right. For now, we will leave our navigation bar
looking like this, and we can continue
with the coding. There we have our logo
I will leave there LO, and we can move to
navigation links. So I will create another div and in this div, I
will create a link. And for this link,
I need to add HRF. Otherwise, it will be
throwing an error, and it will lead to
our lending page, which is just an
empty slash for now, because if you will
see the path for our lending page, it's
there in the app. So its URL will be local
host 3,000 slash. That's it. And after we have this HRF, we can continue with styling
or the styling that we will add there is text
white with 0.1 opacity. Now we will add the text
with visible in our Navbar. Then we will continue on however we will make
it fully visible. So we will just change
it to text white. Now you can see how
it will be changing, and we can continue with
text small, and that's it. We actually don't need this div. Now it should be fine. We can
start with text from Clerk, but we will put there signed in, and in case user is
already signed in, it will display the content that will be inside this text. I will put there a
link. Inside this link, I will put a dashboard
because we want to display in the menu only dashboard in
case user is signed in. And now we throw an
error, of course, because we are missing HRF for our link where it
should be dashboard. And the class name
will be again with 0.9 opacity and on how
make it fully visible. We can actually take this text small and put it
into styling there. I think we can also take
this text white with 0.9 opacity there and maybe we can increase
the opacity to 0.8. Now we are displaying
the dashboard once the user is signed in and below, we will do another link and
this one will be for pricing. So again, we will put the HRF or pricing and class
name that on Her. This should be text white. Now the good question
is why these two divs are not pushed to left and right and they are
next to each other? First, we will put
the width to full, and for Excel is
too much, let's do. To Excel, now it's much better. And also, now we can
add additional div. And this div will be for the contact button and
for authentication. Also with the
mobile menu button. In case, this will be on mobile. So first, inside this div, we'll put the flexbox
layout item center to center it vertically, and then inside,
we can do signed in and in case the user
will be signed in, we will put there
sign out button. Inside the sign out button text, we will put a
button or sign out, and we will put
there some styling, which will be being four, PY 2.5, and on Her
text to white. Now let's put it and
background can be. Now we can figure out
something or we can do just the border and border lime 800.3 opacity and rounded Excel maybe actually let's
do it 0.7 opacity. This will be for signing out. Now we will add also signed in. Blow, we'll put a
signed out text. That means when a
user is signed out, he will see the content
that will be between these texts and there will be a sign in button
there we will put atge in and the styling we will add will
be quite similar. Horizontal padding to four, vertical beating to 2.5
on our text to white, and we will add actually, we won't add any borders. We will add a background, and let's figure out some
nice background for this. First, let's actually sign
out, so I will click it. Now we can see how it
looks like rounded Excel, we can do 0.3 opacity and also we can do background
gradient to bottom right or just to right from lime 900.5 opacity to lime 800.3 opacity. And actually, I figured
out better styling on how I will make this background
white with 0.3 opacity. Without hovering, this will be background white
with 0.1 opacity. I will have a border, and the border color will be
white with 0.2 opacity. Now we have the signing
button. Let's try to hover it. It will look like
this. And with that, we have the signing
in and out finished. And there, by the way,
for the menu items, let's put there SpaceX or, that means it will keep some horizontal space between each element inside this div. Now we can continue to the
mobile navigation icon. There we will start with
the div and we will make this hidden on medium
screen and above. So if our website will get
past the medium screen, this element will be hidden. That means on a mobile screen or maybe smaller tablet,
it will be shown. And then if you will go to desktop or maybe a
bigger tablet screen, it will be hidden. And by the way, these menu
items should be otherwise. So there, this should be
hidden on mobile screen, which is the default screen, so we don't need to specify there some mobile or anything. And on a medium screen, this will be actually displayed. I can put it like this. Now, if you will change
it to mobile view, these menu items
there will be hidden. And this mobile icon
will be displayed. Now we need to add
this mobile icon, so it will be
actually displayed. But we will do this right now. There, I will add a button, and inside this button,
I will add a condition, and in cases open is true, it will execute a close icon, which is this icon for us. There we can add a
class name height and width to five and
actually text white, we can add here. In case it open is false, we will render the menu icon. And again, add the class name of height and width to five, text white is here. What we will also add
into this button will be pumping round at Excel, and on how we will
change it to background white with 0.3 opacity like
we did on the signing button. Now what we also need to add to this button is onclick function, and on click this will call the Toggle Menu function,
which we created. Now, if we will inspect, you can see we have the icon. And it's working. Of course, the menu that we'll be siding in with the menu items
is not there yet, but we will code it in a while. And let's continue with it. We will first clean it here. Now we should have a
button and four divs. And there, we should start with again condition in
case is open, is true. We will render this div, and there is no
false in this case, because in case it's false,
we won't render anything. It will be just the
desktop navigation. Okay, so there in this dish, we can start with the styling. On medium screen,
this will be hidden. Also this will be
fixed in set zero. So now we will set all sides
to zero as this is fixed. We need to set the position. Instead zero tells that, hey, bottom, top left and
right should be zero. And that index, we
will set to 40. Now, in side we will do div and this div we will
pose it right away. And we will put the class name of fixed position in set zero, like in the div above,
background black with 0.5 opacity and
backdrop Blur small. On clique, this will call
the closed menu function. So in case we will click
it, it will get closed. What is this and
what it should be? This will be the background for our mobile navigation
in case it gets opened. You will now see the nexton. We will just put there the
menu content, the menu items. So let's create a
disk at the fixed, we will set left and right to four and top to ten
and set index to 50. Then we will continue
with another div. In this div, we will
add some bedding. So let's use Bedding six. And we will at the
border, and I will say that border color white with 0.1 opacity and the relative bus because we will have
there some epsolde elements on this div. We will put the closed button. So I will put the
button and on click, this will call again close
menu and class name, we will put the
absolute position, top two right to some
width and some height. Some border radios,
so I will do rounded medium on Her background white with 0.1 opacity and a border with
border color white, 0.2 opacity, then a flexbox layout to center everything with items
and justify center, and that will be it. We will add the X icon. We will add there the
width and height. Now let's see how it looks
like we will inspect it. We can see it there
on our website. We can close it now, and
we can first continue, and then we will polish it. Below, I will create a
div, and in this div, I will put a flexbox layout with flex direction column that means all the elements in this div will be
below each other. I will do some
spacing between them, so I will use space Y, four. I can also do three maybe, and let's increase it later
in case it's not enough. We will center it
with text center, and margin from
top will be eight. Now I will at the basically the same content that is on the
desktop navigation. What I can do is
that I can just copy it and paste it there. Let me just format
it. Now we have it. I can try to open the menu, and we have it on our website. There, I will try
so you can see it. So it works like this. What we will do is that instead of on Her and doing
the text white, we'll do Her background
white with point opacity and also round it to
Excel and some petting, I will do Bedding four. Let's go for opacity to 0.1. Now it's better. Let's also
increase the margin from top. I would do the I
will do their 12. Now it looks like this. Now I can take this hour and
round it and bedding and edit here and here for
these two other links. One more thing we
need to do is to also add the click Close
menu to these links. Simply at their OnClick
and close menu. Otherwise, as you can see
the menu was not closing. And now if we want to go, for example, on the homepage,
we will just click it. It will redirect us,
and it will get closed. Now we need to do
one additional thing and that is some margin to our sign button or also sign
out button. They are here. And now, this sign in and signo can be also moved
to the mobile navigation. Let's open our
mobile navigation. Let's take these two buttons. Let's put them into a div There we will do. From
medium screen and above, we will display this flex. And now let's change
this to medium screen. We have it there,
everything is fine. And now what we can do, we will take this signed in, sign out, copy paste it, and we will put it there into this
dish below the pricing. Let's again format it
Now we can save it. And we have it here. Sign in. We can sign in. It will
redirect us to Clerk. And if we will change it to desktop, we will
still have it here. It will work the same.
It will just get hidden. And on the mobile screen
will be in our navigation. Let's format it like this. Let's delete these empty
lines, save our file. And with this, we have
our navigation bar ready.
22. Project 0: How to Change a Font: Are looking for changing a
font in your application, in documentation, you can
find font optimization. And there, if you
will scroll it down, they recommend using
variable fonts. Vial opens, there
will be a list of the fonts that you can use
that are the best ones to use. And for example, a popular
one is bricklash grotesque. Then you also have
the Roboto family, and you can pick you can
choose from a lot of fonts. For example, we can now try
to stick with grotesque, how we would change
our application. Use that particular font is
that we will go into layout. We are using this font,
how we will change. It is very simple. We will
import bricklagGrotesque. Then we will create a variable there and we will save
settings of the font, and we will use it there for
the settings of the body. Now in the global Zo CSS, we and Body change the font
family there to our new font, and also we don't need
this team in line. There is just a setting that
we prefer dark color scheme, and we are using this in case we would be adding a
team switch later, and now our new font
is on our website.
23. Project 0: Dashboard and Final Test: Finalize our starter kit, we will now create
our dashboard folder. So in app folder, we
will create a new one, dashboard, and inside, we
will create a page Tasix. Now we can copy the homepage, and we can put the
dashboard, save it, and basically get the content here and paste the content
and put it on this page. There we will put you
need to have a pro plan. To get an access, we can delete this
is authenticated because user will be
logged in already. Otherwise, he wouldn't
even see this dashboard, and there we can keep this welcome with the
first name for now. We can delete this is authenticated check
also from there, and now we can go to the
main page to a page, and there what we can
just do is to put a return there we
will put di for now. We can put the
lending page text, minimum height screen,
flexbox layout, testify and items center. We can put this in some. This can be a heading. There we can put text, Fi Excel. And for now, this will be our placeholder that we will
keep for the lending page. Of course, this is more
just a starter kit, so we don't need to put any
lending page there for now, and we will customize it for every product
that we will be creating with this starter kit
that we just now prepared. On a dashboard, we have now the check of
the subscription, and we can test it. So let's sign in. Once I'm signed in, I
can go to Dashboard. Now, I can see that I can
access the dashboard, but I don't have a propan, so I cannot access the text. Welcome, use refers
name like it's here. Actually, I have a free plan, and in order if you
want to test this, you can also change
the pro plan to be accept free plan for
just the testing purposes. But it will be also
possible in clerk to start there some testing
mode that you can also then just get the pro plan for free for your testing
user and test it with that. But this is also some
simple option that for now, you will change fuser
plan also to a pro plan. And then once you will be
testing and doing everything, you will just put there
back the pro plan. Which is, I think, like
this with API key. No, it's just P. So therefore, now we will put a free user and we can be testing with this. For the starter kit
itself, that's it. We have a homepage, dashboard that is visible only after login and a content that
is visible only after subscribing
to our application, pricing where we have
the subscription ready. We also set there
seven day free trial. When built annually,
there is a big sale, and after we get the pro plan, we can see the
dashboard content. Where will be our product?
24. Project 0: Supabase Clerk Integration: Do clerk and Supabse
integration. In clerk, we will go in
configure and integrations. We will check Superbse
and manage integration. Here, we will select the
application, workspace. Instance I will have
development and there we will copy
this clerk domain. In a Superbase, we will
go onto our project. Here we will go into
authentication. Sign in providers,
third party off at provider clerk and here we will paste the URL
that we got from Clerk. I will create connection. And now I have it ready. So I can move and start
creating the tables with all the policies and
subobase we will need for our users
in order to insert, edit, delete, or update records.
25. Project 0: Create Tables and Policies with Supabase SQL Editor: Now we will go into SQL Editor, and here we will
paste this script. And what this script will do. First, this will create a record test table with primary key, which is ID of type W ID here, and this will be unique
identifier for each record, and it will be
automatically generated with this function
generate random WD. We will also have a
foreign key here that will link each record to a
specific user from clerk. And with this of JWT to SAP, this will automatically
get clerk user ID. Then the data field
that we will use for testing where we will
actually put some content, the user will be then
able to save it, edit it, get it, and delete it. This will be just for testing. Later, you can imagine it as some other fields that we'll
be saving for records, and some of them can be null, some of them cannot. This one, for example, as it's the only content field we
will have cannot be null, then timestamps of
created at and updated. And default, this will
be set to time now. That means after the
record is created, created and updated will be
set to the current time. Then we will create a database
index or the performance. That means when we will
be quering the user ID, this will query much faster because we will have the
index and it can jump directly to the relevant rows
and it doesn't need to scan every round in our database
or user's records. So this create index, record test user ID on
record test with user ID, Raw will do it for us. Then we'll be creating
autodate function, and this means that updated at field will get automatically updated to the current time whenever a record
will be modified. With the script, we will
create the function, updated updated red column. Then we will create a trigger
to autocll the function, so the updated red
happens automatically. Then on the last line, we will enable database
level security using the clerk authentication. Now we can run this script.
It will create the table. You can see here, table
editor record test. Now let's insert the policies. We will put there this script. Let's start with the
first read policy. We will create first a new Row level security
rule with a name. This name will be
on Ross Select. It will be also on our table. This is our table record test. It will be for select
operation that means user needs to select the records in
order to read them. So if he wants to have his page filled with some
data that he saved, he needs to basically do select
operation to Super Base, and he will get to the records. So this is for Select. Then this is to all
signed in users. And this using this
will show Raw only if a JWT sub is equal
to Raw user ID. That will compare the user IDs, and in case it will recognize
the user, it will say, Hey, in this JWT token, I can see that is this
user in simplified terms, it will let him read the record. Then it's basically the same for all other policies on
delete update and insert. But there you can also see with check and using with check. What is with check? With check is basically that the row that is
being inserted into our SupAbase must have user ID equal to the
user ID and JWT Sub, and for update, it has both using and with
check because first, it will check that
there is the user ID in order to display
that record and with check will be here for
user ID that we need to match in order to do this update operation
to our superbase. And for deleting the data, we will again check this. We will be using these RLS
policies for our new tables. We will need to set it
because we need to set these row level
securities to create the security layers we
need for our application. And yeah, now we can run this. This will create the
RLS. I already run it. So for me, it will throw an error because
it already exists, and now we have data table with the
row level of security, and we can try to create and get some data
from our database.
26. Project 0: How to Fully Test Project 0: And now the fun part can begin. We will go into our
dashboard folder, and there we will create a new folder,
underscore components. There in this
folder, we will keep all components that will be
related to our dashboard. I will create inside a new file, and I will name that file,
superbseTst dot Tsix. There I will paste the pre created code that I have for this testing purpose, and I will show you the code. We will go through it
and I will explain you what it does and how it
will test our connection. Now, if you would like to test the Superbase connection,
creating, deleting, updating and getting the
records for your user, that you are locked in
as in our starter kit, you need to do these things. First one, I will first help
you how you can get there, and then I will explain
you what these files do. But if you now want to
test it and make it work, you need to do exactly this. First thing is that
you will create supabse dotts file
in this lip folder, and you will paste
there this code for creating a server
Superbase client. Also, you need to make sure that you have these two
environment variables. Next public Superbase URL and next public Superbse on key. It needs to match, and these are the values that we
got from Superbse. Then it will read the values and you will access your
database with this. The next thing you will
need to do is to create an actions folder
inside our lip folder. In this actions folder, you will create a file called supabastest dot actions dot ts. We are naming this SupAbse test because this is just
for testing purposes. And with every application
that we will create, this will be a bit
different because we will have different tables
with different fields, different namings, and so on. This is just testing where
we will try how this works and try to learn
how we can then use it in each of our
other application. So you will create
Superbstest dot action dots, and there we will put
for now this code. Then we will move
into dashboard. If you don't already
have, you will create this underscore
components file where we will put all the components
for our dashboard. And inside this, we will
create superbstest dot Ta six. We will create it like this
because then we can go on Dashboard and put
the component here. But first, let's go over
the SupABse test component, so the code here
will look like this. I also have the comments there. Okay. And now as we have it, we will go into this page
TS six in dashboard, and instead welcome
user and first name, we will return the div where
we will put our component. We can also delete this user, we no longer need it,
also delete this import. Save it, and now we can test it. Also, we don't need any styling for now for our dashboard page, so we can leave there just
empty fragments that are letting us group
multiple elements without doing some
unnecessary markup, like was this DIF. So now I can save it and
we can go to our page. Here on our page, we
will go to dashboard, and there you can see, there is currently our
setup, it's pretty basic, UI is pretty basic, but it's really for the testing purposes. What we can now do is
that we can enter there some testing description,
we're going to create. Now we can see the
record is here. We can go to Supabse. Here we can see the record. We can try to edit it. Again, you will see the
change in Super base. And now we can try to delete
it, which will also work. And we can try to delete
some records faster. Delete. Yeah, it works. So this testing was successful. Now our Superbase and
clerk integration works. The records are saved under our user from clerk and
that's pretty much it.
27. Project 0: How to Work With Database Step by Step: We will start with supabasetTs. This file is way application will talk to the
SupAbse database, and it will also sure that
users are only allowed to see, update, delete or
insert their own data. What happens is that we use
public Key to connect to SupAbse and after user
is logged in with clerk, they will get a special token. Then we will send this token to SupAbase every time
we ask for data. Super Base will check the token, and it will only access the specific data
light to this token. We have there this create
server subbase client function, and this is a function
that will make Superbase client know
who the current user is. It will grab the token from Clerk and it will
give it to Superbse. And then Superbse
will figure out which data the user
is allowed to see. This is the address of
our Suba Base project. This is the public key,
and there it happens. This will get the
user's secret from clerk and prove who
they are to SupABse.
28. Project 0: How to Created, Read, Update, Delete Data: Let's move to another file
superbstest dot as dots, and this file will have the functions that
will let users at, see, change or delete the test
records in the Superbase. We have revalidate path. This will help the
website update when we will change the data. Then we are calling
this Createserver, Superbase client, and then
we are using this ZOD. This will help with the checks
that the input is valid. So the field is not empty, not too long, and so on. Then we have here defined how our records
should look like, so that ID should be strength, user ID, also, and so on. Then we will continue
to test record schema. This will check that the description is not empty
and also not too long. This will use the type for the form data that we
will be sending in. We have it here. And then we have the function
G Test records. This will basically get
all of our test records. First, we will create here the Superbse client so
it will know who we are and we will ask Supabase for all of our records
with the newest first. That means this will return
us only our records, and in case this will fail, it will throw an error. But if we have no records, it will just return
an empty list, and we can handle this then in our component
superbstest dot Tsix. Then we will have their function for creating test record. We will validate data, so we will make sure description is filled and also not too long. Then we will create a
superbse client, again, same like in the
function before, that will check for us
that we are allowed to create a new record
in our database. In case not, it will fail and also it will
revalidate path. That means when we
create a record, it will be automatically displayed and we don't
need to refresh our page. Update test record is the same. We will be validating data, radio superbase client, then we have the
update operation. In case it will fail,
it will throw an error, and it will also
revalidate path. So then after we will
update our record, it will be automatically
displayed, and we don't need
to refresh again. Same thing for delete record just with a different operation. And this was just
a testing function that I believe we don't need. Then you will go to Super
Base test component. What is happening in
this component is that because we will
use react hooks, we will make this
component use client. It will be on client side, and there we will
import react Hooks, use stat and use effect, then use user from clerk, and then we'll import the
functions that we have in our superbasetest dot actions
that we just went through. Now we will start
with our component and we will start with
stage management. We will be storing all records fetched from Super
Base database. Then we will be storing
the description input. ID of the record that is
being currently edited, description input when we will be editing an existing record, bullying to show loading state during the database operation. Message for displaying a success or error message to the user, and we will get the current authenticated user from clerk. This will provide us
with information like user ID that we will use
for the database queries. The default values here will be blank or false or
null or empty array, and this use effect
will automatically fetch records when
a user logs in. In this dependence array,
we will put the user, and this effect will run
when a user changes. Are saying here, don't fetch anything if no
user is logged in, and in case it will pass, fetch the user records
from Superbse. Then we will have a function to fetch all records from Superbse. We will use the Trcage here, and in try we will show loading spinner while we
will be fetching the data, so we will set loading
to Drew and then we will call the Superbase to get all records for
the current user. This get test records
we have here. So we will actually
call it and we will try to get it in
case this will fail. It will catch it. It
will send us the error. And every time after
this block will finish, if this will be successful or if this will
result in an error, this will set loading
falls in the final block. Then we have the create record, and now it's basically the same thing over and over again. We have functions for create
record, update record, delete record, and
just the same thing. There is try catch and finally, all the time, and finally we are setting loading to falls. In catch, we are catching
the error, and in try, we are trying to call
these functions we created in this
subopastest dot acts dots. Then if we will be successful
in creating records, we are emptying the description. So we have the field ready for a new record that
we want to create. Same here because we are
using the state variables. So after the successful
coll function we have here, we need to set the state back so the old values
don't persist there. Then if user is not there, we will display, please sign in to test Superbase connection. We don't need this
because we are actually using this
subscription Ts, where we are checking
if the plan is pro, but for the testing purposes,
we can just leave it there. Then we are actually getting to returning of the
component itself. Here, it will be called
Super baase Connection test. It has some pretty
basic styling. There it will be
displaying the messages. So in case there
will be an error, it will set the message to error or in case
it will be a success, it will set the message with the success message depending on which operation
you will be doing, and it will be displayed on top then we have the orm
for creating record, and we will have
our records list. And in case we won't
have any records, it will be displaying
no records found. In case we will have record, it will continue here, and in case we will have
record, this will be false, so it won't be rendered and our records
will be displayed. In case we will be
editing a record, we will see this div
with the option to edit description and save
it or cancel it. And in case it will be false, it will be displaying
this record description with the possibility to edit
the record or to delete it. And that will be pretty
much it for the component. Then the component is there
on the dashboard page. If I sign out, we
won't be able to see anything and we
cannot get to dashboard. There is just a landing page,
but if we sign back in, we can use it again and
it will be working, and we will see all the
changes in our Superbase.
29. Project 0: Supabase Test Actions Explained: We will start with supabstTs. This file is way our application will talk
to the SupAbse database, and it will also sure that
users are only allowed to see, update, delete or
insert their own data. What happens is that we use
Public Key to connect to SupAbse and after user
is logged in with clerk, they will get a special token. Then we will send this token to SupAbse every time
we ask for data. Super Base will check the token, and it will only access the specific data that
are tied to this token. We have there this create server subbase
client function that will make Superbse client
know who the current user is. It will grab the
token from Clerk, and then will give it to
Superbse then Super Base will figure out which data
the user is allowed to see. This is the address of
our Super Base project. This is the public key,
and there it happens. This will get the
user's secret from clerk and prove who
they are to SupABse. Let's move to another file, superbstest dot acts dots, and this file will have the functions that
will let users at, C, change or delete the test
records in the SupAbase. We have revalidated path. This will help the
website update when we will change the data. Then we are calling this
create server Superbase client that I just explained here. And then we are using this ZOD. This will help with the checks
that the input is valid. So the field is not
empty, not too long. Then we have here defined how our record should look like, so that ID should
be string, user ID, also, then we will continue
to test record schema. This will check that the description is not empty
and also not too long. So we are validating here. We will display
there the error that the description is required
in case it's not there, or that it should be less than
some number of characters. In this case, 500. This is the type for the
form data we'll be sending in and then we have the
function G Test records. This will basically get
all of our test records. First, we will create here the Super baase client so
it will know who we are, and we will ask
Supabase for all of our records with
the newest first. And in case this will fail, it will throw an error. But if we have no records, it will just return
an empty list. And we can handle this then in our component
superbstest dot Tsix. Then we will have their function for creating test record. We will validate data, so we will make sure description is filled and also not too long. Then we will create
a Superbase client. Again, same like in
the function before. So that will check for
us that we are allowed to create a new record
in our database. In case not, it will fail, and also it will
revalidate path. That means when we
create a record, it will be automatically
displayed, and we don't need to
refresh our page. Update test record is the same. We will be validating data. Then we have the
update operation. In case it will fail,
it will throw an error, and it will also
revalidate Path. So then after we will
update our record, it will be automatically
displayed, and we don't need
to refresh again. Same thing for delete record just with a different operation. And this was just
a testing function that I believe we don't need.
30. Project 0: Move Landing Page to Marketing Folder: By the way, we will create
a new folder marketing. We will put it in parenthesis, so the path won't be local host 3,000 Marketing
to access our lending page. It will be still just
local host 3,000, and that will be the
lending page itself, because if it's in parenthesis, it's not considered
for the path. That means for better
folder structure, we will create this marketing, and there we will put
a lending page in ponens that are meant
for this lending page.
31. End-to-end Testing: Your dot and file with all the environment variables
should look like this. We edit three new
environment variables, and it's this next public
clerk sign in URL and signup URL where you will just do slash sign
in and slash signup. Basically, you will just
copy paste these two lines. For Web Book secret, this is the webhook secret from clerk, and you will put it
there, and that's it. After you have all these
environment variables, you are all set, and that's it. And last one, what you
will adhere is next, public AURL local host 3,000. Now we will run the command and Px Prisma generate to
generate the schema. We'll do NPXPrisma DB push. This should push the
schema into our superbse. And before we do it, we
need to add there also one additional thing
below this URL. We'll add direct URL to have the direct
connection to our superbase. Now after we have
this and save it, we can do NPxPrisma DB push. We'll run the command,
and this should push our Prisma model into
our Super baase database. That means now we will
go into our superbase, we have their user and
subscription model. Now we can continue
with the testing. Now to test this,
we need two things. First one is open engroc dot that you downloaded
and installed, and there we will do
Engroc HTTP, 3,000. If you are running
on local host 3,001, for example, you will need
to do ngroc HTDP 3,001. There I will take this URL. There you will go
into Configure, there you will scroll
down, go to webhooks. We will add a new endpoint. I will paste the
URL from Engroc and do API Webhooks clerk. There I will check user
and all these events. Click on Create and I will
get this signing secret. So I will just display it, and then I will copy
it and I will put it into our environment
variables like this. We also in terminal
paste this command, stripe Listen forward to Local
Host 3,000 API webhooks, stripe before you need to do the stripe login as we did previously to log
into the stripe. After there it's checked. Every time you will want
to test your application, you need to do just this. Stripe, Listen
forward to Local Host 3,000, API Webhook stripe. This needs to be
the correct path. If there is, for
example, webhooks XIX, then you need to have the
API web Hooks six stripe, but we have the correct naming,
so it's fine like this. Now we are all set
so we can test it. If you want to
test with the user that you already
have in your clerk, just delete the user
from your clerk. Otherwise, it won't work. The
user you want to test this with cannot be in the
clerk previously. It needs to be there
just after you will sign up with him now
because otherwise, the user will get duplicated. I won't be created in your
superbase and this won't work. Small fix is needed there
for finding the proper path. If your background doesn't
have the proper color, check the globe Blue dot CSS. Make sure there is
just a root coloring. This is for background
and foreground. A double check tailwind
dot config dots and make sure these two
files are working for you. I mean, with the
colors and everything because maybe you
can get stuck there, try to find where you should
change the colors and so on, but these two files are doing it Globe B dot CSS and
tail in Config. ICV are also missing stripe. So let's do NPMI stripe. Sometimes there is this
issue with the API version. So let's just change
it to cording one. And now what we will need to do is that we need to
move our component to a dashboard because
currently it's on a lending page on Page Tsix. We will go into app folder. We'll create a new one,
we'll name it dashboard. In this folder, we
will create Paget six. And onto this page, we can
just move this lending page. Let's copy it and
paste it there. Also, there we can remove the header and we can also remove the import of the newsletter subscription. We won't use that component. Also, we won't be using image. Now we go back to page t six. We'll do the same
thing there. And there we can leave the header for this part on
the lending page. Please make this
dummy functionality. Now I'll submit this,
and this will be there a sum demo for our potential customers on the lending page. And when they will buy the product and get
their dashboard, there will be the
real functionality. From the lending page, we
can remove the component, and actually, we started with
a pretty bad naming there. Let's rename it
to AI hit Window. Let's also hit SUdateimports
for AI hit Window. We need to have the
proper naming and we made a mistake
there with pasting the files of should be
app and for the API, we will just take
these two folders and paste it into
API folder there. Then in API folder, you will have a deep
seek user webhooks, and in webhooks,
clerk and stripe. Then as this API folder is
empty, we can delete it. And one more thing
is that pricing and payment should be
moved also to app. And then we are all set. We have the issue
with dependency. Let's do NPMISwix install. There's one thing
we need to fix, and that is this placeholder
UI because that is nowhere near the UI we
actually have in our product. And we'll put there prompt. Make this product the MOUI
same as the product itself, as we have an AIched
window component. Now we can select Des
car one, I submit. Let's exhibit it, and I think that's perfectly
done by R one. What we'll add there is
some code action button, so I will put it on top. I will put there this
prompt at the get started button that will
redirect the user to sign up. I will continue with Google. Now in our dashboard folder, we will add Layout DTS six. We will go back to the starter there and layout TS six
and Dashboard folder. We will copy it, paste
it into our application, and there we can see we don't
have access to this page. We need to hit
Subscribe to access. Now, you will run this command. Stripe Listen forward to
Local hot 3,000 APA webhooks, Stripe and on the page, we can hit Subscribe. There we will fill in
the data, pan subscribe. The payment was successful, we will go to dashboard, there it will load, and we
have access to product. We can use the design mode. We can just generate something, for example, stripe integration, confirm, and we got the answer. In our database, you can
see that the subscription was created and that means
everything is working.
32. Deployment: Play this versal, we'll
first go to package do JSON, and we will add there into the script these
additional commands. Then we will create a file named VersalDJSN and we will
put there this content. Then into next dot config dots, we will put discontent then
you will run this command, remove IM recross
force dot Next. Then you will run NPM
install once again, and then you will
run NPM run built, which would basically
validate if your application is ready to be deployed in
case there will be any errors, it will display there, and you don't need to waste
time on VersL because VersL will fail in case the build is not
working properly there. Now we need to publish
this project to get up. I will do Sutrla plus shift
plus P. Publish to get up, I will name this
Deep seek project, something and I will select this repository should
be private or public. In terms of deployment,
it doesn't matter. Just if you want to share
the code with someone, you should put it public because otherwise you won't
be able to see it. Then you will stage
all changes there. You will click on Source up there above the
name of the folder. Everything should be staged. You can put there
some commit message, hit Commit, and it
will push it to Git. If you'll do then any
changes in your files, the new changes will
be shown there, and you can again do plus,
put a commit message. For example, deployment
Fix, commit and so on. This way, you will be updating your live page on Versal with
some new features, content. Now you will go to
virsal.com at a new project. I will at my Project Deep
seek ARO Project one, which I just published
on my Git upp and there, I can set all the environment variables, how this
will look like. If you will go into your dot and file and you have
their webhook secret, you will put there the name
of the environment variable, and there you will
put the value, so something like this. And then you will do this for all your environment variables. For example, clerk, I
don't remember the name, but yeah, you probably
know what I mean. Clerk and paste it there. Then you will have
the stripe one, and you need to put
there the names that you have in your
environment variable file. Or you can do it also
in a different way. You can paste the
dot and file above, and it should load
all the values. Let's now try it. We will hit
deploy there. It will fail. We will click Go to Project. There we will click on settings. Environment variables,
and there is the button. I will put there some value, click on at another, click
on Import dot and file. You need to locate the DTN file, and then after you will edit, it will load all the environment
variables there and you don't need to write it one by
one. I will hit save there. I can delete this
xx value because, of course, I won't be using it. And now I can go to deployments. Go on this one, for example, hit redeploy and the
page is deployed. Now we will open the page, the URL, even with
HTPS, copy it. I need to go to clerk
and there I need to change the endpoint
for our Webook that we put there from the Ngrog to our URL from Versal. And
it should look like this. This is the link to our page, and there is slash
API Webooks Clerk. Now I will save it. Double
check that the webHook secret is the correct one
that we upload it to Versal and that should be.
33. Project 2: Intro: Will be building
a SAS application for YouTube video analysis, where our users can subscribe, and then they will have access to our product that we will step by step build with AI
using also documentations, and the goal is to help you build a minimum viable product, learn how to build SAS
or Microsas application on your own with a
similar approach. I will help you create the
prompts that you can reuse, set up a SAS and how to make it work even if some newer
versions will be released. You will see which
documentations you should track and how to create a series of prompts that should give
you similar output. And if you will be creating
another SAS later, you will already know
where to look for all the things that you will need for your building journey. And what we will do
in this session, we will be creating a
product using prompts, then we will be integrating third parties for the of
database and payments. We'll do functional
testing where you will learn how to test your
SAS applications to end, and also we'll be
deploying this to versal. So our application
will be the live. Now let's see the
demo of this SAS. We are here on a landing page, and we will click
on Get Started. That will redirect
us to the sign up page where I will select
continue with Google. Now the user is
saved into clerk, then via webbook it will be
also saved in our database. In our database, you can
see that with a new user, I have a null for
stripe customer ID. The next step will be getting
access to the application. There I will click on Subscribe. It will redirect me to the Stripe checkout
session. There I will pay. I will get the payment
successful message, and now I will be able to use the product and how
the product will work, I will pace there
the YouTube URL, and I will click Analyze Video. There I will see
the thumbnail of the video that is
being analyzed, skeleton for the analysis
until it's loaded. There is the AI analysis. I can save the analysis
into database. Then I will see it there
in saved analysis. When I will click
on it, it will open a model with the saved analysis, and I can edit it and save it into database or just delete it. Now let's go to
the database and I can see the active
subscription for my user, and also I can see the analysis being saved into the database. And if you want to
see the process, how I did this from scratch, finally, let's dive
right into it.
34. Project 2: Setup: Start with using
the command from TelewncSS to create
our application. You can use AI to do this, or you can just do
it yourself with telencss.com and make sure you will use the most up to
date version of the command. That means we will
head to tansss.com, get started framework next
JS and there we have it. We will copy this line, and we will go back to our ID and
we will paste it there. We don't need to
seed to my project. Let's instead of my project, do DR Dot because
we are already in the folder that we created
for our application. So I created a folder
named Video Analyzer SAS. Then I opened this
folder in the cursor IDE and now I will
run this command. I will head Enter. Then
I will proceed with Y. I want to use tail WN
CSS, no source directory, no turbopec no AIS, and now it will install
all the dependencies, and then we can continue. Now the next thing we will do is that we will
run the server, so we will do NPM run Death. We will open this local host
and there we should have the first UI with the next
JS template application. Also, if this is being shown, it means that the
tailwind CSS is working. If you want to test if it's really working, you
can go to page, and maybe there, you can just
put background to green. 400, for example, save it. Then you can see it's
working because it read the tail end class and
applied it to your page. But now we will start prompting and leave
these things to AI. We just wanted to make sure
that we have the application properly set and the
tailwind is working. We have the correct
configuration, and now we can
start with prompt. Next step for me is to
create the prompt dot DXDFle and I will be saving
all the prompts that then you can reuse
enhance and so on. You don't need to create
this prompts DXTFle. It's enough if you will just
directly prompt the composer
35. Project 2: Prompt 1: Start with the
prompt number one. I will keep there
this structure. First, I will explain what this application
should be about, then core features
of the application, then the UI components
I want there to be, then the styling of
the application, and then some additional
code considerations. Let's start with the main
application functionality. This application should take
YouTube Below URL as input. There we will use a
different API in the end, for now, it doesn't matter. Then it should present a clean
user friendly interface. Core features will be YouTube URL input field with validation, loading state
progress indicator, Analysis results display and error handling for invalid TRLs, widows without transcripts,
and API failures. For the UI components, I want a main form with YouTube URL input
with YouTube icon, submit one with loading state, and progress indicator
during processing. Then a result display with
the video analysis section, rest bound to analyze
another video, clean and responsive layout. For the styling, I want
to use tailing CSS, responsive design with
mobile first approach, modern and clean interface,
loading animations, progress indicators,
and dark colors with some red details, but mainly focus on het scan
like UI, and for the code, use typescript for type safety, implement proper error handling, a loading states and
the user feedback, keep the UI clean and minimal, and focus on user experience. Now with this prompt, we will copy it. We will put it to composer and we will wait
for the response. And now we got some output. You should have there in API
and transcript Route DS. And this is probably
not correct. We don't need to use Rapid API. We will use just the
YouTube transcript library, but we will specify
it in next prompt. I will know how to try make
it as general as possible. So whichever output you will
get from the prompt one, we will fix it in prompt two. But you should have there,
the route for the transcript, then the components error
display progress indicator, result and input. I think that's correct. And the page connecting
these components. What will be the mission of our next prompt is that it should mock the response
because currently, we don't have any API for
the AI analysis connected. But they are trying to make
this as general as possible. We will try to fix the
output of the prompt one. That means even if
your prompt will have a different output than mine
with some next prompts, we should reach the same output. We can accept all
and check the page. You can see that currently
is doing nothing. We have the YouTube URL. It's not reading the valid URL. It looks like it's not even showing the result of
the transcriptions. That's something
we will fix now.
36. Project 2: Prompt 2: Let's head to the prompt to, and there I will note the
box if there are any, I will not there what I expect. And let's go through the prompt. First, I want to
display a section with the text transcript
from the input video. Also make sure in API
transcript row dots, again, we will use
a different API in the end because this
didn't work in production. For this MVP, I want to use
black and white colors. Also, you can note there
any errors you have. I will not there that
currently it's saying the YouTube URL is not
valid even though it is, I will also provide the example
of a valid YouTube URL, and I will also note
there what I expect. So I expect that I will
input the YouTube video URL. I will hit Analyze and it will display video
loading or processing. Then after it's done,
it will display the section with a text
from the video transcript. You can know there what
you expect from your side. You can also know there
your errors or bugs. You can also note there
your color preferences. Then what you expect? Maybe you would like to
use a different library, and we will wait
for the response. Now we will accept Hall
and we will check what is implemented. There
it looks good. It's using the correct library. Now we'll go onto our page
and we will hit refresh. It looks like it still didn't
use the proper coloring, but we can fix it later. That's not a big issue. We'll put the YouTube URL
and its it's working. So there we have the transcript, but we don't need this feature. We'll basically just scrap this and we will be showing
there only the analysis. But this is exactly
how it should work. We can hit analyze
another video, we can again put there
the YouTube v link. It will show the progress bar, and then there we can
see the video with the thumbnail and with a video transcript,
which is perfect. And we can start working on the prompt tree so we don't
need this transcript, but use it and create AI
analysis out of this. For this, we also need an AI API that will help us with
this AI analysis. And I will be using Deep Seek. I'm using still the credits. I topped up there for $2. So you can just use
anything you would like. It just needs to be some AIAPI that will help you
analyze this text. If I will head
platform dotpsq.com, there I will go into API keys, and I have there M key. I will create a new one,
so I will revoke this one, create new APAKey,
I will copy it, and I will go back to my ID. Now you will go into dot N file. If you don't have
one, just create it, and there I will
store the AI APIKey
37. Project 2: Prompt 3: Let's now go to prompt and there we will implement the
functionality I just mentioned. I want to extend my existing
functionality where an AI analyze it on the transcribed
text of the input video, reuse AIAPIkey that I
have in my Doden file. Now I can also mention which API key it is and then implement the functionality where AI will analyze the transcript that
we got from the video. Never display the
transcribed text anywhere, and when it's loading the text, display a skeleton of it. After AI generates
the video summary, display it in a professional
and easy to read way, make everything feel
simple, bright, friendly, with smooth
fonts and good spacing. Then I will just
delete the fonts. We can leave the spacing and the final look should
feel modern and polished. With this prompt, I expect that I will just
analyze the text. I will make sure that
the transcribed text is never displayed anywhere
because we don't need it, and this should be
the functionality. Then we will build on top of it, but for now, this
will be enough. We will put it into the composer and we will wait
for the response. Let's see the response. It analyses functionality, created a new route
in API for Analyze. Then it's using the Deep
CKI API, which is correct. It analysis result component. Then it updated the
main page to fetch and display AI analysis
instead of row transcript. It updated the UI components, transcript result, and
edit skeleton loader, updated the progress indicator, improved user experience, and now we can go and
test the website. On our website, we'll
paste the YouTube URL, and we will hit Analyze do. You can also restart the server if this won't work for you. That means in your terminal, do ct plus C and NPM run De and open the local
host 3,000 again. Let's see how the analyzing
content is going. So it validated the URL. It fetched the video details, extracted the transcript,
processed the data, and now it's analyzing
the content. And there we have
the analyzed video. We have the summary, key points, insights conclusion.
I mean, it's good. We can then improve
the UI of this because we would like this to be a bit better highlighted. I mean, the sections, the
key points and everything. But yeah, it's just
a detail that we can then work on and we
will make it running. Now we can focus mainly on the functionality and
the functionality. I believe it's the one that
we wanted for our MVP. Now we want some additional
features for our SAS. We would also like to
save these analysis, list through the saved analysis, and for that, that
will be probably it.
38. Project 2: Prompt 4: And for the prompt for, we will also start with Prisma. Once the AI analysis is complete and the result is
displayed in a component, I want to add a safe
bound that will allow users to save this
analysis to the database. Define a Prisma model for
storing AI analysis results. The results should be
stored in JSON format. It should store the analysis
in the database via Prisma. And also, create
a model for user and assign the analysis
to the current user. For the UI, I want to add a safe bound below the AI
analysis result, and when it's clicked,
it should trigger the API request to
save the analysis. Also, display loading and
success states on the button. On the main page below
the widow and Po box, create a visual
appealing section to display all previously
saved analysis, fetch thee from the database, and each analysis
should be displayed as a clickable card that will
ensure clear readability. And when the user
clicks on an analysis, open a well designed
model that will load and present the full analysis
in a user friendly format. Also, we want to include an edit button next to
the displayed analysis. And when the user
clicks on Edit, the text should become editable. After making changes, the user
can click a safe bound and we should also enjoy
the smooth experience with clear visual cues. And then also at delete button
to delete the analysis. And we will also mention there somewhere between these lines, please use clerk of in case you will be
implementing of also. And now I will take this prompt, open a composer, paste it there. We will wait for the response. Now let's see the response. So the database integration, there we can see the Prisma and the schemed Prisma.
Where is the model. Then the deduced
clerk authentication, we are missing the
folders we need for the sign in and sign up and
some additional things, but we want to
reinvent the wheel. I have these things
already prepared, and I will show you
how you can just reuse them from the
documentation and not rely on AI because sometimes
there are some changes in their documentation and AI can mislead you and you will
get a lot of errors. So I will show you how to make this work every time we
will go to clergy.com, and there you will
click on Documents. You can see there how
to actually implement clerk into your next
JS application. For example, this is for
the middleware dots. We'll just copy paste it. There you can see how it should look like for layout dot Ta six. Again, we will copy paste
the proposed changes there. So we need to wrap this
into clerk provider. We will use the sign
in sign on and so on. Let's paste it into layout
dot Tasix after we have it, our page won't run because
we need to get the API keys from a clerk and now I will show you
how you can do it.
39. Project 2: Setup Clerk: Sign in, then go
to this dashboard. There in our applications, we will click on
Create application. For application name, I
will select SAS Tutorial, and next to email, I will
have also login with Google. I will click on
Create application now I have their guide how
to do this with nextJS. We will go to Configure, and there we will copy the
two secret keys from Clark. We will paste it
into our DTN file, and now we can fix the rest
of the errors on our page. That means usually
we are missing some libraries because the
AI didn't install them. We will go through all the files and we will check if
there are any errors. In case we are
missing some library, we will just do NPM I
and the library name. For example, NPM I react model, and we can continue for the analysis model,
it should be fine. We can just rewrite,
then it will be working. And now it's time to go again to the clerk documentation and implement this sign
in or sign up page. You can see it's pretty simple. It's like four lines of code, but we need to
create the folders. In app folder, we need
to create sign in and sign up folder, and
inside these folders, we need to create these sign in and sign up with the dots, and inside page dot Tsix. We will go into our
folder there in app we will create
off in parenthesis. That means it won't
read it in path. If we will go to sign in, it will look like
our page sign in, and it won't look
like our page of slash sign in because of is being ignored as
it's in parenthesis. We will use it as just
a grouping for our off. So we have our folders nicely structured and we
don't have a mess there. Now I create the
sign in and sign up also with the
dots and everything. I create page D six inside, and then I will copy
paste the code from the documentation inside
this page DaixFles. Now, in our
environment variables, make sure we have this
next public clerk sign in URL and signup URL, and they will go onto our page and we will click on signup, it will redirect us to the
signup form with clerk. There we can try to
sign up with Google, and we can see there
our icon for the user. We'll later delete
this icon because we will be just using the
sign in and signup to not let the user be able to edit their email because then it would make a mess
in our database, and we will be just implementing the functionality where
after a user will sign up, we will save his user into our database with
a clerk web hook. We will in documentation go
to synchronize clerk data to your application
with Webooks and there we'll be able to see
the implementation of this. We can see setting
up the End grog, which we will use for testing, because the endpoint
we will set to clerk won't be able to
see Local Host 3,000. So we need to take
Local Host 3,000 and change it into the URL that
clerk will be able to read. End work will help us with it. It will be simple to set up. I will show you step by
step solution how to do it. There you can see the code
example of the web hooks, but I will also provide
you with this code, so you can just copy paste it and don't have much
troubles with it.
40. Project 2: Setup Stripe and Supabase: I will go to this git that
I will also provide to you. I will copy paste the web hooks. I will also paste the
dashboard folder. Stripe ts and
subscription Ts from a library folder into my
already created library folder. I will also copy paste
schema dot Prisma. I will just add connection to the analysis model
into my user model. I Then I can see there are some errors, so I need to install Swix. I will do NPMISwix. Then I need to install
Stripe library, so I will do NPMIStripe now we will go through setting the secret keys for
Superbse and Stripe. In the end, your
dot and file should look like this with
these stripe keys, Superbse keys, clerk keys
we already did together, and the AI API key. For my case, it's
Deep Sk API key. We'll head tosupbs.com,
and there we will log in or sign up after you will
be on the dashboard, you will need to create
a new organization, and then you can create
there a new project. In three tier, you can
have up to 23 projects. You will click on the project
that you will create, and there you can also select which
project you want to use, so I will be in the first one. If you created just one, there
will be just that project. Then we will click
there on Connect. There are two strings. We'll need to paste into
environment variables to database URL and direct URL. In Database URL, you
have the string where is number 6543 and in direct URL, it will be the one with 5432. Just copy paste
these two strings, and now you need
to also put there the password where you
can get this password. You'll go there in
project settings. There you will go into database, and there you will
hit Reset password. You will generate it,
copy it, and store it. Then you will put a
password on this place. Also one additional thing
for the database URL, after the string that you will
paste from your database, put there a question mark, BG bouncer equals screw and
connection with limit to one. Now, as I mentioned before, we will be setting Engrog. This will help us expose our local server
to the Internet. What we need to do
is just download Engrog after you download it, you will open the engrog dot a file which will open
a terminal for you. And before downloading it, you need to login
on this engrog.com, create an account
there, and then you will download it and
open the engroc dot X file, which looks like this. We will do Engroc HTTP 3,000. If you are running
on Local host 3,001, for example, you will need
to do Engroc HTDP 3,001. There I will take this URL. There you will go
into Configure. There you will scroll
down, go to webhooks. We will add a new endpoint. I will paste there the
URL from Engroc and do slash API Webhooks clerk. There I will check user
and all these events. Click on Create, and I will
get this signing secret. So I will just display it, and then I will copy
it and I will put it into our environment
variables like this. Now we will set up a stripe. So first, you will
login or sign up to Stripe and then in stripe, you will create a new product, and there in the new product, we will go into developers there we will go into API keys. And there we will take
the publishable key. Then we will go to our IDE, paste it there, and we will
go back for the secret key, we will click on Reveal
and then click again, so we will get it to clipboard, and we will paste it
into our dotnf file, so into our
environment variables. I have the publishable
key and the secret key, I will put a name for these
environment variables. As this will be a public one, I will put the next public and then Stripe publishable key, and for the secret
one, I will put Stripe secret then we will go
back to stripe page. There we will go to
Product Catalog, and you can see I already
have the two products, but I will create a
new one with you. So let's click there
on at product. I will name it
thumbnail previewer. There I will put
yearly subscription for thumbnail reviewer app. They I will put recording, then I will put early
$20 or let's do 19.99, and I will click on at product. Now it will save the product. Now I will click on the product, and there I have a product
ID, so I can click on it, and it will copy the
product ID for me, which I will save into my
environment variables also. And there I will
click on three dots, and I will copy the price ID. So this price ID, I will save in my environment
variables, so I will do their stripe
Price ID like this, save it. Now I have the publishable key, secret key, and the price
ID of our only product. You can see it like
this. I put it there. And last environment
variable we will need from stripe is the
Stripe webbook secret. So let's prepare it there. This is not the secret
you should put in. For the secret,
you will get this actually generated
from the terminal. So what we need to do now, we will go there on webhooks. We will click on test
in Local Environment, and there we will get the
guide what we need to do in order to set up the
stripe for web hooks. So first, we'll need to download the client there you will select your system
for meets Windows. The I will download this
zip file from Github. You will unzip it, then you will open the folder, then you will open
environment variables in your computer and you will add a path to this dot x file there. You will open your terminal. You will write stripe there, and you will get
this information. That's how we will know you successfully
installed the client. There we will go
back to this page. Then we'll put there this
first command, stripe login. We will copy the URL, open it there, there
we will see the word. We will click on Lo access
and access granted. Now if we go back to that page, we will see there completed, then we will copy
this command and we will open there a new
terminal so I'm an IDE. I open the new terminal, and there I will do
Stripe Listen forward to local host and not
4242, but 3,000. Now I will hit Enter. And as I have it installed, it will generate
this secret for me, so I will put it there
into Stripe Webook secret. I will save it. And
now if I will go back to Stripe I will
have this working. And now we are back
to our Jordan file, and we should have all
these secret keys set. We will need to
run some commands, starting with NPxpress MDB Push to push our new
schema into Supabase. If you have already
some data there, you will need to overwrite it. All your data will
be lost in case you already have something
in your Superbase. After you will
successfully push it and we will go into your
Superbase and refresh, you will see there
tree tables for analysis, subscription,
and user.
41. Project 2: Prompt 5: The prompt five, we will
mention that we want to use a different package for getting the transcript for
YouTube video link. That will user input
into the application. We want to change
the package we are currently using
to a new package, and we will provide also
a code snippet below. And this code snippet
is something I found on GitAp from some user that
was having similar issues. We will put it in the composer, there we will send this and we will wait for the response. And we have it. Now, it
will be time to test it because it basically just changed the route
to the TS file. Nothing else. That means, let's test it, and then
let's try to deploy this. And even with the new package, it looks like it's working. There we have the analysis, and it's basically the same
as the previous one, maybe even better in the
42. Project 2: Testing: Now I will test if the clerk data are being properly saved into
our super baase. If you will be testing
this, make sure you set the Ngrok and the
endpoint to clerk. Make sure you have no
users that you are testing this application with in clerk because now you need
to create a new one. If you will sign in as
already existing one, it won't save it
to the database. So I will delete my
user from there. Now I will go to the page again. I will just make
sure I'm signed out. And after I will sign up, the user will be saved into Super baase and if
you'll save analysis, it will be assigned to the user, and also it will be
saved into our database, and we can create an
active subscription that will be also assigned
there into Superbase. Our user management is done. If you are getting some
errors in your application, AI should be able to fix it, but usually it's because of some parentheses or maybe
it can be because of a missing library
name that means for ClerNJs is just slash server, and then checking
the user ID is also now done asynchronously
with weight off. You will just add this keyword and
everything should work. I recommend you to go
file by file and see if there are any issues or
errors and try to fix them. It should be really simple
and in case you have any, AI should help you with this. Now we will add navigation
bar to our page. We'll be using this
ChatsN library for bans. That means we will do
NPx at latest at Bn. Now we will install
this, why to proceed. It will create a new
folder components UI, and there into UI, it will be saving
hetsiN components from the ChetsN library and
into components folder, we will add enough bar to Tasix. We already have one components
folder in the app folder, but that components will be for the landing page or
for the application. If you will add their components for the application itself, we can also create
components folder in the dashboard folder. So each folder will have
its own components. For the root folder, we will add our components that will be
for the wall application. In this case, it will be UI, the components from Chetcn because they can
be reused across the wall application and the navigation bar because that will be added to
layout Dt ta six, and that is applied for
the wall application also. I will give you the Navbar
that will be already working. The only thing you will need
to do is to go to layout DTS six and there implement
the Navbar component. You can delete the
inputs from clerk. You will leave the just
clerk provider Import. And now, how to test the
stripe functionality. We'll make sure that
we have our user. We are logged in as
in the database. Then we'll go into our IDE and we will open
the new terminal, we'll make sure this
command is running. It's stripe Listen
to forward to Local host 3,000 ABI web ooks Stripe. If you are running
on local host 3,001, it needs to be forward
to local host 3,001. Then in our application, we will go to pricing. That means we will need
this folder pricing, we will take from this
git and we will put it into our repository
in the app folder. Now on this page,
we will click on subscribe that will direct us to the Stripe payment
checkout session. We will fill in the data, click on pay and Subscribe. Now we will go into IDE, this payment folder, we
will move to app folder. Now we can see that our
payment was successful. And in the terminal, you can
see HTDP status code 200, which is for success. That means our payment to
Stripe was successful. And now the question is, if we will go into database and we will go there
into subscription, I already see it's fine. We have the subscription status active assigned to our user, that means everything is
working, which is perfect. Now we will also get
this types folder, which contains user
dots with its types, and we'll put it there
into the root folder. Then we will go into
the dashboard that we already compete,
it should be working. If we will go to our
page, click on Dashboard. We had there the premium
access required, but as we are subscribed
and it's in our database, we have the subscription active. So the product that
we currently have on our homepage will be moved to our dashboard,
and on our homepage, we will just do some promo or demo displaying
the functionality of the product that user can access after he
buys the subscription. That means our SAS is now working technically,
but of course, we need to do some
final updates and move the things and do the final testing and then
deploy it to production. We have the page TS six, and there is the wall
functionality of our application. What we need to do is
that we need to merge it into page Tsix that
we have in dashboard. And how we can do it,
there are two ways. The first one is to
just take this code, select this code, Rutter plus
K in case you are cursor, put there this code
and say that we want to merge this code
into this dashboard, and AI should handle it well. The second way is to type composer that we
want to do this, merge app page DTS
six into dashboard, page Tix, and that should
also somehow work, but I'm not sure which
option is better. And the third way is
to merge it manually. But probably we will try one of the ways where A I will help
us. Let me try it with this. So I copied WAL code
from paged t six. In dashboard page D six, I selected the code. I did plus K, so it's having the context
just of this code, and it won't change
anything else. I will merge this code
into this dashboard. I will submit it, and now I
will wait for the response. Let's now accept this and see
if this will work or not. We will go onto our page. We have their
subscription active. There is the functionality,
and now we will test this. First, I will try to open
analysis, that is working. I will try to edit it. That is still working. I
will try to delete it. Is also working, and I
will send there the URL. Click Analyze video and I will wait if also the
analysis is working. There is the analyzed video, we will save analysis. Now it's also saved, and that means everything
is working. On our dashboard, we
have the functionality. Then we can go back to the
landing page and it will go back to cursor and go
back to page Tsix, this app, page T six. There we can delete all this
functionality related to our application we will we can again select all the
codes or put into composer. Then for the prompt,
I will put there now this lending page don't
have any functionality. I moved everything to dashboard. Please make this just a lending page that will promote
product for you to analyze this and also put
there button to get started, that will lead user to pricing where he can
buy the product. I will enter, and it doesn't matter if I will
just select this and hit zero plus K. If I will open a composer or if you
just put it into any AI, this will generate the page and it will remove the
old functionality. Now if I will just save it, I will get the
basic lending page, and I can see there also some
user burn. I don't want it. I will just find it. User Barn, it's there. Let's delete it. Now, there we have actually let's delete
also the heading. There we have the landing
page for our SAS. Actually, I wasn't
correct with pricing. It should be
dashboard redirection because even if the user is locked out and he
will get started, it will redirect
him to dashboard, but our user management
will handle this, and he will know that the
user is not signed in. That means he will need
to sign in, sign up, and after he will do
it, there he will see that he doesn't have
an active subscription. Now we want to get
this into production. So far, we are using YouTube Transcript API for
getting the transcript. But when I was testing
this in production, it looks like that this
API is not working there. So I was searching for
different solutions, and I found one that is working. And now I will show you
how to get this solution and how to implement it
into your SAS application.
43. Project 2: Deployment: Close the server, and we will
run NPM run build command. This command should tell you if the builder will be
successful or not, and in case not, we will know
which errors we should fix. If you are having
any slink errors, it's good to fix them. But if you don't want to spend time on it now and you want to deploy this and
see how it's being done in the next config DTS, we'll add Ignore
During Build to True to YSind and also
for TypeScript, we'll add the Ignore
built errors. Then we'll do NPM run built
to double check that we are ready to deploy
this, and we are. So what we will do is that we will publish this to Git up. I will do their
published Git up. I will create a name
for this repository. And after it's
successfully published, you can go to source control, and if you will change
anything, for example, enough Bar there, I will
just add some text, save it. There you will be able to see
the changes you did code. And if you want to
commit them and then also take them
to production, you will just click on
stage changes there. They will put some
commit message, update Navbar, and you
will click on Commit. And then this will
get committed to your Giru and also because it will be
connected to Versal, it will be deployed to
production automatically. But now I will stage it and remove the changes because I don't want to do
any changes there. And we will go into
package dot JSON and we will build at
Prisma generate. We will save it, go to source, edit to staged changes. And the last file we need to
create is versal dot JSON. And there we'll put this code. What this means. The
max timeout duration is set to 10 seconds. We need to increase it to 60. If we don't say this,
we will be able to analyze this really
like I don't know, maybe 5 seconds video. Then we will save this, we will stage it, and we
will push it to our Git. And we will now go to the Versal and we will try to deploy this. After you log in to Versal, you will click on
a New end project. There, you will select
your repository. In my case, it's
Video Analyzer, SAS, and you will click on Import there you now need to add
some environment variables. And if you don't want
to add one by one, you can just mock the value. For now, you will hit Deploy. Now you will click
on GT project. It failed, and of course, it failed because we didn't load the proper environment
variables. There we will go to settings of the project
environment variables. We will put there
some fake value. We will click on at another. Now we are able to
import the dot and file. It will get imported.
You will save them. Now we will just delete the mocked values
that we put there. That means we now can go back to deployment and we can redeploy. After we will redeploy it, everything should work, and we should have our
application ready live. Now what we need to do
is that we will open the application and
we will copy the URL. Now, after we have the
URL, we will go to Clerk, configure web ooks and
there we need to change the current one from Ngrok to
the one we got from Versal. The important thing is that after we will change
it and put it there, we still need to keep API
slash webhooks slash CORK. I already mentioned this, but it's really
important, otherwise, it won't work because
users won't be created in your superbase and that means we won't be able to assign
analysis to them. They won't be able to buy a
subscription because that's also connected to them and the application just won't work. And the last step will
be some UI enhancements. I wanted to do this after deployment because I also wanted to teach you how you can then
update your application, push it to the Git up, and
update it in production. It's a very easy process
because we'll be just updating our
application now the UI, then we will push it
to Git and it will get automatically deployed to
Versal to our production, and it will be live after around one or 2 minutes since we will push
the commit to Git. Of course, in case the
deployment won't fail, but if you will be doing
just the UI updates, the deployment shouldn't fail, at least it didn't happen to me. If we are doing some
backend updates, maybe changing the
routes and so on, it can happen that it will
fail because maybe you will be testing your application and everything will look
like it's working. You won't test that scenario
that will cause some errors. We will just change the UI, the testing will be easier than for some backend processes, and everything
should go smoothly into production
without any issues. How I will do this is that I will figure out
what I want to be displayed on the lending page
and I will prompt it to AI. Then I will go to Dashboard. I will probably get
some inspiration from the pricing that I
currently have there. In a similar style,
I would like to also design the dashboard
and the lending page. You can go to
pricing page t six, you will copy this
wall component, then you will open a composer
and you will prompt, please design my
wall application in a style like is my
pricing component. And you will paste
there the code. Now you will send it to composer and you will wait
for the response, and the AI should help you design your application
in a similar way, which is some SchetzN UI style, I would say, try to figure
something out on your own. I will definitely try
to create some video on also designing the
SAS applications. So we all learn something new. I will accept it, and I
think it worked pretty well. We have there the landing page. We have the dashboard, which looks amazing, I think. If you open this,
we have the model. We can also try the process once again, and here we have it. One additional thing I will do. I don't need this part there. I don't even need
to create a prompt. I will just go to Dashboard. I will find there this
YouTube video analyzer. And I can delete this and
this border with bedding, I can take and I can put it there to the
subscription active. I will delete this dis, save it, and now the page
will look like this. Let's focus on the landing page and see what we can do there to increase the conversion of users that will
actually buy our sauce. I would put a demo of our product with a Colo action ban that we
already have there, the get started one,
then the FAQ section. Customer review section
with some testimonials. He application is working, and that will be probably it. We need to create a prompt that will cover all these steps. First, will be demo section. There will be intro
of our product with a placeholder picture, where I will then use an actual picture of our
product, and with this, I'm prompting AI that it should put there some
placeholder picture, and I will change it later. For the second
section, I want to highlight how to use our
product in three easy steps. That means the user will
input to YouTube video link, click Analyze and then he can
save or edit the analysis. For FAQ section, I
want to put there three questions on our
YouTdink analysis product and subscription plans, which we have only
one for $20 yearly. Fourth section will
be about testimonials with some few placeholder
testimonials. Later, we will add
there, but for now, we don't have any
testimonials yet, so we can prepare this section. We can hide it and wait for some actual feedback
that we will get. And the last one will
be a footer section that will be on the
bottom of the page. Now we can run this
command we will accept it, and now let's see the outputs. There we are on
the lending page, and there we have the title
with some description. There is the product demo
screenshot right now, which is a call to
action button that will get our users to sign
up to the application. Then how it works in
three easy steps, input the link, click
Analyze, save and edit. Then we have their
frequently asked questions. This can be changed easily. We will just go to
the landing page. Let's find the FAQ, and there we can just change the
questions and answers. Then we have what our
users say section, and there we will have
the testimonials. For now, if we don't have
any testimonials yet, we can just put the hidden and it will hide it on our page. But I will
leave it there. And the last section
will be a footer, and there we have some
additional information, maybe contact us, some
links, and so on. Now let's add the demo
picture of our product, and how we will do this is that we will in our application, go to the public file. There we will create
a new folder, images, and there we will put a picture
of our application. Now I will go back to the
landing page, and there, I will import the
image product demo. Now, we will take this
product demo input. We will go to the placeholder. I'm not sure what it is.
Let's try to find it. There we will input
the placeholder image. And this will be
our lending page. There we have the
title with some description, call to action. Maybe we should give this code to action a different color. We can test this for mobile. It looks like everything
is responsive and works. And now we will deploy this. We will go to the
source control, and there we will
stage all the changes. We will create the commit
message with UI update, and we will click Commit. And inversal, the new built will automatically
start running. And now we have this deployed. If we will open the link, there is our page live. Now let's test our application. We are here on a landing page and we will click
on Get Started. That will redirect us to the signup page where I will
select continue with Google. Now the user is saved into
Clerk then via webhook, it will be also saved
in our database. In our database, you can
see that with a new user, I have a null for
Stripe customer ID. The next step will be getting
access to the application. There I will click on Subscribe. It will redirect me to the Stripe checkout
session. There I will pay. I will get the payment
successful message, and now I will be able to use the product and how
the product will work, I will past there
the YouTube URL, and I will click Analyze Video. There I will see
the thumbnail of the video that is
being analyzed, skeleton for the analysis
until it's loaded. There is the AI analysis. I can save the analysis
into database. Then I will see it there
in saved analysis. When I will click
on it, it will open a model with the saved analysis, and I can edit it and save it into database or just delete it. Now let's go to
the database and I can see the active
subscription for my user, and also I can see the analysis being saved into the database.
44. Project 3: Intro and Demo: We'll create a Po STAC SAS
application based on Next JS. I will use AI to help me
build the back end for this, and we will set up
authentication with clerk, save data to Super
baase use Prisma RM, and configure
payments with Stripe. You can find all the code and prompts linked
in the description. The prompts are in
prompts file and you can use the code for yourself and just build on top of it. Now let's check out the
demo of the application, and after that, I will walk you through how I build
it step by step. Let's check the application. We are there on a lending page, and now we will need to sign in. We are directed to clerk, and we will select our user. I will use their
continue with Google. There I will click on
Subscribe as I don't have access to the product
because I didn't pay yet. Here I will fold the
test data and pay, and then I have access
to the application. Here, you can upload
the PDF file. Then click on the
Analyze document button, and the summary
will appear below. I tested with an AI generated PDF document containing prompts, and it provided a nice summary. That will be for the demo, and now let's see how I
build this from scratch.
45. Project 3: Prompt 1 for Core Functionality: Our IDE, we will run this command for creating
a next JS application. We will put no to source
directory, yes to a router, and then we'll just go with recommended options and to have all of these prompts I
will use today saved, I will create a new file, prompts, and first
one, we'll start with, please create the
next JS application called PDF twoiI that will allow users to upload to PDF and provide summarized
version of its content. Blow are the detailed
requirements. We will start with
application overview. So users should be able to
upload the PDF from the RPC, and the application will analyze the uploaded PDF and display a summarized version
of its content. On a page, like lending page, we will provide a minimalistic introduction to the product. Then we will include some
text describing the tool as a modern AI powered PDF
summarizer, something like it. Then we will add a button to navigate to the dashboard page. On the dashboard page, we
will have input field where the user can select
PDF file from the RPC. We'll also include
a button labeled analyzed PDF that triggers
the summarization process. Below the button, we'll display summarized
content after processing. We also know there that
if the user is not subscribed and put their
dummy value subscribed falls, we'll show a subscription button instead of the upload
and analyze features. And there I also
mentioned that we will use dummy logic for
subscription for now. For the design specifications, we will use a dark modern team with dark gray background
and purple accent details. Also, ensure the design is
minimalistic and responsive. We will use Delvin
CSS for styling, and now to Navbar component, we want to include a
simple enough bar with the logo and links for
login and dashboard. And from the technical side, we will use Next
GS as a framework. We will include
comments into code explaining the logic so you
can understand it better. Then we want this
to actually work and not be a dummy
value for PDF analysis, and please provide a complete code structure for
this application, including components,
pages, and styling. So let's copy a prompt, and we will give
it to Deepsk R one and see how it handles that. I will paste it there. I will make sure the reasoning
module is checked. So we have the response
there. Let's start. Actually pasting it into our ID. We should install
these tailwind forms. So let's go to IDE
and put it there. And I forgot to prom, please send me on the code
again, but use typescript. Yeah, I should also mentioned there that it should
be in typescript, so I will just
tell him to fix it and he will resend me the code. Now we can start copy pasting. I will start with the
configuration file in tailwind then we can do navbar, so I will create the
components folder. And Navbar Tsix. I will paste it there.
Then a landing page. So in our app, I will put it
there, then dashboard page. So there I will create
a dashboard folder, page DTsix, put it there. We don't need this login page because that will be
handled by off provider. Then we should put this into our Globus dot
CSS, so I will do. And then that should be it. So let's see what we have there. First thing is that
we don't want this. Second one, he also
forgot to delete this, and I think there will
be the same issue. So let's just delete
this JSX element. Now we also need to
import the Navbar.
46. Project 3: Features and AI API: We will send a second prompt to review dashboard page
and optimize it. We want to subscribe to unlock
the PDF analysis features, upload the PDF file
for summarization, view a summary of
the PDF content, and also improve the code, enjoy better performance,
use best practices, enhance the styling consistency, provide the suggestions
for implementing a real PDF analysis APA backend, and also do not change the overall
functionality or design, just refactor and
enhance the code. So I will send the prompt there I also tried there to add, please for the PDF analysis, use Deep Sk RO API,
that will handle this. Implement it into the code. And I will send this
prompt and let's see if DC will be able
to do this on its own, or if I need to provide some
of his documentation to him, and then he will
build on top of it. We have the answer there,
and now we can implement it. We have the dashboard. So it's again using
the JSX element, but I think we can just fix it. Let's see if I will
just delete it there. Now it also needs this one. For now, we can do their use client so it will
work and we can test it, and we can continue with
getting the other code. I will scroll down. There
I can see deepsk APIKey. I will put it into
the NFle so I will create there a new file
dot N, put it there. There we will paste the API key. So if you go to
platform.dips.com, you will go into APIKys and you will create
there a new API key, and there you will copy the key itself, and you
will put it there. There we can create
a new API key, just something like
this. I can copy this. I will put it there
into my application. I will later delete this key, so I will just now
show it to you, but you should never
show the key to anyone and now back to
the deep seek itself. Now we should create
types index dots. There we will create a new
folder, types insight. We'll create index dots, there we will put the types, and we can continue. So we need to create
API Analyze dots. We will copy this, but we will ask some more
questions there. So I will copy paste
there these three things. And I will ask more on the folder structure
for the first point, then I will ask for the folder structure on
the second and third. I will send this
request. We will wait. And it provided me
folder structure. So this is actually
pretty handy. We will create the
API and analyze and put there into
the route TS to code. We will create the API, analyze, and inside Analyze, we will create the route Ts. We will put there the
code. Then I will continue there I will ignore these two messages because he
will send them to me again. There is a folder structure, so we will need to have a
library folder with Uts types. We already have it, but
we will just rename it, so I will rename it
to API dot d dot ts. I also will create
Middleware dots and lip folder with
middlewares and Utols So lip folder, middle wares, and also Utils. Then I will create rate
limiter dots API handler and validate request. Now, also in the zip folder, I will create error dots and I can move to copy
pasting the code. So for the analyzed routed dots, I will paste this code. For errors dots, I will paste this one, rate limiter there. There we have
validated requests. The middle ware The the types. And that's it. We will also
install these plugins, so there we will
run this command. I think we should
also install Open AI. There we just need to
import the next response. In rate limiter,
we need to import the cache and the API
error from errors, and there this request
should be as next request, and we need to import next
request, and that will be it. Now I would say we can
try to run this and see if it works somehow or not, and it looks that
it somehow works. So we have it there.
UI is not the best, but if it will at least work
somehow, I'm okay with it. I will choose a PDF to import, and after I will click ANI PDF, it should analyze what is
the content of the PDF. There is the PDF and I will click on ANI
PDF and let's see. We got failed to fetch, so we will check
where is the error? I will open the terminal there, but there is no errors. Now I will inspect,
where is the error, so we will take this and
we will go to Deep Seek. Hey, I tried to analyze the
PDF and I got this error. And let's see what
he will figure out. Now we got the response. So I will copy paste
it, copy from there. This should be for the
route. And it's fine. Now the next content, and we need to modify
the front end call. I will take this front end
call and I will actually need to implement it
there on the front end. So let me just do it. That means we need to take
this Now, it should be fine. So we will now go to our page. We can refresh, and let's see if now it will
work. It's processing. Looks like it's failed
somewhere. So let's see. Maybe it's not displayed, so I will prompt
that the output is nowhere displayed and the
Console, nothing is locked. I will send it to deepsk and let's again see what
will be the result. We got some enhanced solution, so I will take this to route DS. I will go there, paste it there, and this one will be
for dashboard page. I will take this handle
analyze function. Just paste it instead of the current handle
Analyze function, and I will click on Analyze
PDF and we got an error, so API error not found. So now with the error and it also told me that it's not
sure about the endpoint, I click there on the
search, also on web, I pasted there the error, and for the answer, I received
what I should exactly do. So I just copy paste this,
told him in next prompt. Based on this context,
what you just sent, please provide me
with a fixed code, and I will implement it. So I will start with the route. Then on the page, Then I also
need to create PDF Utils. Install this plugin,
and that will be it. I just needed to
update the route, and now it should be fine. We will try to analyze the PDF, and now we need to wait a bit, and there is the
summary from the PDF. I will just put there prompt. Can you please
format the summary? So it's nicely readable,
a model design. So when my user
receives the summary, yeah, he can read it nicely. There I receive the code, and this is the code
for the summary with also the function.
Let's just copy it. We will now go to our
summary in our code, which is on the dashboard page. We will put it there,
and we need to cut this function and put it above the return. So I will cut it. Now I will put it there below the last function.
It's this one. So yeah, it should be there. Now I will save it
and you can see, we have it nicely
formatted with these two, I would say, small icons. I'm just getting let's just remove these two SUGS
and it should be fine. So there is the first one.
We can just remove it, and there is the second one. And that will be it. There we have the summary from the PDF. If you are curious,
which PDF I sent there.
47. Project 3: Implementing Auth, Database and Stripe: Now it's time for
the third prompt. I will be there, please
now help me implement OTB ORM and Stripe for payment. For authentication,
we will implement Clard authentication with
sign in and sign up pages. We will add middleware
for protected routes, set up user profile management, and also implement
webbookhandling for user events. For database and ORM, implement Prisma ORM with model. I mentioned later in this
message because on the bottom, we have the user and subscription model we
want to stick with. Then for the payment
integration with Stripe, set up Stripe
subscription system with early pricing plans, payment processing, webhook handling for
subscription events, and user subscription
status striking. For this, we will also
mention that after payment, where user will get from
the subscribe button, we have there, but currently it has a
dummy functionality. We want user to be
redirected to Stripe. Then we have the
Prisma database model. I will also mention to
not change it and I will put there the model
for user and subscription. Now I will take this prompt
and I will put it to Deepsek. I will check also
search on the web. We'll put there also,
please provide me with a code and also with
a photo structure. So it's clear where
the code belongs. And there we receive the answer, and we have the structure, exactly as we mentioned it. We have Da code,
and to be honest, it looks very promising. There's a sign in signup page exactly like is in
documentation for clerk. There's the stripe integration that also looks very promising. And there is the
Webook for Stripe. So far, the structure
looks really good. And we have the subscription
check on dashboard. We have there prepared the environment variables
for the clerk and so on. And let's try. Let's now put it into code and see if it will work or not. Let's go step by step. First, we will
execute this command. Let's open a terminal there
in our application in our ID. Then I will prepare a second one Then there is the
folder structure, so I need to create a folder. There I will put
sign in and sign up and into it the page t six. Let's do it. I will
also copy this and I will go there in root
folder or in app folder, I will create off
in parentheses. This means that if you will want to get to
sign in or signup page, you don't need to
do off slash signN. When it's in parenthesis,
it's ignored. So it will be just
slash sign in. There I will inside
create a new folder, I will put there
the thing I copied, but just without page t six. I will create it
also for signup. Inside, I will create page
T six there and there. Now I'll put this
code in middleware, Ts. I will paste it there. This import with the
middleware, I will put on top, and this we can put there. Now, also the thing is that off middleware is now
not being used by clerk. So instead, again, there will be some error
we would run into, and if we would ask AI, he would probably
give us the answer, but he needs to now work with not off middleware
butler middleware and yeah, do it like this. Also, we don't need to put there the public route
or the specified. We will just export
it like this. Now, let's continue.
We should put this on the layout,
so we'll copy it. And there in our
layout on our app, which we can find there, we will paste it, and we will just check
what we need to add. So basically,
there's everything. We just need to put there
the input on the top. And as you can see, we are also missing the
clerk provider text. So let's put it there.
Should wrap the HTML. And below and delete this. Now it will be fine.
Then we will continue. There are the pages for
sign in and sign up. So this is sign in. And this is sign. So prisma schema dot Prisma, that means we will
in root folder, create a new one Prisma, and insight, we will create
new files, schema dot Prisma. There we will paste the module. Now we need to create in a lap folder Prisma dot
ds. Let's go there. Sometimes this file,
which we are creating a Prisma Ts is also
named as TB Ts. What we are basically doing is we are initializing
the the Prisma, so we don't need to do
it over and over again. Now, the striped Ts
in our lip folder. So let's continue stripe dots. Now, there's issue
with the APA version, but this is again something
we need to update by ourselves to the
latest API version we should use for stripe. Then we need to create an API stripe folder
and put there route DS. Let's go to API,
create stripe folder, create route dot
Ts, put it there. Then in webhooks, we
will create Route DS. Then we will update the
dashboard page with this. Let's see what we need to add. These imports. Then this above the return, and then this
conditional rendering. I can now delete this
code and put it there. And we will take this
content, got it. And we will ask for stripe button generation,
things like this. Then we will prompt that we want to generate the code
for Stripe button. We had previously d this, but it was based on
the dummy value. You can maybe create a function, handle subscribe that basically was the dummy value itself. You just send us everything, so we will create
this in components. Let's do it as he is.
Let's create it there. Stripe button do TA six, what I would do, but I won't
do it as I want to do it. As DC is telling me, I would create there a folder
underscore components, and I would put there related components to the dashboard. But let's not do it now. So I will do the stripe button, I will put there the import. Is it important? Yes, it is. Now for the off, we will need
to add the slash server. Now we will put there
this API version for Stripe in our
Stripe DTS file. There, let's first
push the Prisma. And then we fix these two
more errors we have there. So we have the Prisma file, and we need to push this to our super baase and there we
will be storing our data. What we need to do
in our dotina file, we need to put there all
the environment variables. We can also take them
from there so we know the exact variables
we should be looking for. That means we need
to get it from clerk, Superbse and Stripe. Now I'll show you
how you can do.
48. Project 3: How to Get and Set API Key Secrets: We will integrate user
management with Clark, and you will sign in, then go to this dashboard. There in our applications, we will click on
create application. For application name, I
will select SAS Tutorial, and next to email, I will
have also login with Google. I will click on
Create application and now I have their guide
how to do this with next JS. We have their
environment variables. Let's click on Copy, and now we will paste it there. Then we can also
see the example of the implementation for
this sign in sign out, but we will from this take only the clerk provider and
put it into our root layout. And these buttons, we will
put the navigation bar. If you want to
continue with a guide, you will click there and
continue to Next GS guide. And there is documentation of the things we will
go to Supabse. And there we will sign up or
login if you already have an account or also you can basically use
Continue with Giu. There you will click on
create a new project. We will choose Organization. There we will select
project name. There we will
generate a password, and we will click on Copy. Save this password somewhere. We will use it in a while, select your origon and then we will click on
Create New Project. Now in Super Base in project settings and
there in database, we can get this
connection string. We will click on copy, and we will go to our
environment variables and we will paste it there. Now there into your password, you will paste your
password that you got from Superbase that will
look like this, but of course, this
is your password. And then take this wall string and put it into
this database URL. Now we will go on documentation called Super Base with Prisma, and there we can also see some next steps we need to do to connect this with Prisma. There you will find
these two strings. The first one will be
for the database URL. Basically, it's
the same we have. The only thing edited
there is after database name is this question
mark with PG bouncer. Let's take it and
paste it there. For the database URL, then your string will
look like before, but with edit question
mark and PG bouncer, and there we will create a new environment variable that will be called direct URL. Take this string, put it there. Now we will delete this
up to this database name, which is PostgresS we will
change this board to 5432. Now we will save it. Now I will just put the real password
from the super baase. If you forgot it, I will
show you how you can get it. There in database,
you will click on Reset database password,
generate password, reset it before, just copy
it if you want a new one, and then you will put
it there onto display. Now what we will do is
that we will put there in the terminal NPXPrisma
migrate Dev. We will enter there we
will put some name for the migration and
wait for a bit. We can also do this
with NPxPrisma DB push. NPxPrisma DB push
is when you want to quickly push some
changes to your database, it doesn't track them and NPXPrisma migrate deep
will track the changes. When we will add some
fields or some model, we will have it cracked down. You can also see it there
in Prisma migrations. There it is. And there
in table Editor, you can now see
subscription table user, and you can see there
all the fields. We open documentation of clerk, and we will go there
to synchronize clerk data to your
application with web hooks. First step is to set up Ngro this will help us expose our local
server to the Internet. What we need to do
is just download Ngrog after you download it, you will open the
engrogtEXa file which will open a
terminal for you. Before downloading
it, you need to login on this engrog.com, create an account there,
and then you will download it and open the
engrog dot EXE file, which looks like this. In this terminal, we will paste
this, but it won't be 80, it will be 3,000 as
this is our local host. Now we can see it's
forwarding it like this. If we will go into our
engroc and hit the tunnels, we can see it displayed there. For the next step, we already have these
environment variables. Only thing we will take
is this Webook secret. Let's copy it and put
it into our N file. There in environment variables, I will put it like
this and save it. In step two, you can
see that we need to update this Clerk dashboard
with our endpoint. We got from Engroc there
we will in our clerk, we will go there into web hooks. There we will click
on At endpoint, and there what we will do. We will paste this
URL from the Engoc. We will paste it
there. And after we will do API,
web hooks, Clerk. This is the endpoint URL
we should use there. And what we want to subscribe
to is user creation. We can put there user dot create and also we can leave the selected updated,
deleted, and so on. Let's click on Create, click on assigning secret
and copy it from there. And we will put it on this
play to our webbook secret. Now we will set up a stripe. First, you will login
or sign up to Stripe. And then in Stripe, you will create a new product, and there in the new product, we will go into developers there we will go into API keys. And there we will take
the publishable key. Then we will go to our IDE, paste it there, and we will
go back for the secret key, we will click on Reveal
and then click again, so we will get it to clipboard, and we will paste it
into our dotnf file, so into our
environment variables. I have the publishable
key and the secret key, I will put a name for these
environment variables. As this will be a public one, I will put the next public and then Stripe publishable key, and for the secret
one, I will put Stripe secrete then we'll
go back to stripe page. There we will go to Product Catalog and you can see I already have
there two products, but I will create a
new one with you. Let's click there on at product. I will put there a
name of SAS product. I will set there a
price recurring and 1990 $9. It won't be monthly. I will set it as yearly and there I will
click on at product. Now I'll click on it
that will get me there. From there, if you will click, you can copy price ID, and then you can save this in
your environment variables. You can see like
this. I put it there. And last environment
variable we will need from Stripe is the
Stripe Webbook secret. So let's prepare it there. This is not the secret
you should put in. For the secret,
you will get this actually generated
from the terminal. So what we need to do now, we will go there on web hooks. We will click on test
in Local Environment, and there we will get the
guide what we need to do in order to set up
the stripe for webhooks. So first, we'll need to download the client there you will select your system
for meets Windows. There I will download this
zip file from Github. You will unzip it, then you will open the folder, then you will open
environment variables in your computer and you will add a path to this dot
ax file there. You will open your terminal. You will write stripe there and you will
get this information. That's how you will know you successfully
installed the client. There we will go
back to this page. Then we'll put there this
first command, stripe login. We will copy the URL. Open it there, there
we will see the word. We will click on L Access
and access granted. Now if we go back to that page, we will see there completed, then we will copy this command and we will
open there a new terminal. Now we will paste this to
forward event to our webhooks. What we need to do is that we will change it to
our local host. Also we will put
the API webhooks stripe. We will a Enter. With this, we will get the
stripe webhook secret. We will paste it
and put it there, open our terminal
and there we will do stripe trigger payment
intent succeeded. There you can see we are
getting to 200 status response. Your dotn file with all the environment variables
should look like this.
49. Project 3: Subscription Check: Edit three new
environment variables, and it's this next
public clerk sign in URL and signup URL. Were you will just do slash
sign in and slash signup. Basically, you will just
copy paste these two lines. For Webbook secret, this
is the webhook secret from clerk and you will put
it there, and that's it. After you have all these
environment variables, you are all set, and that's it. And last one, what
you will adhere is next public ap URL,
local host 3,000. Now we will run the command and Px Prisma generate to
generate the schema. We'll do NPXPrisma D B push. This should push the
schema into our superbse. And before we do it, we
need to add there also one additional thing
below this URL. We'll add direct URL to have the direct
connection to our superbase. Now after we have
this and save it, we can do NPxPrisma DB push. We'll run the command,
and this should push our Prisma model into
our Superbase database. That means now we will
go into our superbase, we have their user and subscription model,
which is awesome. Now we can continue
with the testing. For the fix, we will need
to make a new prompt. So there I will go
to my prompt that I'm putting there just because I want to share them with you. Otherwise, you can directly, of course, prompt the Deep Sk. I'm just noting
them there, so you will be able to use the
same prompts as I used. I will put there prompt four, and I will now create
it Please send me the user implementation
in API and then do code with a folder structure
where I should implement it. Check the subscriptions,
consider schema adt prisma and still
don't change it. Then I need to check for his subscription on
the dashboard page. So let's take this
and let's prompt. There is the response.
Let's go and try this API user route Ts.
Let's put it there. API User and route Ds. There's the code. Now we should also add these
two type definitions. So that is there
types user dot Ts. Then add this to
our dashboard page. Let's copy this. Let's go to our dashboard page.
Let's put it there. There we will take this use effect and we will put it there. And these imports Then we will take this
user subscription, but now let's put
there the imports. Also, we should be there. This is duplicated,
so we can delete it, and Navbar we already have
use the fact we will add there And now that
should be fine. Later, we will also
delete the nist code. And now we should also check now for this user
data subscription, we can take this and
we will put it there. So there below, we can also add the stray button and then
we'll put it like this, save it and should be fine. There is some error. Let's
just quickly find it. This is no longer
needed as we are using different approach,
so we will delete it. Subscription dot ts, we
will take it in lip folder. We will create a new file, subscription dots, put it there. Now you can see we have
two errors when getting this user ID and how to fix this simply of returns promise. So in order to make this work, we need to await it.
We'll put there await. Then we are missing
it also there, so we'll just await it and
it should fix our errors. Now everything
should be working. So let's do NPM run
def once again. And we have the error, and that's because I made
a mistake there. We need to create also
folder sign in and sign up. Then we will put sign into sign in and sign up into the signup. Now it will work. So
we'll do NPM run death. So we are there. This
is the landing page. We will click on get started. Before we start, we
will take our NAF bar, copy it, go to Deep Seek. There we will paste it, and
we'll make another prompt. Please adjust this Navbar, and we want to adjust
the nav bar to proper clerk
implementation using the clerk text and everything. So I will again check
the search so it can get some documentation
from the Internet. Then I will send the prompt, and I will be expecting Navbar component returned with the proper text and everything. And there is our NAF bar. Now I can copy it
and put it there. H.
50. Project 3: Webhooks for Clerk and Stripe: We will now create the prompt and we will also
mention that we want this according to documentation of stripe or clerk
for the webhooks. Let's start writing the
prompt. I will put it there. It will be prompt number five, and now I will create it and it will be a
really simple one. Please send me the webhooks for clerk and
stripe according to the documentation and my
database schema with typescript. Now we will send the prompt. And there is the answer. Then we should have
clerk in webhooks, and I think it's a bit different folder
structure that we have there. So there in webhooks. Let's create a new folder, clerk and the route dots. We will put it there.
Then stripe one. So basically, we can
move the one from there. We will put there the code. Then we have there
the environment variables, the structure, how it should look like,
and that should be. This one for Stripe
is already there. So we can just delete this one, and we will have there just
webhooks, clerk and stripe. One more fix there
should be again weight, so we will just put it there
and also add as string. And for clerk, let's
install this plugin. So let's open the terminal
and do NPMI swix. And also we will await there. And if you are
wondering where to get the clerk documentation, you can go on this page, clerk.com Documents
webhooks synchronize data. So there you can also find the documentation and
provide it to Deepsk.
51. Project 3: Testing: To test this, we
need two things. First one is open Ngroc that you downloaded
and installed, and there we will do
Engroc HTTP, 3,000. If you are running
on local host 3,001, for example, you will need
to do Engroc HTDP 3,001. There I will take this URL. There you will go
into Configure, there you will scroll
down, go to webhooks. We will add a new endpoint. I will past the URL
from Engroc and do API Webhooks clerk. There I will check user
and all these events. Click on Create, and I will
get this signing secret. So I will just display it, and then I will copy
it and I will put it into our environment
variables like this. I will also in terminal
paste this command, stripe Listen forward to local Host 3,000 API webhooks, Stripe. Before you need to do
the stripe login as we did previously to
log into the stripe. After there it's checked. Every time you will want
to test your application, you need to do just this
Stripe is sent forward to Localhost 3,000
API web Book Stripe. This needs to be
the correct path. If there is, for
example, webhooks XIX, then you need to have the
API webhooks ixix stripe, but we have the correct naming,
so it's fine like this. Now we are all set
so we can test it. If you want to test the user that you already
have in your clerk, just delete the user
from your clerk. Otherwise, it won't work. The
user you want to test this with cannot be in the
clerk previously. It needs to be there
just after you will sign up with him now
because otherwise, the user will get duplicated. I won't be created in your
superbse and this won't work. Now I'm logged in. I
will check Superbse. I can see there my
user, which is awesome. Now we'll fix one thing there, we don't
need this function, and this is subscribed because we will
just check there if the user is subscribed there we'll create a new
variable is subscribed. We will check the
subscription status in case it's active. This
will act as true. In case not, this
will act as false. And there we'll
also do an update. This we can now delete. And leave it just like this. And what we will do is
that we will go above this return and there we
will put a small check. If it subscribed is false, we will return, you
are not subscribed, we just write button. We can now see there
that we are not subscribed and to analog
the premium features, we can subscribe there.
52. Project 3: Stripe Checkout Button: We need to check
the stripe button. Let's go to the prompt
and there in the prompt. I will create a new one. Please create a stripe button according to stripe
documentation. So I can create payment. Now we will take this prompt
and put it into Deep seek. Now he will start with
the button creation. There we have it almost. So what he sent is the create checkout session and then the stripe
checkout button. I think he means that
we should put it there, so we will go there next
to the Stripe button, create there stripe
checkout session dot ts, put the code there. Again, this needs
to be weighted. Then the functionality
for the button itself, we will copy from this one. We will copy and paste it there. We need to adjust this
how we created it. Stripe checkout session,
stripe checkout session. I put there a wrong name
and there we are missing a component from ChtCNH you can get components
from ChetCN. It's super easy, just do NPx
ShetCN at latest at button. Adnter and it will automatically download the component
from the ChetCN library. There we will just do the recommended
things and that's it. This is getting
us to next prompt and it will be prompt seven. This one will be
for stripe checkout session dot s. I wanted to keep a simple functionality of great
subscription because it's coming with bit more things than needed and it's
causing errors. I will also mentioned
that I want it according to stripe documentation,
and for button, just keep the simple
functionality, calling this create subscription.
So I will copy this. Then we are here with the stripe button and with
the stripe checkout session. So basically, in the
stripe checkout session, you will have just one function, create subscription. And
that will look like this. I will, of course,
also put this to Git up and you can find the
COVID in description, so you can take this
and build on top of it. You can see there I'm using
the Stripe Beauty price ID, which we set in our
environment variables. And in the Stripe button, I'm just calling this
create subscription. So now let's go and test this. There after getting
to Dashboard, I will click on Subscribe now. It will redirect me. There I will fill in the information. Or stripe you are
testing with 4242, card number, then
pay and subscribe. Then we are redirected to page
that doesn't exist because we need page payment success
or payment canceled page. I can provide you
these two pages. I will put them there so
you can take them from Git. I think they are also in
the Stripe documentation. So now if we are going to page, we can see that we have
access to the application. We will also go to Superbase
There we will refresh, and we can see that our
subscription so is working. Our user now has
active subscription. Let's try to upload some PDF. Now we analyze and we have
there the analyzed PDF.
53. Project 3: How to Update UI with AI: Prompts, I will be
putting design model UI with clean
lines, open spaces, and intuitive navigation
featuring dark background, nice color details, and please don't change the
functionality, just the UI. So I will copy this, and
now I will go page by page. And there I will first head to the landing page or actually
first to the dashboard page. I will do CederlKPase
there this prompt, hit Enter, and let's
see what it does. And now this is
looking much better. We will continue to
the navigation bar. So there again Sutro plus K, put there this prompt and denter now we will go
to the lending page, and there we will
do the same thing. It edited also some additional
content, which is great. Now, this looks good. I like it. And I think that's basically it. We'll get started. We
need to subscribe. It checked out subscription. Now we are in, we'll choose the file. We have
the file there. We will click Analyze document. It will be loading,
and there we are.
54. Project 3: Deployment: Now we will deploy this. First, what we will do, we will check if we have there
some unused code. So let's just go from page. There is nothing. There
we don't need this. And this just double check that we are
using all the imports, otherwise it will fail to build. I think there is fine. Now, we will check the
button and the checkout. Now the striper route,
also with the clerk. Next response is not being used. Now the route there, analyze there, we don't
need this API key. And there it looks like
everything is fine. Rail imeter API handler is
empty. Let's just delete it. I'm not sure why DeepC
created it if it's empty, but okay, there we
have everything. Looks like all the
code is being used. So it should work UTS and there
everything is fine. We will create file code versal JSON and we'll put
there this code. Then in a next config Gs, and if you have any other next
config files, delete them. We will put this content. Then in package JSON
there in script, you will put this content
for these commands and then you will execute in
terminal commands in this order. First, this, then
this one, this one, then you will do NPM install, and then you will
run NPM run Build, and it should run the
build successfully. So now you should be
ready and we can deploy this code to our Git upp
and then a reversal, we will make it live. What I will do is
do sutrllus Shift plus B, published to Git upp. I can do their private
or public repository. As this repository
will be there for you, I will put it public and
then share the project. Now there you will
stage all changes. You will put there
the first Commit, click on Commit and
publish branch. Now we have it there
on Git Ap what is also super important is to
check that in Get Ignore, I know I'm doing this late, but it should be there
default line now. We have there the dot Nf file. Because otherwise, we will
expose all our secret keys, and anybody would be able to
see them and take them, and, of course, we don't want it because these
are secret keys, and these are giving access to our database of
provider and so on. So make sure it's
not there and make sure N file is never
deployed there. Now we will go to versal.com. Now I will add a new project. I will at my Project Deep
seek ARO Project one, which I just published
on my Git upp and there, I can set all the environment variables, how this
will look like. If you will go into your dot and file and you have
their webhook secret, you will put there the name
of the environment variable, and there you will put the
value something like this. And then you will do this for all your environment variables. So for example, clerk, I don't remember the name, but yeah, you probably
know what I mean. Clerk and paste it there. Then you will have
the stripe one, and you need to put
there the names that you have in your
environment variable file. So put there the proper
names and the proper values, and then after you will
be done, hit deploy. Or you can do it also
in a different way. You can paste the
dot and file above, and it should load
all the values. Let's now try it. So we
will hit Deploy there. It will fail because we don't have the dot and file there. We will click Go to Project. There we will click on settings,
environment variables. And there is the button. I will put there some value, click on at another, click
on Import dot and file. You need to locate the DTN file, and then after you will edit, it will load all the environmental
variables there and you don't need to write it one by
one. I will hit save there. I can delete this
xx value because, of course, I won't be using it. And now I can go to deployments, go on this one, for
example, hit redeploy. Now we failed on some
webpack configuration. So we will add this to
next dot config dogs file. Then we will save it. We will go to source,
stage it there, put a commit message
and commit it, I already did it after
it will get Repo, the deployment will run once again and it will be successful. Now if I will click the link, I will get to my page and if
I want this to be working, I need to take this URL. I need to go to clerk and there I need to change
the endpoint for our webhook that
we put there from the En grog to our
URL from Versel. I will put it there. And
it should look like this. This is the link to our page, and there is slash
API Webhooks Clerc. Now I will save it. Double check that the Webook secret is the correct one
that we upload it to Versal and that should be it. And this is how you will
deploy this versal, make it live, and that will be.