Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

337
Views
Should I develop a separate express server, or handle all API calls in my next.js app?

My website will perform CRUD operations and will work with MongoDB and Firebase storage+auth.

What are the reasons / advantages to developing a separate Express server instead of integrating everything in my next.js app?

As far as I have seen, it can all be done in my next.js app, but I still see many projects working with a separate server.

over 4 years ago · Santiago Trujillo
5 answers
Answer question

0

I can think of a few things why they would have a different server from the one NextJS provides:

  1. Familiarity with Express, Koa, etc. All next-connect helps with this
  2. There is an already existing API in PHP, Express, Flask, etc.
over 4 years ago · Santiago Trujillo Report

0

It is literally based on what you would want to do, the extra interactions with MongoDB & Firebase would be same on both the technologies, unless you want to isolate respective things separately, I don't see any harm in doing everything together on next.

Given that the idea of using next.js, as per my understanding would be to utilise server side rendering.

over 4 years ago · Santiago Trujillo Report

0

Depends on what your app does and how you are hosting it.

Running Next.Js on a standard server will be of little difference whether you are using nextjs's /api or expressjs.

However if you are hosting on serverless (e.g. Vercel), I would recommend using a separate express server if you have alot of CRUD operations because the warming up of serverless is really bad user experience.

Build and Deployment

Next/JS - If you want to edit something on the backend, and push the changes, it will require you to build the entire JS app, and depending on how big is your app, it can take alot of time (especially if alot of static generated pages).

Express - If you running express separately, you can build and deploy front end and backend separately. It's time saving, and you can also better organise your codes frontend/backend.

Choice of deployment

I have a choice to take advantage of Vercel to host my frontend, with static generated pages and some server side generated pages (automatic scaling, caching, CDN etc), and host my backend with a separate cluster of servers.

PS: I moved from single Next.JS app to NextJs+Express

over 4 years ago · Santiago Trujillo Report

0

I've been using Next.js with Typescript for quite a while now and I, as of now, have found one reason not to include express.js in my project. And the reason is Vercel.

Since I use Vercel for continuous deployment of my projects, and Vercel Not supporting any custom server as of there Docs here, I refrain from using Express or any other custom servers.

I didn't face any problem performing CRUD operations with MongoDB, can't say about firebase.

On Next.js Docs, I found these points to be considered:

  1. A custom server can not be deployed on Vercel, the platform Next.js was made for.
  2. A custom server will remove important performance optimizations, like serverless functions and Automatic Static Optimization.

But at the end of the day it very personal opinion weather to use a custom server or not. It might depend on a very specific use case you might be looking for.

over 4 years ago · Santiago Trujillo Report

0

Personally, I try to keep it to just NextJS, but if I have to manage real-time data with Socket.io, I get a separate server because other than WebSockets, serverless functions can do everything else.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!