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

207
Views
How to deploy NextJS + Express server

I have such structure of my project.

client - with FrontEnd part

server - BackEnd part (Express)

enter image description here

And server package.json scripts

enter image description here

To start NextJS + Express on localhost:

const PORT = process.env.PORT || 5000
const app = express()

app.use(express.json());
app.use(cookieParser());
app.use(cors({
    credentials: true,
    origin: process.env.CLIENT_URL
}));
app.use(express.urlencoded()); //Parse URL-encoded bodies
app.use("/api", userRouter, categoriesRouter, catalogRouter, storageRouter, ordersRouter);
app.use(errorMiddleware);

const isDev = process.env.NODE_ENV !== 'production'

// if isDev === 'development'
if(isDev) {
    const start = async () => {
        try {
            await mongoose.connect(process.env.DBURL, {
                useNewUrlParser: true,
                useUnifiedTopology: true
            })
            app.listen(PORT, () => console.log(`Server started on PORT = ${PORT}`))
        } catch (e) {
            console.log(e)
        }
    }

    start()
}

// if isDev === 'production'
if(!isDev) {
  // what should be here to deploy production version?
}

But what I should to do to deploy my server for example on Heroku. I cant find any resourse with example of nextJS + Express deployment.

about 4 years ago · Juan Pablo Isaza
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!