Claude Code for Product Designers
Lesson 33 of 49, 0 of 49 lessons completed
Sign in
Watch on YouTubePlay

Plays from YouTube. Google's privacy policy (opens in a new tab) applies.

Up next

3.5 Explore with Claude

Next lesson in 8 s

3.4 Secrets from the team

Adam explains secrets (environment variables) and why they never go on GitHub, then creates a .env.local file with the local database keys, starts the app and logs in with a test account.

What you'll learn

  1. What a secret (environment variable) is: a key–value pair, such as a database address or an API key.
  2. Why a leaked API key can cost real money.
  3. Deployed apps keep secrets in the host's settings, e.g. Vercel's Environment Variables.
  4. Never put environment files on GitHub, even in a private repository.
  5. .env.example lists which keys exist; you create .env.local with the values.
  6. .gitignore lists files git must never track; env files are usually in it.
  7. Show hidden files on a Mac with Cmd-Shift-. (dot).
  8. Test accounts are listed in the README.

Chapters

  1. 00:00Why your app needs secrets
  2. 01:44Keep secrets off GitHub
  3. 03:08Finding the hidden env files
  4. 04:47Creating .env.local, checking .gitignore
  5. 06:11Filling in the database keys
  6. 07:47Running the app and logging in
  1. 00:00Well, in the previous video, we have installed Docker and we have run it.
  2. 00:04Does it mean that we can finally go and start the application locally?
  3. 00:09Well, not quite because even though we have the application and we have a code base database locally, our application still doesn't know where to look for that database.
  4. 00:18And the reason it doesn't know is because that is a secret.
  5. 00:23And the secret is important because like in general, you really don't want other people to know where to look for your database or what is the URL of your
  6. 00:33database. That is one example of many secrets that your application can have.
  7. 00:39Another example of a secret that your application can have is when you have some third-party integration.
  8. 00:46Let's say you're trying to build an application that has a chatbot, an AI chatbot.
  9. 00:50You will likely going to need either OpenAI's or Anthropic's models for this.
  10. 00:55So you'll need to set up a developer account in one of the in either of these companies and you'll have to generate your API key and you'll going to
  11. 01:06need this API key in your code base in order to have that integration running.
  12. 01:11And that API key is something that you're going to be charged for.
  13. 01:15I mean the usage under that API key is something you're going to be charged for because you'll need to have your credit card connected.
  14. 01:22You really want to make sure that only you or and the people you trust have access to that API key because if it ever gets leaked, anyone with an
  15. 01:31access to this API key can start using it in their own applications and that can cost you a lot of money.
  16. 01:40So we know there are secrets in the applications.
  17. 01:43Where do you keep them?
  18. 01:44Well, in the case of a deployed application like this one, if this was deployed on Vercel and you can pretend it is in Vercel, there in the project settings
  19. 01:55there is actually a page called environmental variables and this is where you keep secrets.
  20. 02:00And a secret is just an uh uh like a key value pair.
  21. 02:04So you have a key which is the name of the um of the of the secret and then value being like the actual thing you want to protect.
  22. 02:13And while it is okay for everyone else to know what kind of variables or what kind of secrets you'll you'll need to know in order for your application uh
  23. 02:23to to run, you really want to protect the secrets themselves.
  24. 02:28Uh which means that um you don't really want for these environmental variables to ever end up on GitHub or on a Git track repository that is available publicly.
  25. 02:39Uh it doesn't really matter if this repository is private.
  26. 02:42You really just don't want to have your environmental keys on GitHub under any circumstances.
  27. 02:49If there is just one key takeaway for you from this entire video course, well I'm not personally sure if that would be the one.
  28. 02:58I can imagine there are people who are going to say this is the one key takeaway.
  29. 03:02You really don't want to keep your application or environmental variables on GitHub.
  30. 03:08Uh what you want to do again is you want to have a list of the keys that you're going to need to have in order to run this application.
  31. 03:16And this repo has one.
  32. 03:18And it's stored in a special kind of file that is called .env.example.
  33. 03:24ENV stands for environment and example stands for example.
  34. 03:30So if I go if I go and open this up, it seems like our application only needs two keys and both are related to the database.
  35. 03:40So our application simply needs to know where to look for the database.
  36. 03:44And um if I go back to uh my Finder and open up the folder for this um uh for this code base, I cannot really see these files unless
  37. 03:56I do command shift and dot on your Mac.
  38. 03:59That is command shift and dot.
  39. 04:01Uh this is going to up all of the hidden files, so files that begin with a dot in their name, and only them then I can actually see that
  40. 04:09that the .env example file is also present on my Mac locally.
  41. 04:15Um, so what I'll want to do first of all, I wouldn't be really looking at any of this if I were a real engineer.
  42. 04:22I wouldn't be really looking at this through a finder.
  43. 04:24I would probably be looking at this and editing these files in a code editor like VS Code.
  44. 04:29But we have an installed one in this course, and we are not going to be doing this.
  45. 04:33So I'm okay with the fact that this couple of next steps are going to be a little bit awkward.
  46. 04:38Again, this is not really how you would want to go about this, uh, but we are going to be fine with this as well.
  47. 04:45Um, so I'm going to, first of all, create a copy of this file.
  48. 04:49So command C, command V.
  49. 04:51Then I'm going to remove the, uh, .example.
  50. 04:55This is going to create my local environment file.
  51. 04:58Actually, I'm going to give it a name local.
  52. 05:00That is a common convention.
  53. 05:02Um, and, um, later on we're going to ask Claude to make sure that this file this file is going is going to be git uh, git ignored, meaning, um,
  54. 05:13or I think it might already actually be git ignored.
  55. 05:16Uh, is there Yeah, there is a git ignore file.
  56. 05:18What what is a git ignore file?
  57. 05:19Actually, let me open this up, um, in text edit.
  58. 05:23Um, so git ignore file is, as the name suggests, it's just a list of either file names or file types, file extensions that should be excluded from being git
  59. 05:34tracked, and therefore they are never going to be included in your GitHub repository.
  60. 05:40And it is a very common thing for red repositories to have the this git ignore file, and for these files to also have the any all sorts of environmental
  61. 05:50files being git ignored.
  62. 05:52So, uh, what it means is that even though I have this file here, it's not really a risk, uh, for this file to be ever committed, uh, to and
  63. 06:00and like pushed to the main remote GitHub repository, okay?
  64. 06:05Uh, so that is that.
  65. 06:06So, let me open up this git this environmental local file.
  66. 06:11Also, I'm going to open this in the text editor.
  67. 06:14We can see it's the exact same thing we've just been looking at on GitHub.
  68. 06:19And so we'll need to we'll need to obtain values for both of these for both of these keys.
  69. 06:26So, next public Superbase URL and then we'll also going to need a publishable key.
  70. 06:31Now, we have seen those already.
  71. 06:35So, remember in the previous video when we have run that first database command, it gave us this response with all of these with all of these like keys or
  72. 06:45like random characters and URLs and whatnot.
  73. 06:50So, this is exactly what we are going to use.
  74. 06:52The product URL is here and the publishable key is over here.
  75. 06:57So, all I need to do to do is just go over here, copy it and the publishable key is here.
  76. 07:06And in case you have closed the terminal from the previous lesson, no worries.
  77. 07:13If you actually go back to the GitHub and you go back to the README file, there is actually there is actually a helpful helpful command over here which reminds
  78. 07:24you what to do.
  79. 07:25It's the npm run database status.
  80. 07:29So, just run this command in this folder and you should have these like like similar or exact same kind of output.
  81. 07:40Make sure your Docker Desktop application is running though, okay?
  82. 07:44So, I'm going to I'm going to save my .env.local file.
  83. 07:50And with that, I'm going to start a new terminal.
  84. 07:54I'm going to again make sure this is I'm going to copy the path to this folder.
  85. 08:01So, command option C.
  86. 08:03I'm going to go current directory here and then I'm finally going to go with the npm run dev command, okay?
  87. 08:14So let's go npm run dev.
  88. 08:17And there we have it.
  89. 08:18Uh okay, let's see.
  90. 08:21The Next.js security version available.
  91. 08:23I'm going to skip it for now.
  92. 08:25Wasn't really expecting for this to come up here in the video.
  93. 08:28Um so I'm going to skip it for now.
  94. 08:30Uh and I'm just going to go and copy this URL.
  95. 08:34By the way, on my end, it's running on the port 3001 because the 3000 was already taken by the older um version of the um of the Tonik parking
  96. 08:46spot booking application from the previous module.
  97. 08:50But if I now go and like use this URL, there it is.
  98. 08:55We have our login screen and that is an application that we have cloned from GitHub and we have set it up all by ourselves locally.
  99. 09:03Again, we could have asked Claude to do all of this for us, but we did it manually.
  100. 09:09Next time, Claude is going to be doing these things for us.
  101. 09:11We know more or less what is happening in the background.
  102. 09:15So there is an email and there is a password.
  103. 09:18Um I don't know what credentials to use, but if I go back to the README file, I can actually see there is this test account section and I can
  104. 09:28find some basic credentials.
  105. 09:29I'm going to use Alex here and I 'm going to use password 1 2 3.
  106. 09:35Seems like it's the same password for everyone.
  107. 09:38And here I am and I am uh I'm in basically.
  108. 09:43That is the same app.
  109. 09:45The difference being this is now uh running like I can when I make um when I make a reservation, this is actually going to stick like on my local
  110. 09:54database. And so with that, um you know, we are officially done setting up application locally.
  111. 10:02And in the next video, we are finally going to go back to Claude so that it can help us to at first walk through of the codebase to explain
  112. 10:12what is what. So I'll see you in the next video.

The cheat sheet is for signed-in viewers. Inside: the lesson's prompts ready to reuse, the commands and shortcuts, useful links and what to watch out for.

Sign in to get the cheat sheet

Loading the cheat sheet…