Watch on YouTubePlayPlays from YouTube. Google's privacy policy (opens in a new tab) applies.
Adam explains how a shared database differs from data kept in the browser, and what Supabase and Docker are, then installs Docker Desktop and starts the app's local database.
What you'll learn
- The training app stored data in the browser; the mature app shares one database between all users.
- Relational databases (tables like spreadsheets, linked to each other: Postgres, MySQL, SQLite) vs document databases (MongoDB, Firebase), at a glance.
- Supabase is Postgres with extra services such as authentication.
- Docker runs prepackaged containers of programs the same way on every machine.
- How to install and start Docker Desktop on a Mac and check the engine is running.
- A local database is your own playground for fake users and bookings, edge cases and empty states.
Chapters
- 00:00From sticky notes to a database
- 01:50Relational vs document databases
- 03:02What Supabase and Docker do
- 04:44Your own local playground
- 05:59Installing Docker Desktop
- 07:53Starting the local database
- 00:00So, in the previous video, we have cloned the fork of the mature version of the parking spot booking application.
- 00:08Um, and even though we could have asked Claude to help us set it up locally for us, and chances are it would succeed, we decided to try to go
- 00:19through some of these steps manually just so that we know the next time when Claude is doing something for us, we have a basic understanding of what are like
- 00:27what things are happening in the background.
- 00:30And in the previous video, we have reached this step over here, the NPM install.
- 00:34So, we have installed all of the dependencies needed to run this application.
- 00:39And then we tried running this command to start the database.
- 00:43And, you know, we had an error over here uh in the terminal.
- 00:48Uh, an error saying that we should have installed Docker Desktop.
- 00:52So, let's talk about it.
- 00:54Let's uh discuss what are um like what is the difference here between this version of the application and the one we built initially.
- 01:03So, in the application that we have built in the previous module, we didn't really have any sort of database, meaning information about like the bookings you have made or
- 01:15that have been made by others were fake and they were stored in your browser in local storage.
- 01:21It's more like writing things on a sticky notes and having them around your monitor.
- 01:26Of course, you can see them, but nobody else can.
- 01:30Um, whereas the like mature version of this application uses a proper database, which makes sure that everyone gets to see the same information and everyone can, you know, have
- 01:42their set up their own account and they can create um a new booking for their own and everybody everybody else is going to essentially see the same thing.
- 01:52And talking about databases, there are essentially two kinds that you know, we should look into.
- 01:57So, first we have relational Um these could be MySQL, SQLite, or PostgreSQL SQL in our example.
- 02:08So in relational databases we have basically tables like spreadsheets in which each row in the table is a new entry uh in that in that table in the database.
- 02:20And you can have one table for users, another one for your reserva for all of the reservations made by everyone in the application.
- 02:28And then you can have a relation between these tables which is going to make sure it's clear to everyone like whose reservation we are looking at for example.
- 02:38And then we also have these more free form um kind of databases uh non-relational.
- 02:45We can think of them as you know simple um like unstructured or like I'm sorry very much structured documents.
- 02:51We can think of uh JSON files.
- 02:54We can [snorts] think of uh things like MongoDB or Firebase.
- 03:00Our application or this mature version of the application uses PostgreSQL SQL as I mentioned before.
- 03:06There is also one more thing being mentioned here in the README file and it's over here.
- 03:11The npm install also installs Supabase command line tool for this project only.
- 03:17So what is Supabase?
- 03:18It's essentially PostgreSQL with some sprinkles on top.
- 03:22Uh you know engineers love Supabase because it gives you many good things out of the box.
- 03:28Things like authentication for example.
- 03:30We as Tonik for exa by the way have been working with Supabase in the past.
- 03:36Um this imaginary engineering team behind this mature version of the booking app has um database in the cloud on Supabase.
- 03:44And in this video we are basically going to take this this same thing and we're going to install it and run it locally on our machine.
- 03:54Now Supabase is really a couple of things all at once a couple of programs.
- 03:59And instead of installing them separately on your machine, um it's more common to have these programs like packed together in a form of a container because a container is
- 04:11something that we can later take and install like um with on our computer so that it runs the same way on every single machine.
- 04:21So it's all the same programs pre-configured.
- 04:24The thing is if you want to use these containers, you need a Docker, like a Docker desktop application.
- 04:31And that error that we saw in the previous video is essentially our computer telling us that, hey, you have the container, but I have no Docker over here to
- 04:40use it. So we are going to install one right now and we are going to install a Docker desktop application.
- 04:47Now you might be wondering, why are we even going to such lengths?
- 04:51Like couldn't we, for example, run our application locally, but in terms of a database, couldn't we just connect to the one we have in the cloud on Superbase?
- 05:02Well, we very much could have.
- 05:04But the thing about having your own local database is that it's your very own playground and this can be a really uh really nice thing, especially for you as
- 05:14a designer because having your own local database and having Claude together with you means you can ask Claude to fill it out however you want.
- 05:23It can create as many, you know, fake users or fake projects or, you know, fake bookings as you want and it can create the like all of these things
- 05:32in a matter of seconds without you needing to go through the application and click those things manually or in if this was a production database without you potentially messing
- 05:42with production data, which wouldn't be really a good thing now, would it?
- 05:47So having your own virtual sandbox really unlocks the ability to design for all sorts of use cases and also edge cases, error states, empty states, you name it.
- 05:58So let's go ahead and install Docker.
- 06:00So first I 'm going to head over to this docker.com website and I'll need to a download link.
- 06:06Depending on when you're watching this, this page, of course, might be looking different.
- 06:10Uh, let's see. Um, can I see?
- 06:13Can I find a download link?
- 06:15Okay, here it is.
- 06:16I'm go to I'll go into Products, Docker Desktop here, and I'm going to download Docker Desktop.
- 06:22In my case, uh, I'm on this M1 Pro machine, so I'm going to uh, do the Apple Silicon version.
- 06:31And I'm going to give it a second to fully download.
- 06:33Now, Docker is free for personal I'm sorry, for like, educational use or for small companies.
- 06:40Depending on your needs, you might need to check out their licensing and their, you know, terms and, you know, pricing.
- 06:47Okay, my Docker has downloaded, so I'm going to um, open it up, and I'm going to drag it over to my Applications folder.
- 06:58Okay, and with that, I'm just going to go command space Docker to open it up.
- 07:05Um, so I think it's going to ask you to set up an account, like offer you an option to set up an account.
- 07:14I don't think it's uh, it's really needed.
- 07:17Um, so I'm going to accept the terms.
- 07:22Yeah, I can totally skip this step over here.
- 07:26And uh, let's see.
- 07:29Okay, so um, I can see that this whale icon in the menu bar um, I'm not sure you can actually see my menu bar, but there is going to
- 07:39be that whale icon in your menu bar.
- 07:41Um, if it's not animating, it means that the engine is running.
- 07:46Uh, and I can actually confirm this by uh, taking a look over here in the bottom left corner.
- 07:53So with the engine running, I'm going to go back to my terminal.
- 07:56I'm going to type in Docker version just to confirm.
- 08:00Okay, so it hasn't found.
- 08:02I think I'm just going to restart my terminal and give another shot.
- 08:10Okay, there it is.
- 08:12So now with the Docker installed, we can come back to our readme file and revisit the step number two and try running that npm run database start command again.
- 08:24But of course, we need to make sure we are in the proper folder on our Mac in the terminal.
- 08:29So let me type in current directory, paste the path.
- 08:33Okay, I'm in the right folder and now I'm going to copy this, paste it over here and okay.
- 08:44So this is going to take a while that initial initial start is going to download quite a lot of things.
- 08:51So give it a second depending also of course on how mature the real application you're trying to run locally is, this process might be even longer.
- 08:59So go and grab a cup of coffee, cup of tea if that's your thing and after we come back, everything should be good to go.
- 09:09Okay, the download has finished.
- 09:11Docker is requesting access to my documents folder.
- 09:14I'm going to allow it and over here in the background in the Docker desktop application, I can see there is a container for Tonik parking application and yep, and
- 09:26now we have a confirmation that everything is good to go and and with the step number two officially behind us, all that's left before we can finally run the
- 09:37application is step number three and we're going to talk about it in the next video.
- 09:42So I'll see you there.