Keeping Your Data Secure: Environment Variables in NextJS / React

  Рет қаралды 28,876

Josh tried coding

Josh tried coding

Күн бұрын

Пікірлер
@codewithguillaume
@codewithguillaume 2 жыл бұрын
Hello Josh, I think that a lot of juniors make time to understand that sensitive informations are a very serious subject. Thanks for this efficient tutorial - please continue videos !
@joshtriedcoding
@joshtriedcoding 2 жыл бұрын
Cheers, they really are one of the most important beginner-concepts
@snivels
@snivels Жыл бұрын
If you want a goldmine of a video to make, it'll be how to get runtime environment variables working (not build time) with next js and docker without them ending up inside the docker image. It seems like this is a huge issue, and has been for a while with no clear solution. Love your videos!
@skyhappy
@skyhappy Жыл бұрын
What variables would only be passed in at runtime?
@snivels
@snivels Жыл бұрын
@@skyhappy think environment urls or environment secrets to be used in api routes, you'd want them at runtime when you spin up the container so that you don't have to rebuild the image for every environment, you can just promote the same image through environments. That and you don't want secrets being written into the image, like they would be at build time.
@skyhappy
@skyhappy Жыл бұрын
@@snivels do you know the solution to this
@simonedwards7101
@simonedwards7101 Жыл бұрын
Thanks for the video Josh. Being new to all this I ended up using env-cmd in the scripts of package.json to load the differences between my home office and town office. Now I just "npm run dev-ho" or "npm run dev-to". I could have just used localhost for both client and server but wanted to do something fancy and use ip addresses based on the specific locations of the offices. All a good learning exercise either way 🙂
@srinivasjoshi4693
@srinivasjoshi4693 2 жыл бұрын
Your Channel will blow up soon. Thank you for amazing content 🔥
@ThomasAlbuquerque
@ThomasAlbuquerque Жыл бұрын
I didn't know about NEXT_PUBLIC prefix in environment variables, thank you so much
@peter042
@peter042 2 жыл бұрын
These are high quality videos, keep pushing bro, and you'll get the rewards
@clickbaitpolice9792
@clickbaitpolice9792 Жыл бұрын
Josh please reply. I want to use Firebase. I’ve set up my variables but I can’t get my config file to read them. It’s all undefined. I’ve tried putting “use server” on the top of the JS file and still nothing works
@techwizard961
@techwizard961 Жыл бұрын
Same here. Have you found any solutions??
@skyhappy
@skyhappy Жыл бұрын
You should use supabase, it is a better version of firebase as it uses SQL to model your schema which makes life easier. Also the API is way better made as it's essentially a query builder which means it's similar to SQL.
@davidlintin
@davidlintin 9 ай бұрын
Make sure your .env file is at the root of your project 👍🏻
@bsimpson888
@bsimpson888 11 ай бұрын
Hello Josh, I discovered that with the introduction of the app directory (next 13 i think ) , they changed the behavior of NEXT_PUBLIC environment variables. However it seems that only the variables specified during "build" time are available but not those specified during "runtiime" (e.g. set as env for a docker image ). It would be nice if someone ( preferably you ) could explain how to pass such "deployment" specific variables to the client side, when using next 13 or 14.
@dmytro.nazaruk
@dmytro.nazaruk 5 ай бұрын
Hey! What’s the name of extension that shows the weight of bundles next to import command? 3:03
@karthikkhoday5555
@karthikkhoday5555 2 ай бұрын
I think it's called import cost
@kanodekoubillybrown3025
@kanodekoubillybrown3025 Жыл бұрын
My env variables are not available in production , why ?
@JoonatanKarhu
@JoonatanKarhu Жыл бұрын
Hi, I'm following your tutorial and my .env.local variable won't show in console.log(process.env.variableName); I'm looking for the log value by running in vs code command line: node fileName.js I get undefined as a value Please help, I have been stuck with this for a long time.
@arizona2233
@arizona2233 Жыл бұрын
adding NEXT_PUBLIC in front of the variable in .env is needed to console.log
@skyhappy
@skyhappy Жыл бұрын
​@@arizona2233isn't it also because he has to run it off the build generated by next build, as in the building phase the variables are inserted?
@manoranjands9479
@manoranjands9479 3 ай бұрын
Thanks alot for this video
@chelseamjames1
@chelseamjames1 Жыл бұрын
great explanation!
@saurabhdaswant7833
@saurabhdaswant7833 Жыл бұрын
very helpfull thanks!
@EmmanuelAgyemang-d7u
@EmmanuelAgyemang-d7u 5 ай бұрын
You are intelligent
@kacperkepinski4990
@kacperkepinski4990 Жыл бұрын
it would be better for me not to watch that
We Fixed Environment Variables
7:27
Theo - t3․gg
Рет қаралды 64 М.
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
Store & manage secrets like API keys in Python - Tech Tip Tuesdays
12:46
How to hide your API keys SAFELY when using React
24:45
Code with Ania Kubów
Рет қаралды 174 М.
Authentication Flow in Next.js (Complete Tutorial)
30:37
Cosden Solutions
Рет қаралды 34 М.
DON'T USE Environment Variables Without This
13:28
James Q Quick
Рет қаралды 22 М.
React 19 STABLE - I Can't Believe They Changed This
11:18
ByteGrad
Рет қаралды 35 М.
OpenAI Embeddings and Vector Databases Crash Course
18:41
Adrian Twarog
Рет қаралды 522 М.
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН