These are my favorite types of videos. I love hearing the design decisions and justifications on why someone picked something. Great job Cody
@SeibertSwirl3 күн бұрын
Some of the main things that will cost you money… is a wife lol it’s me, hi, I’m the problem it’s me. Lol love you babe! You’re doing a great job
@kazmi4012 күн бұрын
He’s switching to Golang to save costs, but still keeping the premium Wife plan. Must be worth every penny!
@al30303 күн бұрын
Great video. Nice to see you come back to GO. It’s very efficient for such backend work.
@yassinesafraoui2 күн бұрын
It's important to note that you have to make sure ressources have unique ids because there is no way to invalidate cloudflare cache afaik
@xoutaku76003 күн бұрын
set your proxy so it only only accepts requests through the cloudflare cdn , either directly in the proxy code or through the server firewall if the cdn has a static dns entry you can take advantage of
@WebDevCody2 күн бұрын
I could probably just setup a firewall on the docker image itself
@beemkhan3 күн бұрын
I've watched a lot of your content, this is exactly what i expect a good engineer to share, youve looked at tech with your own initiative and shared the knowledge with everyone. Very much appreciated. Thank you
@alessioragonesi85493 күн бұрын
To avoid ddos on the go proxy you can block direct ip access over http to your server. I remember it being an option for a wordpress website with cloudflare so there has to be a way to do it outsided of wordpress too.
@WebDevCody3 күн бұрын
@@alessioragonesi8549 I think I could only allow cloudflare ip address as well
@joeyywill12343 күн бұрын
so what is the go proxy actually doing?
@WebDevCody3 күн бұрын
I’m not sure
@ali2kan3 күн бұрын
from my understanding from the video, wasn't he using the proxy to route client requests to the db?
@sama74963 күн бұрын
same here i didn't get it too
@the-engineer-r4j3 күн бұрын
The proxy is just being used as a way to request files from the DB without having direct frontend => DB requests
@mohamedElbadwi-k5f3 күн бұрын
I think just to save bandwidth streaming those videos with js is expensive
@vhhhus3 күн бұрын
good job mate, love it
@damonguzman2 күн бұрын
This is peak, “I built because I could not because I should.”
@WebDevCody2 күн бұрын
Isn’t it fun?!
@agb25572 күн бұрын
Thanks for you videos! It would be great so know how you organise your various services and any config in github repos. Is this a monorepo?
@eip4082 күн бұрын
noice good to see you back using go hahaha
@dheerajs28383 күн бұрын
this is great.. I always wonder about this... fantastic.. do you have a video on how to deploy such setup?
@aaronstanton12593 күн бұрын
6:23 "yoo-id" 💀
@WebDevCody2 күн бұрын
yoooooouuuuuuu-id
@briangugi3 күн бұрын
Imagine cody as your Project Manager.
@hhwjsw7113 күн бұрын
From now on, I am a Cody disciple
@shahzaibshahzaibkhan64802 күн бұрын
Are you using the UI with a docker image? In my experience, if you dockerize your next app, it brings down the memory usage to somewhere around 80-120MBs atleast in my case, thought it would be usefull
@WebDevCody2 күн бұрын
Yes I am
@shahzaibshahzaibkhan64802 күн бұрын
@@WebDevCody the node:alpine image or the other one? The alpine one is the one that I used
@notgiorgi2 күн бұрын
When hosting nextjs on Railway, does it basically just run on a long-running express server?
@WebDevCody2 күн бұрын
yes, it's a stateful container
@Steel00793 күн бұрын
Hi, why didn't you use something like nginx? Is it because you are using convex?
@WebDevCody3 күн бұрын
I need to hit an endpoint to convert an id. I don’t think nginx can run logic? I can also potentially add auth checks in the proxy if I want
@abhishekmehandiratta42412 күн бұрын
Why not just have cloudflare cdn in front of convex static asset urls?
@WebDevCody2 күн бұрын
because I wasn't sure if someone would be able to figure out my convex project id via websocket events and then by pass cloudflare directly to hit my convex.cloud url directly. that did cross my mind, convex has the ability to setup custom domains, so technically I could just point cloudflare to convex via a domain, I just went with this approach first and didn't think too hard about it.
@y.m.o61712 күн бұрын
Hi Cody. I think you could do better by not reading all the file content in one shot. I see that you are using ReadAll. There are maybe better ways to stream that with i think a tee in go. cant remember what is called but it allows you to tie one buffer and reader and let the magic happen. I will look it up and see if i can find it
@y.m.o61712 күн бұрын
kzbin.info/www/bejne/bquZoJ55nMmFe9E this is a great talk about many details in how to build a proxy in go. so io.Copy should do what you want. if you need to do more processing `io.TeeReader` will do what you want if you need more complicated logic
@raideez3 күн бұрын
So next.js wasn't just able to handle ur requests without consuming lots of bandwidth? So you added go backend to do the video requesting? For heavy loads its always recommended to have seperate backend.
@WebDevCody2 күн бұрын
I'm not too sure what was going on. There was two things I needed to debug. Was it the tunnel causing issues, was it next.js, or was it my javascript implementation. Overall I decided to instead just use a simple go proxy since I knew it would use little memory and run fast.
@codingislove37073 күн бұрын
Always feels wrong to press like if the like count is 69... but great information as always.
@WebDevCody3 күн бұрын
You dirty dog you
@guyhazut94593 күн бұрын
where can you learn this stuff?
@aymenbachiri-yh2hd2 күн бұрын
❤❤
@sid45793 күн бұрын
bro can't make his mind
@Alex-bc3xe2 күн бұрын
Yes he s all around once he says one thing than he contradicts himself so often can’t trust him for sure
@Tekapeel2 күн бұрын
@@Alex-bc3xe Because smart people are always learning and when confronted with something that challenges their current conception are not only willing but happy to change their mind and embrace new information if it benefits them, their project or their users. And yes, if you can't read between the lines, I am suggesting that you two might not be smart people.
@WebDevCody2 күн бұрын
what's there to trust? I said in my previous videos Go is good solution for an api; I'm using it for an api proxy.
@davidsiewert86493 күн бұрын
Has somebody already found out the ip of the go proxy?
@WebDevCody3 күн бұрын
@@davidsiewert8649 127.0.0.1
@saurabh94463 күн бұрын
You're calling go proxy instead of cloudflare and getting files from cloudflare for a hit, how? Shouldn't u make request to the cloudflare?
@WebDevCody3 күн бұрын
The diagram shows ui makes a request to cloudflare, cloudflare hits proxy, proxy hits File storage
@adrian1102882 күн бұрын
@@WebDevCody How do you tell cloudflare to go to the proxy? I am new to this
@WebDevCodyКүн бұрын
@@adrian110288 cloudflare is also a proxy, so it’ll route requests using a cname record
@SeibertSwirl3 күн бұрын
First!
@joeyywill12343 күн бұрын
SECOND!
@sergeyagronov9650Күн бұрын
basically free .... until they decide to shutdown your app 🤣🤣🤣
@WebDevCodyКүн бұрын
live on the edge
@CarlosDuque-e3jКүн бұрын
Hi Cody, I was wondering why do you need the proxy. Is it because you can't send a request directly from cloudflare to convex? Also, pretty cool video. I really like seeing this kind of system design videos that are not only explain the parts of the system but rather contextualize in a real project how they work.
@WebDevCodyКүн бұрын
I think the issue is that if someone knows my convex project id, they could potentially hit my convex http endpoint directly to download files and bypass cloudflare which would mean a larger bandwidth charge. I wasn’t sure if that project id was exposed anywhere in when someone loads up the convex client and starts sending web socket events. Basically I abstracted convex away from the user entirely in regards to files to keep all that hidden. Nothing can download files from convex except my go proxy. Maybe it’s over engineering, but I don’t want a silly ddos from a yt hater to run up my bill.
@CarlosDuque-e3jКүн бұрын
@@WebDevCody That makes sense, thanks for explaning that. It's sad you gotta worry about that stuff because of haters but I guess it makes you think more about security, which makes your project more "professional" if you will.
@crustydev55612 күн бұрын
Doesn’t cloudflare frown on using the cdn for videos?
@WebDevCody2 күн бұрын
I can’t find where they say that
@jimbin93Күн бұрын
@@WebDevCody They emphasize multiple times that you shouldn’t serve most of your video cache. Content like HTML, JS, and CSS is acceptable, but for videos, they recommend using Cloudflare Streaming. You can find more information in Cloudflare's Terms of Service and forums. That’s my two cents!
@Oldbettie3 күн бұрын
Actually was load testing railway the other day it seems to not like sending images or videos from next apps i was getting horrid performance. This seems like a decent solution
@WebDevCody3 күн бұрын
@@Oldbettie yeah idk why, something is fishy about it. Were you using a tunnel?
@pedrofrazaopacheco2 күн бұрын
Hey Cody I am not 100% sure about this but a while ago I saw an article that you can’t cache user generated assets on cloud flare and you need to use their service R2. I don’t know if this applies in your case but just to let you know that it can be against their terms of service
@WebDevCody2 күн бұрын
I'd be curious if you can find that article. Claude AI is saying caching dynamic or user generated content is allowed as along is it isn't illegal or copy written assets. The article needs to link directly to the cloudflare terms of service or else it's just hearsay imo, but it's always good to double check these things.
@pedrofrazaopacheco2 күн бұрын
@@WebDevCodyok i think my comment was deleted because i added a link but basically this is from their website Unless you are an Enterprise customer, Cloudflare offers specific Paid Services (e.g., the Developer Platform, Images, and Stream) that you must use in order to serve video and other large files via the CDN
@nchomey2 күн бұрын
It's in their terms of service. Html only in the cache, unless you use a paid service (like r2). Yet, html isn't cached by default and scripts (and I think images) are...