Skip to content

Deploy and go live ​

There are two ways to put a theme live. Eldra hosts the site either way.

  • Connect your GitHub repository. Eldra builds the theme for you, on its own build servers, and deploys it. No CI and no tokens to look after. This is the way to choose for a new site.
  • Deploy from your own pipeline. You build the site yourself, in CI or on your machine, and upload it with eldra-theme deploy.

A site uses one or the other. While a repository is connected, Studio hides the CLI settings.

Connect your GitHub repository ​

  1. Push your theme to a GitHub repository. Run pnpm validate first and fix what it reports.
  2. In Studio, go to Content → Websites and press New website.
  3. Under Deploy from GitHub, press Connect to GitHub.
  4. Sign in with GitHub and install the Eldra app on the account that owns the repository. It asks for read access to code only, and you choose which repositories it sees.
  5. Back in Studio, fill in the form:
    • Repository: the theme's repository. Not in the list? Use Choose which repositories Eldra can see on GitHub, then Refresh list.
    • Branch: the branch Eldra builds from.
    • Folder (optional): the folder the theme is in, such as apps/web. Leave it empty when the theme is at the top. Studio checks that the folder has a package.json.
    • Build when: A change is pushed to the branch, A release is published, or Only when I build it in Studio.
    • Site name: what Studio calls the site.
  6. Press Create site.

The repository is on another GitHub account? Use Install on another GitHub account.

The first build starts at once. When it finishes, the site is live and the page builder shows your blocks.

When Eldra builds ​

  • Your code changes: a push to the branch, or a new release, depending on what you chose.
  • A merchant publishes a page, a menu, a colour or a text.
  • Shop data changes that pages show, such as products, redirects or domains.
  • Someone presses Rebuild in Studio.

Changes that arrive close together are built once. A site has one build running at a time.

What the build does ​

The build runs your theme's own scripts in a sealed sandbox:

  1. It checks out the commit and moves into your folder.
  2. It installs with pnpm install --frozen-lockfile when there is a pnpm-lock.yaml, or npm ci for a package-lock.json. A lockfile in a parent folder counts, so workspaces work.
  3. It runs your generate script, or build when there is no generate.
  4. It uploads .output/public (or dist), which must contain .eldra/manifest.json. The starter writes it for you.

The build gets the shop's public settings as environment variables: ELDRA_GATEWAY_URL, ELDRA_ORG_ID, ELDRA_SITE_ID, ELDRA_SITE_URL, ELDRA_STUDIO_ORIGIN and ELDRA_LOCALE. You set none of them.

The build has no internet

A build may reach your repository, the npm registry and Eldra's public API, and nothing else. A package from a private registry or a git URL fails the install. Data from another service must be fetched in the browser instead. A build also has 15 minutes, and holds no secrets.

When a build fails ​

Studio shows the reason and the end of the build log on the deployment. The common reasons:

ReasonWhat to do
SITE_BUILD_UNSUPPORTEDUse pnpm or npm with a committed lockfile, and have a generate or build script.
SITE_BUILD_NO_OUTPUTThe build wrote no .output/public or dist with .eldra/manifest.json.
SITE_BUILD_EGRESS_BLOCKEDThe build tried to reach a host it may not. The log names it.
SITE_BUILD_TIMEOUTThe build took longer than 15 minutes.
SITE_SOURCE_BRANCH_NOT_FOUNDThe branch was renamed or deleted. Pick it again in Studio.
SITE_BUILD_FAILEDYour install or build script failed. The log shows where.

Deploy from your own pipeline ​

Use this when you cannot connect GitHub, or want to build somewhere else.

1. Validate ​

bash
pnpm validate

Fix everything it reports first. A deploy runs the same check and refuses a theme that fails it.

2. Build ​

bash
ELDRA_GATEWAY_URL=https://web-gateway.example.com \
ELDRA_ORG_ID=<org-id> \
ELDRA_SITE_URL=https://shop.example \
ELDRA_BUILD_TOKEN=<build-token> \
pnpm generate

The build reads every published page and product and writes them as static files to .output/public. Next to them it writes .eldra/manifest.json, the list of your blocks and their fields.

  • ELDRA_SITE_URL is the site's public address. Canonical links, share links and the sitemap need it.
  • ELDRA_BUILD_TOKEN is optional and read-only. With it, the build gets its own request budget instead of sharing your network's with real visitors. Create one in Studio under Settings → API & tracking → Build tokens.
  • Add ELDRA_SITE_ID when the organisation has more than one website.

Check the org id

A build with the wrong ELDRA_ORG_ID still succeeds. It just builds another organisation's content. If a build looks right but reads like the wrong store, check this first.

More: Generate

3. Get a deploy token ​

In Studio, go to Content → Theme and source and create one on the Deploy token card. It belongs to one site and you can revoke it at any time.

The deploy token can publish your site. Keep it in your CI's secret store, never in the repository.

4. Deploy ​

bash
ELDRA_API_URL=https://api.studio.example.com \
ELDRA_DEPLOY_TOKEN=<deploy-token> \
pnpm exec eldra-theme deploy

ELDRA_API_URL is your Studio API address. You can pass both values as flags instead: --api <url> and --token <token>.

deploy looks for your build in .output/public, then dist. Use --dir <path> for anywhere else. It uploads the site with its manifest, then waits until Eldra has finished.

What the output means ​

