RedwoodJS

This guide shows you how to deploy RedwoodJS apps on Layer0.

Example

Connector

This framework has a connector developed for Layer0. See Connectors for more information.

System Requirements

Getting Started

If you don’t already have a RedwoodJS app, use the terminal (or command prompt on Windows) to create one using the commands below:

Terminal
yarn create redwood-app ./my-redwood-app

Install the Layer0 CLI globally

Terminal
npm install -g @layer0/cli

To prepare your RedwoodJS app for deployment on Layer0, you can use both the RedwoodJS or Layer0 CLI depending on what you prefer.

Using RedwoodJS CLI

You will first need to setup Layer0 as a deploy provider via:

Terminal
yarn rw setup deploy layer0

This will verify that the Layer0 CLI is setup on your system and initialize the application accordingly.

Using Layer0 CLI

For preparing using the Layer0 CLI, run:

Terminal
0 init

This will automatically add all of the required dependencies and files to your project. These include:

  • The @layer0/core package - Allows you to declare routes and deploy your application on Layer0
  • The @layer0/redwoodjs package - Provides router middleware that automatically adds RedwoodJS routes to the Layer0 router.
  • routes.js - A default routes file that sends all requests to RedwoodJS. Update this file to add caching or proxy some URLs to a different origin.
  • layer0.config.js - Contains configuration options for deploying on Layer0.

Running Locally

To simulate your app within Layer0 locally, run:

Terminal
0 dev

Simulate edge caching locally

To simulate edge caching locally, run:

Terminal
0 dev --cache

Deploying

Deploying requires an account on Layer0. Sign up here for free. Once you have an account, you can deploy to Layer0 by running the following in the root folder of your project

You can deploy using the RedwoodJS CLI using:

Terminal
yarn rw deploy layer0

You can also deploy using Layer0 with:

Terminal
0 deploy

The deploy command for RedwoodJS takes the same deploy arguments as using Layer0 to deploy. You can see all the available options using yarn rw deploy layer0 --help

See deploying for more information.