Next.js Discord

Discord Forum

Best Backend for Next.js and Postgres?

Answered
noqx posted this in #help-forum
Open in Discord
Hey, I’ve already worked with Next.js on the frontend, but this will be my first project where I also need a backend with a database. Im planning to use PostgreSQL and Im not sure what the best backend option is. I’ve read about using Express or Next.js API routes, and Id like to know which one is recommended and why (of course, Im also open to other options).
Answered by B33fb0n3
as DB I would use postgresql as well. Many other people do so too. And when looking at the "connection" to the DB, I would first decide if I want to stay with next.js or if there is any reason, why I should have an extra backend like express, fastify, ...

I like to use next.js route handlers for queries and sevrer actions for mutations. It's very easy to set things up and it has the lowest latency as it runs on the same server.

So, yea: postgresql is good. Next.js as backend is good, but you can still decide to use an extra backend (I wouldn't)
View full answer

2 Replies

@noqx Hey, I’ve already worked with Next.js on the frontend, but this will be my first project where I also need a backend with a database. Im planning to use PostgreSQL and Im not sure what the best backend option is. I’ve read about using Express or Next.js API routes, and Id like to know which one is recommended and why (of course, Im also open to other options).
as DB I would use postgresql as well. Many other people do so too. And when looking at the "connection" to the DB, I would first decide if I want to stay with next.js or if there is any reason, why I should have an extra backend like express, fastify, ...

I like to use next.js route handlers for queries and sevrer actions for mutations. It's very easy to set things up and it has the lowest latency as it runs on the same server.

So, yea: postgresql is good. Next.js as backend is good, but you can still decide to use an extra backend (I wouldn't)
Answer