Hide API Keys with a Node.js API Proxy + Caching, Rate Limiting and Slow Downs

  Рет қаралды 103,379

Coding Garden

Coding Garden

Күн бұрын

This is an excerpt from a stream that was broadcasted live on twitch: / codinggarden
View the full live stream here: • 🗣💬 | CODING Q&A | What...
View the code here: github.com/CodingGarden/mars-...
💪 View all past episodes here: • Code Wars Code Katas
🔎 Search past kata solutions here: code-katas.now.sh/
💖 Donate: coding.garden/donate
😍 Pledge: coding.garden/pledge
💬 Discord: coding.garden/discord
🎉 Stickers: coding.garden/stickers
💻 Gear List: coding.garden/gear
🔎 Search for more Coding Garden videos here: coding.garden/videos
🗣 View the Coding Garden FAQ here: github.com/CodingGardenCommun...

Пікірлер: 128
@jdhage89
@jdhage89 4 жыл бұрын
Without KZfaq I would have never found out about you and what you do. I'm going to tune into your Twitch in the future, but these videos available on KZfaq have been invaluable to me, and I really appreciate your taking the time to cultivate this coding garden!
@Jaykmrch
@Jaykmrch 3 жыл бұрын
I learnt how to do all this myself and was always nervous that the things I was doing were not best practices and wrong. I feel validated that I was using best practices now lol. Thank you so much.
@rautanenolavi
@rautanenolavi 3 жыл бұрын
Hey! Happy to find your content as this was closely related to a topic I was struggling to tackle. You earned yourself a new fan!
@not-yourbusiness
@not-yourbusiness 4 жыл бұрын
We support you as well! I'm loving your content and your personality from France !
@benhakliyim6405
@benhakliyim6405 4 жыл бұрын
I was looking for this for almost a month. Finally got a decent answer
@weslleyhenriquecavalcante2607
@weslleyhenriquecavalcante2607 3 жыл бұрын
I learned about backend and sec with this video more than in my whole life. Thanks, CJ for that loveable content.
@pikolino210
@pikolino210 3 жыл бұрын
Wow bro Im a programming beginner and usually pretty slow too, and even though I clicked on this video without even knowing what exactly it is about, I must say I understood everything super clear! You're awesome, thank you!
@tomigmelo
@tomigmelo 3 жыл бұрын
Very informative video. Quick and easy. Keep up the good work!
@TomCupis
@TomCupis 4 жыл бұрын
Hope you keep making these youtube highlights! I've recently discovered your channel on yt and its great! Might even go visit your twitch ;P
@codewithkawagari6377
@codewithkawagari6377 2 жыл бұрын
i don't know what to say but this one really helps me a lot! Love you so much!
@eunito9447
@eunito9447 3 жыл бұрын
Man! You are such a great tutor! Congrats!!!!
@sivaganesh4489
@sivaganesh4489 4 жыл бұрын
wow what a content really appreciating. Thank you dude
@rahulsolankib
@rahulsolankib Жыл бұрын
Loved it, these are rare, precious practical knowledge
@MaZyYTube
@MaZyYTube 3 жыл бұрын
I learn from you so much. Thats insane.
@dislexicllama
@dislexicllama 4 жыл бұрын
Keep making these youtube highlights! I won't be able to watch your Twitch stream, so if you didn't make these videos I'd be missing out on all the good stuff! Keep it up :)
@isurumaldeniya9536
@isurumaldeniya9536 3 жыл бұрын
Quality content. Learn new things. Thanks ❤
@davidhernandeze
@davidhernandeze 4 жыл бұрын
you help me a lot since I'm starting with node js
@tanwanimohit
@tanwanimohit 4 жыл бұрын
Love your explanation❤
@johnyepthomi892
@johnyepthomi892 2 жыл бұрын
Awesome upload as always
@martinmj94
@martinmj94 2 жыл бұрын
Got a ton of value from this video. Just leaving a comment in appreciation.
@rajshrishrimal2653
@rajshrishrimal2653 4 жыл бұрын
Superb video CJ !!! 😎
@asfandsiddique7434
@asfandsiddique7434 2 жыл бұрын
Your videos are great, keep posting content like this
@scipakos
@scipakos 3 жыл бұрын
Super video. Thanks!!
@sams6454
@sams6454 4 жыл бұрын
This is seriously impressive
@baekdusan815
@baekdusan815 3 жыл бұрын
I keep watching your videos bc you are fun and nice to watch 🤗🤗🤗🤗🤗☺️❤️
@ceralguy85
@ceralguy85 4 жыл бұрын
CJ great video this is one of the best tech channels. Have you ever try to apply clean architecture to a project. I would be great to see you how to structure a project.
@rithwiksm
@rithwiksm 4 жыл бұрын
CJ's content is amazing 🤩
@rabbyhossain6150
@rabbyhossain6150 4 жыл бұрын
Incredible work.
@timojedai6576
@timojedai6576 3 жыл бұрын
Dope content 🙌🏽
@ivanknezovic8451
@ivanknezovic8451 3 жыл бұрын
Great videos mate, keep it up! "I have to change my port" :D
@Chaaos2
@Chaaos2 3 жыл бұрын
This was an amazing video! Freaking Randy!
@MrChickenpoulet
@MrChickenpoulet 4 жыл бұрын
hey really cool vid ! hope you'll keep making some !
@abdallahmohamed4591
@abdallahmohamed4591 4 жыл бұрын
wonderful content bro, but i've curios to know what is the keyboard that you r using ???
@restuwahyusaputra7764
@restuwahyusaputra7764 3 жыл бұрын
Great content thanks
@truongnguyenvan9050
@truongnguyenvan9050 3 жыл бұрын
Great videos. thanks you so much
@esiokao1932
@esiokao1932 2 жыл бұрын
Much appreciated !
@joelbrandao4
@joelbrandao4 3 жыл бұрын
This is gold content!
@gonzalo8642
@gonzalo8642 4 жыл бұрын
What plug in did you use to display the comment with the date at 18:22
@Tszyu01
@Tszyu01 3 жыл бұрын
Another option to consider for the proxy portion of this code is express-http-proxy which will effectively and easily forward/proxy requests to specified path including headers, params, body and similar as a simple middleware. It has plenty of configuration options to rewrite the path or perform actions before/after proxying. There is nothing wrong with axios, but the effort can be simplified using a library like that.
@octofox9098
@octofox9098 4 жыл бұрын
great content - ty!!!!
@domthefounder
@domthefounder 3 ай бұрын
Thanks!
@osherezra8460
@osherezra8460 4 жыл бұрын
Awesome Video bro keep it up like always, could you share the link to the express scaffold library?
@chriswhincop7944
@chriswhincop7944 3 жыл бұрын
Thanks, CJ! :)
@AliParlakci
@AliParlakci 4 жыл бұрын
That's some great tutorial there
@rajitha1911
@rajitha1911 3 жыл бұрын
Thank you
@Canon22211
@Canon22211 4 жыл бұрын
Cool! Thank you.
@tiagocastro6302
@tiagocastro6302 3 жыл бұрын
Very good video, but if the attacker changes his IP in every request?
@indrakhatiwada9860
@indrakhatiwada9860 4 жыл бұрын
have a great vacation CJ
@ginoescobar8131
@ginoescobar8131 3 жыл бұрын
thanks
@josefreitas6997
@josefreitas6997 2 жыл бұрын
Hey! If you wanted to make a post request using express and axios like you used in this video how would it be? I've been scratching my head trying to find a solution!
@leventc777
@leventc777 3 жыл бұрын
Thank u so much, regards
@groovebird812
@groovebird812 4 жыл бұрын
Hi, you are great. Yesterday i built a little app which exactly the same problem and i did it like in the video, but you show much more useful things. Thank you :-) It was amazing if you could make a video like this to the following topic: how can our own api more secure? (api key? authentication? json web token? I don't know :-))
@howardh6857
@howardh6857 3 жыл бұрын
you can limit the website CORS or ip/domain restriction i.e. use a api gateway or use ssl 2way ssl. when you register a key tie it to a domain name
@sahllsaharn4664
@sahllsaharn4664 Жыл бұрын
Question : i want that only my frontend should connect with backend api and if i create a proxy so that user can still take it and make request and do with the data
@arghyamitra3281
@arghyamitra3281 4 жыл бұрын
Can we store the keys on Aws secret manager ?
@jamieguthrie1760
@jamieguthrie1760 3 жыл бұрын
Randy with the bits!
@bsen2267
@bsen2267 3 жыл бұрын
You so awesome maaaaan!!
@VikasSharma-io5ip
@VikasSharma-io5ip 3 жыл бұрын
For a time being if i consider only cache, and not rate limiter and slowdown, to store responses, does that mean for every request i am storing data in cache. Wouldn't that lead to high memory usage? Still video helped.Thanks
@ashutoshpanda4336
@ashutoshpanda4336 4 жыл бұрын
So in angular I've left some firebase config in environments folder, so the environment folder is also exposed to client or what kindly let me....
@miunify
@miunify 4 жыл бұрын
This is so fcking awesome
@rogercolque
@rogercolque 3 жыл бұрын
Nice topic man. What u recommend me if my api endpoind had many requests , For example for in mobile app like a delivery app that its necesary use api for *maps routes and others* _that consumes money and by increasing requests _ . In mobile app configuration its my problem This video applies to this issue? its possible to use an new way security *this* using some hack int server (Backend) side. Thanks
@AnthonyJackman
@AnthonyJackman Жыл бұрын
What coding break timer are you using in this video?? I did notice that you are on an Apple device, but I should be able to find a windows export of this same one.
@CodingGarden
@CodingGarden Жыл бұрын
github.com/CodingGarden/faqs/#what-is-that-break-reminder-that-keeps-popping-up
@letmecommentalready
@letmecommentalready 3 жыл бұрын
Hey not sure if you’ll see this but have you ever gone over something like this but with 0auth? It’s a tricky subject for me
@joshstout
@joshstout 4 жыл бұрын
Actual modern and quality accurate content fam! you get my sub
@rileyboyd
@rileyboyd 2 жыл бұрын
If the NASA API required a JWT token, where would you store it in NodeJS? I'm new to Node, trying to figure out where a token would be stored in a proxy API set up like this. Also great video, thank you!
@jeffersonestevam5960
@jeffersonestevam5960 3 жыл бұрын
What is your VS Code Theme?
@tysonvega
@tysonvega 3 жыл бұрын
hiii there so i need your help trying to start a node js server on shared hosting..but it isn't working what could be the problem
@Mohammed-vl8sj
@Mohammed-vl8sj 4 жыл бұрын
How did you create the express setup from the command line..?
@mayorityz
@mayorityz 4 жыл бұрын
there is a package that when installed, sets it all up. kinda like Laravel. I think it is Node-Expres..
@gillfromamritsar
@gillfromamritsar 4 жыл бұрын
what are those bits means ?
@goowik3862
@goowik3862 3 жыл бұрын
What is that "take a break" app?
@sheldonfourie5959
@sheldonfourie5959 4 жыл бұрын
Amazing
@javohir307
@javohir307 3 жыл бұрын
Hi, could you tell me what is specs of your current macbook ?
@CodingGarden
@CodingGarden 3 жыл бұрын
This is the MacBook I have: everymac.com/systems/apple/macbook_pro/specs/macbook-pro-core-i7-2.5-15-dual-graphics-mid-2015-retina-display-specs.html
@introduction
@introduction 3 жыл бұрын
Hey, I need help. I am curious, how can I go about logging each request made with api, so I can know the total amount of request being made to my api and store it somewhere?
@tomigmelo
@tomigmelo 3 жыл бұрын
Commenting because I wanna know too
@introduction
@introduction 3 жыл бұрын
@@tomigmelo I was able to do it on my own slightly, I used mongodb, but I'll rather know how he'll go about it.
@OfficialGOD_YT
@OfficialGOD_YT 3 жыл бұрын
@@introduction he'll also do the same
@yangj6941
@yangj6941 4 жыл бұрын
how did you create the express generator?
@ParthVadhadiya
@ParthVadhadiya 4 жыл бұрын
Same q
@manologarciadev
@manologarciadev 4 жыл бұрын
Nice !
@diegoazpeitia5708
@diegoazpeitia5708 4 жыл бұрын
God content!
@dawid_dahl
@dawid_dahl 3 жыл бұрын
What is time?
@yorrickbakker3533
@yorrickbakker3533 4 жыл бұрын
How are you saving dependencies to package.json without --save? Do you have an alias set up?
@SpectralVFX
@SpectralVFX 4 жыл бұрын
npm install command saves dependencies by default ;)
@yorrickbakker3533
@yorrickbakker3533 4 жыл бұрын
Júlio Michél Guadagnim wow, I never knew that. Sick, saves me like 6 keystrokes
@rastabong420
@rastabong420 4 жыл бұрын
10:01 more bits
@Mutlaq777
@Mutlaq777 4 жыл бұрын
🌱
@rickyu1978
@rickyu1978 3 жыл бұрын
Put your api behind a CDN, and enable hotlink protection or url singing.. or you a API gateway to control all these.
@georgep6553
@georgep6553 3 жыл бұрын
You can encrypt the data so that only you can decrypt it. The decryption is the "authentication". CORS is another option.
@cjliu4657
@cjliu4657 2 жыл бұрын
what vscode theme?
@earthycoin
@earthycoin 2 жыл бұрын
Nice
@menjil
@menjil 4 жыл бұрын
can you share your VS Code theme? :)
@derekacosta9840
@derekacosta9840 4 жыл бұрын
he uses marketplace.visualstudio.com/items?itemName=nur.just-black, he's addressed that before
@lastmaj
@lastmaj 4 жыл бұрын
please keep doing youtube highlights ^^ thanks
@tautologicalnickname
@tautologicalnickname 4 жыл бұрын
whats ur colorscheme please?
@hughhe4209
@hughhe4209 4 жыл бұрын
Just Black
@EhSUN37
@EhSUN37 2 жыл бұрын
while(true){fetch(url)} and your servers CPU will still be under huge load which is the only thing that matters for ddos attack. your app still needs to check the ip address and the sender is not waiting for response so the speed limit is irrelevant and the CPU is still working with the express-rate-limit library. this is my theory and i dont see why in a hypothetical scenario with lets say a billion request per millisecond your app would survive. you can run that while loop with 100 virtual machines around the world simultaneously .
@ragilburhanudinpamungkas9571
@ragilburhanudinpamungkas9571 3 жыл бұрын
wow. its a great explanation, woukd you like to exolain error middleware handler in your project. thank you.
@fxstreamer238
@fxstreamer238 2 жыл бұрын
why dont you just use feth()?
@caienleiful
@caienleiful 3 жыл бұрын
👍
@DanielSantanaBjj
@DanielSantanaBjj 3 жыл бұрын
Please move from Express.js to Fastify and enjoy faster code with little to no changes in your codebase.
@surendravadaparthy2224
@surendravadaparthy2224 4 жыл бұрын
What's the theme he is using for vscode ??? Anyone
@hb2998
@hb2998 4 жыл бұрын
He has a video where he setups up his mac. Its not a simple theme, but lots of different configs and extensions. His instructions are clear and he has most of what you need to type on github so you can just copy and paste his settings, etc.
@CodingGarden
@CodingGarden 4 жыл бұрын
See my vscode settings here: github.com/CodingGarden/vscode-settings#themescolor
@EhSUN37
@EhSUN37 2 жыл бұрын
why dont you just use built-in fetch and always use third party lib to make api requsts? i never understood why
@waves-coder
@waves-coder 3 жыл бұрын
Eaat or west coding garden is best
@thomasersosi4595
@thomasersosi4595 4 жыл бұрын
About the caching, better store and update the promise in the cache in a synchronous way and then await the cached promise. In your current code, if for any reason, the calls to the nasa api take longer to resolve, let's say 10 seconds, then during these 10 seconds, your cache will fail and you will simply forward every single call to the nasa api. So if there's trafic on your api too, you could expire your rate on the nasa api before the cache kicks back in (for 30 seconds, before it may fail you again). if (!cachedPromise || Date.now() - 30000 >= cachedTime) { const params = ...; cachedPromise = axios(`${BASE_URL}${params}`); cachedTime = Date.now(); } ... const { data } = await cachedPromise;
@jjfattz
@jjfattz 4 жыл бұрын
Are you no longer live streaming on YT?
@jferris
@jferris 4 жыл бұрын
CJ is trying to get partnered on Twitch and so he now only streams there. VODS and edited videos like this will continue to be posted here though.
@pranjalagnihotri6072
@pranjalagnihotri6072 4 жыл бұрын
He streams on Twitch now. But there is a special stream coming on KZfaq soon
@rsbah
@rsbah Жыл бұрын
Goddamnit Randy 😂
@jamesnelson174
@jamesnelson174 4 жыл бұрын
Hello I love you work. Please develop a twitter clone with react node js. Love u.
@mayorityz
@mayorityz 4 жыл бұрын
he has ... kzfaq.info/get/bejne/gNR1e5ylvrLcfJ8.html
@themoon51
@themoon51 4 жыл бұрын
can someone explain the minus 30 seconds with cache thing? i understand the concept to make sure user has to wait 30 sec before next request but for some reason i still cant wrap my head around this lol
@TheRomane71193
@TheRomane71193 4 жыл бұрын
Its the current time minus 30 seconds... if thats not greater(further in the future) then the cached time (time the first API request was made) then just show the same data
SPEED RUN: Build a CRUD API with Node.js + Express + MongoDB
22:05
Coding Garden
Рет қаралды 113 М.
How To Hide API Keys Using Netlify
56:55
Dan Fletcher
Рет қаралды 17 М.
OMG😳 #tiktok #shorts #potapova_blog
00:58
Potapova_blog
Рет қаралды 4,3 МЛН
🌊Насколько Глубокий Океан ? #shorts
00:42
THE POLICE TAKES ME! feat @PANDAGIRLOFFICIAL #shorts
00:31
PANDA BOI
Рет қаралды 23 МЛН
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
Рет қаралды 46 МЛН
Build an API Proxy Server - Hide Your API Keys, Rate Limiting & Caching
32:20
Node.js is a serious thing now… (2023)
8:18
Code With Ryan
Рет қаралды 631 М.
Everything I Learned Trying Laravel / PHP
19:37
Coding Garden
Рет қаралды 9 М.
tRPC, gRPC, GraphQL or REST: when to use what?
10:46
Software Developer Diaries
Рет қаралды 72 М.
React Proxy | Easiest Fix to CORS Errors
15:52
Sam Meech-Ward
Рет қаралды 80 М.
Cache Systems Every Developer Should Know
5:48
ByteByteGo
Рет қаралды 455 М.
Build A Restful Api With Node.js Express & MongoDB | Rest Api Tutorial
53:55
The End Of Node.js? My Honest Thoughts
19:33
Mehul - Codedamn
Рет қаралды 64 М.
Что не так с яблоком Apple? #apple #macbook
0:38
Не шарю!
Рет қаралды 475 М.
Неразрушаемый смартфон
1:00
Status
Рет қаралды 2,3 МЛН