Layer0

Preset: layer0 (switch to this preset)

Nitro provides a built-in preset to generate output format compatible with Layer0.

Layer0 extends the capabilities of a traditional CDN by not only hosting your static content, but also providing server-side rendering for progressive web applications as well as caching both your APIs and HTML at the network edge to provide your users with the fastest browsing experience.

If this is your first time deploying to Layer0, the interactive CLI as part of the deploy command will prompt to authenticate using your browser. You may also sign up prior to deployment.

Testing locally

You can use Layer0 to test your app locally:

  1. NITRO_PRESET=layer0 yarn build
  2. # .output/server directory
  3. npm install && 0 build && 0 run -p

Deploying from your local machine

Once you have tested your application locally, you may deploy using:

  1. # .output/server directory
  2. npm install && 0 deploy

It is recommended you install Layer0’s CLI globally on your machine for a more seamless integration:

  1. npm i -g @layer0/cli@latest

Deploying using CI/CD

If you are deploying from a non-interactive environment, you will need to create an account on Layer0 Developer Console first and setup a deploy token. Once the deploy token is created, save it as a secret to your environment. You can start the deploy by running:

  1. 0 deploy --token=XXX