Watch on YouTubePlayPlays from YouTube. Google's privacy policy (opens in a new tab) applies.
Adam explains why he hosts the app on Vercel, then connects Vercel to the course's GitHub repo and deploys it, so the app gets a public address that updates with every push.
What you'll learn
- Deploying means building the app on a machine in the cloud (Vercel's) and serving it at a public address.
- Vercel is the natural host for Next.js; the free Hobby plan covers personal projects; Pro ($20/month) is for projects that make money.
- Connect Vercel to GitHub and give it access to only the repos you choose.
- For a Next.js app the defaults are enough: no build settings or environment variables needed here.
- Warnings during a deploy are fine as long as they aren't errors.
- Every push to GitHub redeploys automatically; the public URL serves
main, other branches get different URLs. - The
vercel.appsubdomain comes from the repo name; you can change it or add your own domain.
Chapters
- 00:00Why host on Vercel
- 01:06Creating a Vercel project
- 02:23Giving Vercel access to GitHub
- 03:56Deploying with the defaults
- 05:04Your app's public address
- 06:08Automatic updates and branches
- 00:00Okay, so our repository is officially git tracked and is also pushed to GitHub, which means we are ready to like take that last step before making it possible for
- 00:11anyone online to go and visit our application and see it running in their own browser.
- 00:18And we're going to use Vercel for that.
- 00:20So Vercel is that very popular website right now that allows you to host and deploy your Next.js applications, not just Next.js applications, but like they support many modern frameworks,
- 00:33but Next.js in particular because it is actually created and maintained by the creators of Vercel.
- 00:39So it makes it like a no-brainer option to host your, you know, hobby projects or even like commercial websites.
- 00:48They have a pretty generous free hobby plan and, you know, if you want to take it a step further, you know, they offer their free tier at just $20
- 00:58a month, which is only something you're going to need if you actually want to start any earning money from any of your projects hosted on Vercel.
- 01:08So I've already opened up vercel.com in my browser.
- 01:11I encourage you to do the same.
- 01:13We're going to either set up an account if we don't have one yet.
- 01:16I already have my Vercel account.
- 01:18I'm going to log in right now.
- 01:20Okay, I am signed in with my Tonik account.
- 01:24Now I already have one project in here.
- 01:27If you have a totally fresh setup, you're going to probably see something else like a very prominent empty state.
- 01:34What we want to do is we want to create a new project.
- 01:37In my case, I'm going to click on this button, create new.
- 01:41I'm going to select project and then Vercel actually going to allow me to connect my GitHub account so that it can pull straight from our git repository.
- 01:53And the way it's going to work moving forward is because, you know, Vercel project is going to be connected to our repository.
- 02:00Every time we push a new commit um to our GitHub repository, Vercel is going to automatically deploy our application uh for us in the background.
- 02:10And this is going to make it uh basically always reflect uh whatever we have uh locally on our machine.
- 02:17So I'm going to select GitHub as my Git provider.
- 02:23Okay. Uh let's see.
- 02:27Didn't seem to go through.
- 02:28Let me try that again.
- 02:29I'm going to click on GitHub.
- 02:32Oh, okay. Let me refresh.
- 02:34Okay. Uh now my GitHub account has already been uh authenticated or I've already enabled integration between Vercel and GitHub before.
- 02:45Um again, if like both GitHub accounts and Vercel accounts are fresh on your end, you'll probably have to go through a flow to authenticate um through GitHub and actually
- 02:56allow Vercel to have access to your repository.
- 02:59You can select to have access to all of your repositories or just, you know, a small subset of the ones you select.
- 03:05I would recommend that second round actually.
- 03:07Um with this, I already see a couple of my repositories here which I haven't imported into this Vercel project uh this this Vercel account yet.
- 03:16But um in order for me to be able to um open up the like the application we just built or and like to build um off of the repository
- 03:25on GitHub which we just created, I'm going to hit over here add GitHub scope.
- 03:30And this is going to take me to GitHub.
- 03:33I'm going to select my own account and I am going to from the only selected repositories I'm going to open up this list and I'm going to type in
- 03:41the name of our repository.
- 03:42So Tonik Parking um Parking Course.
- 03:48I'm going to hit save.
- 03:50Uh so now Vercel has access to this repository.
- 03:54I'm going to refresh just to make it uh visible here.
- 03:57And I can actually see this repository now listed over here.
- 04:00I'm going to hit import.
- 04:02Um and then the beauty again of using Next.js with Vercel is that the deployment process or the process of setting up this project is super straightforward.
- 04:12We just we can like keep um like all of the defaults here and just hit the deploy button.
- 04:18We don't need to configure any environmental variables or anything of that sort.
- 04:22Okay, I have a two-step authentication, so I'll need to retype my um retype my uh one-time code.
- 04:34Okay. And it's going to start deploying our application.
- 04:39Deploying means building this application on a machine out there in the cloud hosted by Vercel.
- 04:46Um uh it might throw some warnings uh occasionally.
- 04:50As long as they are not errors, we don't really need to worry about anything at this point.
- 04:55Um it's going to take um a while depending on how big are your application is.
- 05:01In our case, the application is pretty small, so uh the deployment process should take um I guess not longer than a minute.
- 05:08And it's actually done right now and it's deployed on production.
- 05:12Uh perfect. And um I can actually see a preview of my application.
- 05:16The next step would be to either go and visit our application.
- 05:20And as you can see, it has already given a unique URL, uh tonic parkingcourse.vercel.app, uh which means if your repo has the exact same name, Vercel will not be
- 05:32able to give you that domain name or subdomain name because it's already taken by me.
- 05:38Uh no worries. Uh you can always go over here into add domain and you can change your Vercel domain if you want.
- 05:47Or if you have an existing domain which you got off of let's say GoDaddy, you can actually buy it over here if you want.
- 05:53Uh or like I'm sorry, you can like add the existing domain here or buy it straight through Vercel.
- 05:59That is not something we are going to be covering in this course.
- 06:02Uh the bottom line is our application is now fully deployed on Vercel, and it's available to anyone out there online.
- 06:10You can share this URL with whoever you want, and they will always see the exact same thing.
- 06:16And moving on, every time we make a change to our codebase, and every time we push it to GitHub, Vercel is going to be updating this URL to reflect
- 06:26the most recent version of the application.
- 06:28Now, you might be wondering like how does it connect with branches that we talked about you know, in the one of the previous videos.
- 06:37So a key thing to know is Vercel is always going to be looking at that main branch, right?
- 06:44And this is what's going to be that that this is the version of the application that Vercel is going to serve anyone who's going to use that main URL.
- 06:53Vercel is going to be building and deploying your application from your order branches, but the URLs are going to be different, and we're going to witness all of that
- 07:04over the course of the couple of next videos.
- 07:07So I'm going to see you in the next video.
- 07:09Thank you.