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
- Push your theme to a GitHub repository. Run
pnpm validatefirst and fix what it reports. - In Studio, go to Content → Websites and press New website.
- Under Deploy from GitHub, press Connect to GitHub.
- 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.
- 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 apackage.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.
- 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:
- It checks out the commit and moves into your folder.
- It installs with
pnpm install --frozen-lockfilewhen there is apnpm-lock.yaml, ornpm cifor apackage-lock.json. A lockfile in a parent folder counts, so workspaces work. - It runs your
generatescript, orbuildwhen there is nogenerate. - It uploads
.output/public(ordist), 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:
| Reason | What to do |
|---|---|
SITE_BUILD_UNSUPPORTED | Use pnpm or npm with a committed lockfile, and have a generate or build script. |
SITE_BUILD_NO_OUTPUT | The build wrote no .output/public or dist with .eldra/manifest.json. |
SITE_BUILD_EGRESS_BLOCKED | The build tried to reach a host it may not. The log names it. |
SITE_BUILD_TIMEOUT | The build took longer than 15 minutes. |
SITE_SOURCE_BRANCH_NOT_FOUND | The branch was renamed or deleted. Pick it again in Studio. |
SITE_BUILD_FAILED | Your 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
pnpm validateFix everything it reports first. A deploy runs the same check and refuses a theme that fails it.
2. Build
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 generateThe 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_URLis the site's public address. Canonical links, share links and the sitemap need it.ELDRA_BUILD_TOKENis 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_IDwhen 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
ELDRA_API_URL=https://api.studio.example.com \
ELDRA_DEPLOY_TOKEN=<deploy-token> \
pnpm exec eldra-theme deployELDRA_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 inSUCCESS,FAILEDorCANCELED. Anything butSUCCESSfails 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: runpnpm validateand 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:
- Put the deploy pipeline in your repository. The starter's is below.
- 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.
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_TOKENandELDRA_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 }innuxt.config.ts, orELDRA_ANALYTICS=off.
Your blocks can send their own events with useEldraAnalytics().track(name, props).
More: Built-in analytics
Next
- Blocks and fields: add the blocks your merchant needs.
- Pages, routes and menus: product pages, links and languages.
- The deploy loop: every detail of build, deploy and rebuild.