deployment <id> accepted — blocks +2 ~5 -0
status: PROCESSING
status: SUCCESS
deployed: https://<your-preview-url>
  • blocks +2 ~5 -0: two blocks are new in Studio, five changed, none removed.
  • status: lines: Eldra is publishing your upload. It ends in SUCCESS, FAILED or CANCELED. Anything but SUCCESS fails the command and prints the log Eldra sent.
  • deployed:: the address where you can see the result, or the deployment id when there is none.

You may also see retired or converted lines. They mean a block field changed shape, and Eldra kept or moved the content merchants had written in it.

When a deploy is refused, the message says why. The common ones:

  • manifest rejected by ingest — run eldra-theme validate locally: run pnpm validate and fix what it reports.
  • theme content compatibility requires confirmation: a field change would affect content that already exists. See Block field migrations.
  • token invalid or revoked: create a new deploy token in Studio.
  • deploy rate limit hit: wait a moment and try again.

More: Reading the report

Rebuild when merchants publish ​

A merchant publishes a page, a header, a colour change or a text change. On a site deployed from your own pipeline, Eldra then starts that pipeline, which builds and deploys the site again. The change goes live with no developer involved.

You set this up once per site:

  1. Put the deploy pipeline in your repository. The starter's is below.
  2. In Studio, open the Rebuild on publish card on Content → Theme and source. Pick your CI provider and give it the trigger address and a token that may start the pipeline.

For GitHub, the address is https://api.github.com/repos/<owner>/<repo>/dispatches.

A rebuild passes ELDRA_TRIGGER_DEPLOYMENT_ID to your pipeline. deploy reads it, so Eldra completes the deployment it already opened instead of making a second one.

More: Publish-triggered rebuilds

Run it in CI ​

The starter ships this GitHub Actions workflow as .github/workflows/eldra-deploy.yml. It runs on every push to main and on every rebuild Eldra asks for.

yaml
name: eldra-deploy
on:
  push:
    branches: [main]
  repository_dispatch:
    types: [eldra.rebuild]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20, cache: pnpm }
      - run: pnpm install --frozen-lockfile
      - run: pnpm exec nuxi generate
        env:
          ELDRA_GATEWAY_URL: ${{ vars.ELDRA_GATEWAY_URL }}
          ELDRA_ORG_ID: ${{ vars.ELDRA_ORG_ID }}
          ELDRA_SITE_ID: ${{ vars.ELDRA_SITE_ID }}
          ELDRA_BUILD_TOKEN: ${{ secrets.ELDRA_BUILD_TOKEN }}
          ELDRA_SITE_URL: ${{ vars.ELDRA_SITE_URL }}
      - uses: actions/upload-artifact@v4
        with:
          name: eldra-build
          path: .output/public
          include-hidden-files: true
          if-no-files-found: error
          retention-days: 1
  deploy:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v4
        with: { node-version: 20 }
      - uses: actions/download-artifact@v4
        with:
          name: eldra-build
          path: .output/public
      # Use the same version as @eldrajs/theme-cli in package.json.
      - run: npx --yes @eldrajs/theme-cli@<version> deploy
        env:
          npm_config_ignore_scripts: 'true'
          ELDRA_API_URL: ${{ vars.ELDRA_API_URL }}
          ELDRA_DEPLOY_TOKEN: ${{ secrets.ELDRA_DEPLOY_TOKEN }}
          ELDRA_TRIGGER_DEPLOYMENT_ID: ${{ github.event.client_payload.deploymentId }}

Set these in your repository's settings:

  • Variables: ELDRA_GATEWAY_URL, ELDRA_ORG_ID, ELDRA_SITE_ID, ELDRA_SITE_URL, ELDRA_API_URL.
  • Secrets: ELDRA_BUILD_TOKEN and ELDRA_DEPLOY_TOKEN.

Keep the two jobs apart

The build job runs code from every package you install. So it never gets the deploy token. Only the deploy job has it, and that job installs nothing but the CLI, with install scripts off. Keep this split when you adapt the workflow.

The starter has the same pipeline for GitLab (.gitlab-ci.yml) and Bitbucket (bitbucket-pipelines.yml).

More: Wiring rebuilds

SEO basics ​

Merchants set titles, descriptions and share images in Studio, on the Search and sharing (SEO) card under Content → Theme and source. They can also set them per page, or hide a page from search engines. Your theme writes them into each page's head with useEldraSeo. The starter already does this.

A deploy build is a production build, which search engines may index. It needs the site's address for canonical links. Eldra's build sets it; in your own pipeline, set ELDRA_SITE_URL. A production build also writes robots.txt and sitemap.xml from the merchant's settings. Do not ship your own copies in public/, or the generated ones are skipped. The preview address is always kept out of search engines.

More: Page titles and SEO

Site icons ​

Icons belong to the merchant, so they set them in Studio's site settings. It takes one square image, at least 512 px, in PNG, JPEG or WebP. The build adds the favicon, the Apple touch icon and a web app manifest to every page. There is nothing to code.

Until a merchant sets icons, your theme's own files in public/ are used.

More: Site icons

Built-in analytics ​

A deployed site reports page views to the organisation's analytics in Studio, with no code. It uses no cookies and stores nothing in the browser. It never runs in pnpm dev, a preview build or the page builder.

Two things to know:

  • Visits only count from addresses in Settings → General → Site addresses. Add the live domain when it is connected.
  • To switch analytics off, set eldra: { analytics: false } in nuxt.config.ts, or ELDRA_ANALYTICS=off.

Your blocks can send their own events with useEldraAnalytics().track(name, props).

More: Built-in analytics

Next ​

Eldra