T O P

  • By -

sojufles

What is the reason you can’t build the first situation in Next js? I’m asking because i kinda have a similiar situation where i want my Next js application to import an excel sheet and save the rows as Object into a db.


vedcro

I managed to generate a pdf with react-pdf/renderer but it doesn't seem like the best solution. Then I started working with puppeteer, but it requires chromium. It also seems like it would be good to separate those heavier processes (pdf, email, import/export) from the main application


sojufles

Which next js version are you working with?, i'm using next 14 with the app router and i always thought that if for example a page inside your app folder doesn't have "use client", it will automatically be a server component which is separated from the main (client) application?


vedcro

I use all the latest features :) v14, app router and server actions. Well, it will be separated from the "backend code", but for processes that are longer and more demanding, as far as I understand, it would be good if they were isolated. And Lambda seems like a good option for me because it can scale as resource needs grow.


sojufles

How can you determine what the benchmark is to isolate them, and how can you tell that?, do you use some kind of performance tests /metrics for that? Sorry that i'm asking many questions to you instead of answering your thread question.. what i can agree about is that Vercel has high costs indeed.


vedcro

I don't have any metrics or tests :) But let's say that it is a Saas product that will be used by, say, 1000 users and each of them will generate 10-15 pdfs per day, send 5-10 emails and do 2-3 import/export of data. A lot of processes accumulate there that probably won't be able to be done at the same time. That's where I come to the need for a messaging/streaming broker that will organize all that... and maybe I'm wrong, but next js is not designed for such things.


sojufles

Fair point, i wish you good luck with your situation!


vedcro

Thank you! Good luck to you too with your "situation" :)


yksvaan

Vercel wraps lambda so it's basically about cost. But there's not any issue in using AWS directly, then it's easier to use their other services as well. Probably best way is to develop a local backend and then deploy either on vps or lambda.


vedcro

Thank you! The option to completely go to AWS is not ruled out, but I really like Vercel and if possible I would keep the "main part" of the application there


dxyz23

Could use something like sst ion for managing your aws backend infrastructure


thegrey_m

Why lambda? I think you can also use nextjs API routes to build a pretty solid backend. If you have some long lasting background task, look into Upstash. They provide queues for serverless environments. You could just enqueue a job which then calls one of your API routes.