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.
Zerops
Zerops is the official deployment partner for AnalogJS.
Analog supports deploying both static and server-side rendered apps to Zerops with a simple configuration file.
One Zerops project can contain multiple Analog projects. See example repositories for static and server-side rendered Analog apps for a quick start.
Static (SSG) Analog app
If your project is not SSG Ready, set up your project for Static Site Generation.
1. Create a project in Zerops
Projects and services can be added either through a Project add wizard or imported using a YAML structure:
project:
name: recipe-analog
services:
- hostname: app
type: static
This creates a project called recipe-analog
with a Zerops Static service called app
.
2. Add zerops.yml configuration
To tell Zerops how to build and run your site, add a zerops.yml
to your repository:
zerops:
- setup: app
build:
base: nodejs@20
buildCommands:
- pnpm i
- pnpm build
deployFiles:
- public
- dist/analog/public/~
run:
base: static
3. Trigger the build & deploy pipeline
Server-side rendered (SSR) Analog app
If your project is not SSR Ready, set up your project for Server Side Rendering.
1. Create a project in Zerops
Projects and services can be added either through a Project add wizard or imported using a YAML structure:
project:
name: recipe-analog
services:
- hostname: app
type: nodejs@20
This creates a project called recipe-analog
with a Zerops Node.js service called app
.
2. Add zerops.yml configuration
To tell Zerops how to build and run your site, add a zerops.yml
to your repository:
zerops:
- setup: app
build:
base: nodejs@20
buildCommands:
- pnpm i
- pnpm build
deployFiles:
- public
- node_modules
- dist
run:
base: nodejs@20
ports:
- port: 3000
httpSupport: true
start: node dist/analog/server/index.mjs
3. Trigger the build & deploy pipeline
Build & deploy your code
Trigger the pipeline by connecting the service with your GitHub / GitLab repository
Your code can be deployed automatically on each commit or a new tag by connecting the service with your GitHub / GitLab repository. This connection can be set up in the service detail.
Trigger the pipeline using Zerops CLI (zcli)
You can also trigger the pipeline manually from your terminal or your existing CI/CD by using Zerops CLI.
- Install the Zerops CLI.
# To download the zcli binary directly,
# use https://github.com/zeropsio/zcli/releases
npm i -g @zerops/zcli
-
Open Settings > Access Token Management in the Zerops app and generate a new access token.
-
Log in using your access token with the following command:
zcli login <token>
- Navigate to the root of your app (where
zerops.yml
is located) and run the following command to trigger the deploy:
zcli push
Trigger the pipeline using GitHub / Gitlab
You can also check out Github Integration / Gitlab Integration in Zerops Docs for git integration.
Netlify
Analog supports deploying on Netlify with minimal configuration.
Deploying the Project
- Create analog
- Nx
In the build settings of your Netlify project, set the publish directory to dist/analog/public
to deploy the static assets and the functions directory to dist/analog
to deploy the server.
In the build settings of your Netlify project on the web UI, do the following.
- Set the build command to
nx build [your-project-name]
- Set the publish directory to
dist/[your-project-name]/analog/public
to deploy the static assets - Set the functions directory to
dist/[your-project-name]/analog
to deploy the server.
You can also configure this by putting a netlify.toml
at the root of your repository. Below is an example config.
# replace "my-analog-app" with the name of the app you want to deploy
[build]
command = "nx build my-analog-app"
publish = "dist/my-analog-app/analog/public"
functions = "dist/my-analog-app/analog"
Vercel
Analog supports deploying on Vercel with no additional configuration.
Deploying the Project
- Create analog
- Nx
By default, when deploying to Vercel, the build preset is handled automatically.
-
Create a new project and select the repository that contains your code.
-
Click 'Deploy'.
And that's it!
In order to make it work with Nx, we need to define the specific app we want to build. There are several ways to do this, and you can choose one of the following methods (replace <app> with your app name):
- Define the
defaultProject
in yournx.json
{
"defaultProject": "<app>"
}
- Create a
vercel.json
file in the root of your project and define thebuildCommand
:
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"buildCommand": "nx build <app>"
}
- Define the
buildCommand
in yourpackage.json
:
{
"scripts": {
"build": "nx build <app>"
}
}