Documentation
NextJS (Standalone)

NextJS (Standalone)

NextJS is a full-stack framework that makes it easy to deploy web applications in a single codebase.

What is Standalone Mode?

Standalone mode is an NextJS output format that simplifies packaging and deployment of an application and its dependencies. Read more about the output options here (opens in a new tab).

Airbase recommends using next >= 13.5.4 with standalone mode.

💡

When using standalone mode, the output option must be set to standalone in the next.config.js file.

Here are some of the advantages of standalone mode:

  • faster build times
  • smaller artifact size
  • better support from NextJS

Instructions

Update output mode in NextJS settings

Add this line to the project's next.config.js file:

  // next.config.js
 
  const nextConfig = {
    ...
+   output: 'standalone',
    ...
  };
 
  module.exports = nextConfig;

Configure Airbase to use nextjs-standalone mode

Run airbase configure and select nextjs-standalone from the list of frameworks when prompted.

user@laptop example % airbase configure
 
Configuring project for Airbase
? Project Name: example
? Framework: nextjs-standalone
? Command to build production deployment: npm run build
? Command to start production server: node server.js
 
{
  name: "example"
  framework: "nextjs-standalone"
  scripts: {
    build: "npm run build"
    start: "node server.js"
  }
}
 
? Save configuration? Yes
 
Configuration saved in ./airbase.json
Run airbase build to create a deployment package.
user@laptop example %

The default values for the build and start commands are provided in this sample airbase.json file:

{
  "name": "example",
  "framework": "nextjs-standalone",
  "scripts": {
    "build": "npm run build",
    "start": "node server.js"
  }
}

Build and deploy your application

Now that the NextJS and Airbase configuration has been updated, run airbase build as normal to build your application.

Then deploy the application with airbase deploy.