Skip to main content

Next Js Deployment

Your Nextjs project directory should look something like this:

projectRoot
|___ public
|___ src
|___ pages
|___ ...etc
|___ next.config.js
|___ package.json
|___ .lyrid-definition.yml **
|___ ...etc

Lyrid Definition

Your lyrid definition should look something like this:

// Your .lyrid-definition.yml
name: <YOUR APP NAME>
// ......
modules:
- name: <YOUR MODULE NAME>
language: nodejs(14|16|18).x
web: nextjs
// ......
note

Starting from Node 18 most our build script uses yarn as package manager as opposed to npm. It may cause issues during package installation in Lyrid's Platform if you are not using the same package manager.

  • Node 14 - npm
  • Node 16+ - yarn

Standalone mode

For Node 16+ and Next 12.2+, Lyrid's platform supports and encourages you to deploy your nextjs project in standalone mode.

  1. Open your next.config.js
  2. Add the following:
// Your .next.config.js
module.exports = {
// ......
output: 'standalone'
}
  1. Make sure your .lyrid-definition.yml has the web as next.standalone and language as nodejs18.x or nodejs16.x depending on your node version
// Your .lyrid-definition.yml
name: <YOUR APP NAME>
// ......
modules:
- name: <YOUR MODULE NAME>
language: nodejs(16|18).x
web: next.standalone
// ......