Skip to main content

Providers

Analog supports deployment to many providers with little or no additional configuration using Nitro as its underlying server engine. You can find more providers in the Nitro deployment docs.

Render.com

Analog supports deploying on Render with minimal configuration.

  1. Create a new Web Service and select the repository that contains your code.

  2. Ensure the 'Node' environment is selected.

  3. Depending on your package manager, set the build command to yarn && yarn build, npm install && npm run build, or pnpm i --shamefully-hoist && pnpm build.

  4. Update the start command to node dist/analog/server/index.mjs

  5. Click 'Advanced' and add an environment variable with BUILD_PRESET set to render-com.

  6. Click 'Create Web Service'.

Edgio

Analog supports deploying on Edgio with minimal configuration.

  1. Install the Edgio CLI:
npm i -g @edgio/cli
  1. In your project's directory, initialize Edgio:
edgio init --connector=@edgio/analogjs
  1. Deploy To Edgio
edgio deploy

Firebase

Analog supports Firebase Hosting with Cloud Functions out of the box.

See a Sample Repo with Firebase configured

Note: You need to be on the Blaze plan to use Analog with Cloud Functions.

If you don't already have a firebase.json in your root directory, Analog will create one the first time you run it. In this file, you will need to replace <your_project_id> with the ID of your Firebase project.

This file should then be committed to version control. You can also create a .firebaserc file if you don't want to manually pass your project ID to your firebase commands (with --project <your_project_id>):

{
"projects": {
"default": "<your_project_id>"
}
}

Then, just add Firebase dependencies to your project:

npm install -D firebase-admin firebase-functions firebase-functions-test

Using Firebase CLI

If prefer to set up your project with the Firebase CLI, which will fetch your project ID for you, add required dependencies (see above) and even set up automated deployments with GitHub Actions.

Install Firebase CLI globally

npm install -g firebase-tools

Note: You need to be on ^11.18.0 to deploy a nodejs18 function.

Initialize your Firebase project

firebase login
firebase init hosting

When prompted, enter dist/analog/public as the public directory.

In the next step, do not configure your project as a single-page app.

After setup completes, add the following to your firebase.json to enable server rendering in Cloud Functions:

{
"functions": { "source": "dist/analog/server" },
"hosting": [
{
"site": "<your_project_id>",
"public": "dist/analog/public",
"cleanUrls": true,
"rewrites": [{ "source": "**", "function": "server" }]
}
]
}

You can find more details in the Firebase documentation.

Local preview

You can preview a local version of your site to test things out without deploying.

BUILD_PRESET=firebase npm run build
firebase emulators:start

Deploy to Firebase Hosting using the CLI

To deploy to Firebase Hosting, run the firebase deploy command.

BUILD_PRESET=firebase npm run build
firebase deploy