Would love to see a basic tutorial of how to set this up
@jimenezrosas1427
2 ай бұрын
Anyone knows if there’s already a video like this in Ras’s channel?
@hedgehogform
5 ай бұрын
Honestly I agree. Having basic like session cookies that are basically built in and easy using PHP, or a framework like express is so easy to implement compared to example nuxt 3. I spent literally 1 whole day researching and trying to implement sessions when I could just have moved my project to express backend which would have taken less time than I had to research. Sometimes a fullstack framework can be a big roadblock instead of using separate.
@syuo5051
4 ай бұрын
Additionally, the framework Django can play with the sessions.
@hedgehogform
4 ай бұрын
@@syuo5051 I have started with golang and templ and so far I love it! I use gofiber with it's sessions and I'm loving it so far! With alphine js and htmx.
@bmdavis419
5 ай бұрын
The security angle on the payments actually makes a lot of sense, still prefer CRUD in NextJs, but I can definitely see branching some of that stuff out. Great video!
@rasmic
5 ай бұрын
Thanks and I totally agree!
@matthewnicastro2489
5 ай бұрын
Good insights, what you're describing in multi/micro service architecture, a solid approach but it definitely has its draw backs. At my current job we use NextJS for our web application frontend server and we use a flask backend for our DLA / Business logic. We use k8s for deploying containers where both of our apps live. I will say it has alot draw backs if you aren't using a monorepo / same language. Honestly if you can run nextjs serverless though via vercel or aws lambdas I think this would solve alot of the problems you where talking about (in exchange for other problems of course).
@rasmic
5 ай бұрын
Essentially, yes, I 100% agree with you BUT I have severe PTSD and would rather separate import / critical logic like payments. Of course it has it's drawbacks but that's web dev for ya :)
@dylanmoore6414
5 ай бұрын
Depending where you host your nextJS application, vercel will create a separate lambda for each api endpoint you export. Sounds like the issue was that these were under the same host which had the DNS attack. The issue isnt nextjs, its how vercel deploys your resources by default.
@nazarshvets7501
5 ай бұрын
Imagine how crazy it is, that you assumed that his project is deployed on vercel. So vendor-locked and somehow people love it
@dylanmoore6414
4 ай бұрын
@@nazarshvets7501 the problem was directly related to the way a platform like vercel deploys a nextjs application. That was my comment.
@dylanmoore6414
4 ай бұрын
@@nazarshvets7501I didn’t refer to his experience as being hosted on vercel, I just made the connection that their process can lead to this same issue
@rasmic
4 ай бұрын
I did not know this, thanks for letting me know
@rafaelcorrea7959
5 ай бұрын
If you are using vercel, any api/webhook/mutation that runs, runs on a serverless function that is separate from the "mainframe". So it kinda doesn't count (let's be honest that 90% of nextjs users upload their app to vercel). But I agree with the second argument, I work with nextjs and express working through a service layer that is a separate package on a monorepo. That way you can reuse logic for websockets and such, so I recommend that way of working if you have to build more than one server.
@rasmic
4 ай бұрын
thanks for knowledge fren
@vhbatistela
5 ай бұрын
This was so cool to learn. I'm still learning more about nextjs and never thought about that DDoS possibility. Great video!
@rasmic
5 ай бұрын
Appreciate the kind words, glad you enjoyed it :)
@eestpavel
5 ай бұрын
It depends on your design. Sometimes it is easier and **cheaper** to have one monolith rather than microservices
@rasmic
5 ай бұрын
100% no doubt! Everything has trade-offs
@sakshamarora798
5 ай бұрын
You make a completely valid point in keeping the webhook server separate from Next.js. Thanks for sharing
@rasmic
5 ай бұрын
Glad it was helpful!
@Luisllaboj19
5 ай бұрын
You're one of the few creators that show real life scenarios and real life solid solutions, not like most tutorials based on a script lol. I wanted to ask if you have a preferred way to handle errors, or the best practices, in javascript, especially when using the try catch syntax Should I be creating new custom Error classes and then handling them independently in the catch block with if(error instanceof CustomError) or is it better to always return an object followind a contract with either a data property for success >>> "{data: [....]}" or error property for error >>> "{error: ....}" Or maybe you know a better and more solid way, would be really helpful, thank you
@rasmic
5 ай бұрын
Thanks for the kind words. When handling errors in a production environment I use something like Sentry. They have a great SDK with lots of features to track errors. Alternatively, you can do this in your own db, where in every catch block you pass user_id who experienced error, the error message, timestamp and other factors to help you recreate the issue. But to answer your question I always return the error object and store it somewhere (or console log it in localhost)
@Khari99
5 ай бұрын
Im moving from NextJS to phoenix because of the built in supervisor I can use to restart processes. Limits a lot of risk of things going down completely. It might not prevent DDOS but it can definitely limit the effect of DDOS crashing everything.
@rasmic
5 ай бұрын
Never heard of pheonix, will check it out
@Khari99
5 ай бұрын
@@rasmic it’s built on Elixir. I think if you really do a deep dive, you’ll love it. I didnt think I’d like it as much as I did but Elixir quickly became my favorite language because it has a lot of things built into it that change the way you build software altogether.
@eptic-c
5 ай бұрын
Or you can simply self host NextJS or deploy it on a server that hosts nodejs live servers and you can get all the benefits of a long running server. People worry about scale without even 10 uesrs.
@rasmic
4 ай бұрын
my site had 150k unique users, i had to worry about scale lol
@eptic-c
4 ай бұрын
@@rasmic how many daily users tho? 150k unique users means nothing.
@eptic-c
4 ай бұрын
and let's consider you get 15k requests a second (like 10% of users are active at each second of the day, which is a lot compared to reality) you can selfhost nextjs on 2 servers and have a load balancer in front and serve them without a problem.
@ngochunglongnguyen4523
5 ай бұрын
I would love to hear about how DDoS happened and how you handled DDoS. Keep it up!
@rasmic
5 ай бұрын
So you want to know about the time I cried? lol
@ngochunglongnguyen4523
5 ай бұрын
@@rasmic I think it would be a learning opportunity 😂 I bet you now have a strategy to deal with DDoS in the future
@rasmic
5 ай бұрын
@@ngochunglongnguyen4523 i got you haha
5 ай бұрын
This! Thanks
@RaphaelChia
5 ай бұрын
Hey appreciate the information! iirc, nextjs doesnt time you out, Vercel serverless functions does, i think!
@rasmic
5 ай бұрын
yupp, thanks for mention that
@user-ml1bl4gv6j
5 ай бұрын
Nextjs backend server is not enouph specially with mid complex projects
@rasmic
5 ай бұрын
Facts no fiction
@TheKamieniu
2 ай бұрын
Turborepo with multiple next.js apps (app, docs, api)
@rasmic
2 ай бұрын
might cook that
@breakoutgaffe4027
5 ай бұрын
How can one mitigate DDOS threats? Do you need Cloudflare or another 3rd party or can your cloud provider sort you out or what
@rasmic
5 ай бұрын
I'll do a video on this!
@pranitmane
5 ай бұрын
Appreciate the information, btw which software are you using for screen recording?
@rasmic
4 ай бұрын
Screen studio boss
@tgbtgv
5 ай бұрын
Great video! Really valuable insight!
@rasmic
5 ай бұрын
Thanks my g
@Dom-zy1qy
5 ай бұрын
Personally speaking, the way nextjs abstracts the backend is more frustrating than it is helpful. I would like to look into other frameworks, but i prefer to spend as little time as possible in javascript nowadays. Also is the nextjs endpoint timeout thing only when its deployed on vercel? Or does the framework just time out the requests ?
@rasmic
5 ай бұрын
vercel does, if the request takes too long like more than a few seconds, u get timed out... which is annoying
@lyric5615
5 ай бұрын
Nice to have influencers in this area
@rasmic
5 ай бұрын
appreciate u gang
@ogbillity
5 ай бұрын
Very insightful. Please can you make more content related to production code.
@rasmic
5 ай бұрын
will do boss
@anuragdas1978
5 ай бұрын
Could you make a video, on how to implement this architecture, that is a next js which is like a bunch of Serverless function underneath, and also a server and both are connected, say for auth. Could you teach us on how to implement that.
@rasmic
5 ай бұрын
will do fam
@rdwok14
5 ай бұрын
Was that startup just using one big monolith that went down? Sounds like you're describing microservices.
@rasmic
5 ай бұрын
Essentially yes, one giant Nextjs APP... it was a rough time lol
@gopallohar5534
5 ай бұрын
So what's the solution here go back to the old ways? What can't have a ddos attack? What are we discussing here, can anyone explain?
@rasmic
5 ай бұрын
Sometimes the old ways are the best ways!
@gopallohar5534
5 ай бұрын
@@rasmic indeed
@nazarshvets7501
5 ай бұрын
Its not a backend framework. Its backend-for-frontend framework
@ShiNoBiize
5 ай бұрын
Can you make a video explaining the right way to write client/server page.tsx? For example when writing a full server side page.tsx and then you need a button onClick function which is a client side (and all goes broken) 😅
@rasmic
5 ай бұрын
will do boss
@marloeleven
5 ай бұрын
nice idea, thanks!
@gabrielbianchi2246
5 ай бұрын
Yeah, so you’re saying that stuff like payments are being done on a separate server because you got ddosed, but that other server could also get ddosed as well?
@rasmic
5 ай бұрын
How? Only I know the server url
@ZinoTrustAcademy
5 ай бұрын
@@rasmicBro, anyone with a little cs knowledge can get all your API URL. That's why you still need to add rate limit to your apis.
@rasmic
5 ай бұрын
@@ZinoTrustAcademy my NextJS app doesn’t fire anything to my server Only stripe does… i fail to see how
@irfansaeedkhan7242
5 ай бұрын
agree, even when you work with web sockets it cuase issues becaquse web scoket want to run 24/7
@rasmic
5 ай бұрын
There's a serverless service called pusher, I used it for a big company I did contract work for one time... nothing beats a server imo
@nazarshvets7501
5 ай бұрын
@@rasmic I refuse to belive there is serverless "websocket". It sounds silly. How do you even keep connection with that kind of architecture
@Daddyjs
5 ай бұрын
How could someone make a payment when your next js server was down. Wouldnt the front end be down also?
5 ай бұрын
I also have this question 😵💫
@Daddyjs
5 ай бұрын
@ lmfao
5 ай бұрын
Oh, ok, now I get it. It was a web3 project and it accepted payments through crypto. That's why nobody was using his website at that time but he kept receiving payments
@rasmic
5 ай бұрын
I should given more context, it was a web3 startup... so we did crypto payments which works differently
@surendarkun
5 ай бұрын
How the nextjs app not connected with ur other server? When you make payments, the nextjs frontend will send an api request to your other server?
@rasmic
5 ай бұрын
Nextjs fires payment to stripe, stripe fires webhook to server, server makes change to DB. Nextjs reads from db No direct connection or communication between nextjs and server
@ytsharmahandle
5 ай бұрын
If your site when down, how were users still making payments?
@rasmic
4 ай бұрын
it was a web3 startup so we did crypto payments
@amhajiTV
5 ай бұрын
Great video!
@rasmic
5 ай бұрын
Glad you enjoyed my fren
@chisomprince_tech
5 ай бұрын
You can host your nextjs app as monolithic
@rasmic
4 ай бұрын
true
@markjones6894
5 ай бұрын
Question from someone who still new to everything that is web development. If, for the sake of the example, I decide to have a separate server only dedicated to payments. How would the hosting be structured ? The nextJS app and the backend server shouldn't be deployed on the same instance ? In terms of costs, i have to rent out two VPS's or are there any other solutions ? Thank you !
@rasmic
5 ай бұрын
I host my nextjs app on vercel since their free tier is generous and I'll host the server on something like zeabur or railway
@markjones6894
5 ай бұрын
@@rasmic I see! But why not host everything on zeabur or railway, instead of relying on Vercel ?
@rasmic
5 ай бұрын
@@markjones6894 I built my server using Elysia and Bun... Zeabur's support and setup was so simple
@lyric5615
5 ай бұрын
Boy you habesha 🎉
@rasmic
5 ай бұрын
selam new??
@abhinasregmi9742
5 ай бұрын
So if the whole app is down how will users make payment ?? Like If i have a ecommerce store and the store is down then users wont be able to make payment. What am i missing here? Does the problem occur in subscription based approaches ?
@rasmic
5 ай бұрын
It was a web3 startup, so even though the site was down people could still send payments (due to the nature of crypto) and we had lots of payments unaccounted for! It was a nightmare lol
@pranavbobde2529
5 ай бұрын
same doubt @rasmic shuda mentioned it🫠
@breakoutgaffe4027
5 ай бұрын
Damn
@Tanner-cz4bd
5 ай бұрын
need a tutorial
@lodosdurak7913
5 ай бұрын
Would you also have this problem in a MERN stack?
@rasmic
5 ай бұрын
not really
@nazarshvets7501
5 ай бұрын
ERN in MERN is practily Nextjs(express + react + node). So, if you would serve your react app from same server that is handling payments, you would have the same problem
@saiphaneeshk.h.5482
5 ай бұрын
Isn't it going kinda against microservices?
@rasmic
4 ай бұрын
huh?
@ishakimanuel3513
Ай бұрын
Nextjs is a fullstack framework
@rasmic
Ай бұрын
ye we know
@edunomatseye7262
5 ай бұрын
I think its total bullshit, you were ddos and all services were down but yet people were making payment and you couldn't register receipt of those payment. i think what you want here is a monerepo deployment architecture design
@rasmic
5 ай бұрын
It was a web3 startup, so people could make payments as long as they had the payment address (wallet address) So site was down but there were 1000+ people who had already initiated a payment and had the address
@nazarshvets7501
5 ай бұрын
do you familliar with concept of subscription based pay? Or how people can spend an hour filling payment form?
Пікірлер: 109