What should I choose (backend architecture) for my web app
Unanswered
Southern rough shrimp posted this in #help-forum
Southern rough shrimpOP
Hello!
My web app consists in showing the user's game data like a dashboard (and refresh data in real time), sending virtual money between them. They could edit their account data.
I saw there are many backend architecture in web (monolithic, microservices) but in Next.js, there are backend API and Server Component.
My question is what should I use and why ? I'm having trouble understanding what to use, because before, we didn't hear much about backend APIs/microservices.
My web app consists in showing the user's game data like a dashboard (and refresh data in real time), sending virtual money between them. They could edit their account data.
I saw there are many backend architecture in web (monolithic, microservices) but in Next.js, there are backend API and Server Component.
My question is what should I use and why ? I'm having trouble understanding what to use, because before, we didn't hear much about backend APIs/microservices.
20 Replies
Dunker
@Southern rough shrimp Hi, if you know another language or even typescript use T3 stack with TS or use totally different languages
Monolithic or microservices things are not related with next.js or sth. Those can apply for all languages and backends
Start with monolith, as you grow migrate to microservices i don't think you need that scale for now
@Dunker Monolithic or microservices things are not related with next.js or sth. Those can apply for all languages and backends
Southern rough shrimpOP
Sure but Nextjs allows us to make microservices app with api or "monolithic" with server components, no ?
@Southern rough shrimp Sure but Nextjs allows us to make microservices app with api or "monolithic" with server components, no ?
Dunker
no that terms totally belong for backend, not related with next or api dir
your next.js app will be still monolithic
microservices means every unit can run itself like "client and server" folders
as i said microservices is not a thing you can implement in one day, there is a migration process from monolith to that
dont care architecture for now, just build app if you see it a lot complex for being monolith, then you can think to make it microservices
@Dunker your next.js app will be still monolithic
Southern rough shrimpOP
Yes but what is the difference between write backend code in server components or write in api and call api on frontend?
@Southern rough shrimp Yes but what is the difference between write backend code in server components or write in api and call api on frontend?
Dunker
server components are still frontend and api dir is for backend
you cant write backend code in server components tho
@Dunker you cant write backend code in server components tho
Southern rough shrimpOP
so why in this video, does he use prisma in a react component ?
Great black wasp
Server component is backend and frontend to some limit you can return jsx from a server component and do db call or server stuff in server component
@Southern rough shrimp so why in this video, does he use prisma in a react component ?
Dunker
Backend code not means Prisma or sth
Its still API call, so API in backend and you are calling it from still frontend
Backend code means which things controls your routes and doing auth logic or security process
All things related with (req, res) is backend code, so you can't run these in frontend even in server components cuz server components are still Frontend
Southern rough shrimpOP
Allright, thanks for answer
@Southern rough shrimp just my opinion. the reason you have not heard abt server side is Vercel just started focusing on server side recently. indeed they introduced KV redis, Postgres, Blob recentrly. plus Cloudflare edge runtime, AWS lambda Golang and Python. we are going to have many runtimes aside from Node.js. but they are still the work in progress. in future Vercel could be a full-fledged server platform.