Skip to main content
The Xano Engine, every ephemeral and your workspace have a static host, and a workspace can have several sites, each with its own address. --static <dir> on a deploy publishes a built frontend after the backend import, and npx @xano/sdk publish republishes one without touching the backend.

Publish with a deploy

Point --static at a directory your build already wrote:
npm run xano:deploy:ephemeral in a scaffolded project runs the second line for you. The deploy reports the frontend’s URL as static.url: Before archiving, the deploy writes the backend’s URL into every HTML document in the build as window.XANO_HOST, so the same build works on any backend with no rebuild. Read it at runtime with a build-time fallback:
Fetch absolute URLs built from that host. A bare /api: path works behind a dev server that proxies it, but the published site answers it with its own index.html. routeUrl() in xano/routes.gen.ts builds the absolute URL for you (Typed frontend). --static-env KEY=VALUE (repeatable) adds more public config as window.<KEY>. Everything injected is served to the browser, so never put a secret there. Typed frontend covers calling your APIs from the app. A deploy with --static does not write .env.local: the frontend reads its backend URL at runtime.

Republish the frontend alone

npx @xano/sdk publish <dir> uploads a built directory and nothing else: no compile and no backend import. With no --to, it publishes to the backend this project last deployed to.
--to also takes ephemeral:<name>, local:<name>, workspace and tenant:<name>. Publishing to a workspace or a tenant asks before it replaces what its users see (--yes in CI). Publishing to the Engine includes a SvelteKit app’s server half (below).

Choose the site

A frontend publishes to the site named default unless the project names another. The project names its site in package.json, beside the Xano Engine pin, so every checkout (a teammate’s, Xano Studio, CI) publishes to the same one:
Write that line with site use, and see the workspace’s sites with site list:
Both read your workspace unless --on names another backend. site list shows Dev and Prod once a site’s Prod has an address or a build. The line is the default for publish and deploy --static:
  • A typed --static-host still wins, with a note when it differs from the line. It must name a site the target already has; npx @xano/sdk site use <name> --create makes one.
  • The line’s site is created on first publish when the target does not have it yet. A fresh ephemeral, or one a deploy just replaced, has only default.
  • A value that is not a site name (lowercase letters and digits) is ignored with the warning static.site-line-ignored.

One app per site

frontend/ is one app (the flat layout), and that stays the usual shape. When a project needs several sites, frontend/ holds one folder per site instead (the nested layout): frontend/shop/ and frontend/admin/, each named for the site it publishes to. Each is an app with its own package.json whose build script writes dist/ (or build/, out/), or a folder with an index.html served as it is. A folder that holds no app, such as frontend/shared/, is code the apps share and is never published. In this layout the folder names pick the sites, so the staticHost line plays no part.
Every app is built before anything is signed into or sent, so a failing build costs nothing. A site that does not exist yet is created on first publish. To move a flat project to this layout, run frontend split. It moves everything in frontend/ into frontend/<site>/ (the line’s site, else default; --site picks another), points the package.json scripts that name frontend/ at the new folder, drops the staticHost line, and builds the moved app. If anything fails, it puts every file back and exits non-zero, naming what broke.
A frontend built by the project’s root package.json (the scaffold’s) needs a package.json of its own before it can be split.

Each build keeps its source

publish and deploy --static send each app’s source beside its build, one archive per site: the app’s folder (frontend/ or frontend/<site>/) plus the project’s root package.json, never xano/ or another app. Xano keeps it as the build’s original, so a later site pull brings back code you can edit rather than built files. Only what git would commit goes: tracked files, plus untracked files .gitignore does not exclude. node_modules, .git, symbolic links and the build output stay out, and so do files named like secrets even when committed (.env*, .npmrc, *.pem, *.key, xano.profile.json, anything under .xano/, and similar). The run names each file it left out and says what it sends before it asks to publish. No source is sent, and the build publishes alone with the warning static.source-skipped, when:
  • the folder is not in a git repository, so nothing says which files are safe to share;
  • git cannot list it (not installed, or it does not answer in time);
  • the archive passes the 100 MB upload cap.
Two flags change what is sent:
--static-source covers one site at a time. A build outside any app folder (publish ./dist with no frontend/) sends no source. A project’s xano/data is never packed into a source archive.

Where a build came from

Every build the SDK uploads carries a description: Published from the CLI · commit a119141, with (uncommitted changes) added when a tracked file differs from that commit. Untracked and ignored files never count. Outside a git repository, or before the first commit, the description names no commit. Set XANO_PUBLISHED_FROM to say who published:
A build uploaded in the Xano dashboard has no description, which is how a tool tells a build of your code from one uploaded by hand.

Pull the sites into your project

A pull of the backend leaves frontend/ alone. site pull brings each site’s live code down:
For each site it reads the build Dev serves, else Prod’s, else the site’s newest build, and writes the source kept with that build:
  • A project’s source (what a publish sends by default): the site’s app is taken from it, and the backend and other apps are left out.
  • An app (a package.json with a dev or build script): kept as it is.
  • Plain files (an upload with an index.html): written as built files in site/, beside a site.mjs that serves them for npm run dev and copies them for npm run build.
  • No usable source (an older build, or a Git-synced one): the files the build serves, in the same built-files shape, with the warning site.built-fallback.
One site into a project with no frontend gives the flat layout: frontend/ is the app and package.json names the site. Several give frontend/<site>/ each. A flat project can only pull its own site again (site.blocked); run frontend split to make room for more. An app folder already there is kept unless --force. site pull writes only under frontend/, the root package.json and .xano/sites.json (gitignored), and never touches xano/. Off a terminal it needs --yes. Two other commands pull the sites too:
  • init --from workspace pulls them after the backend by default (Start from an existing workspace). --no-sites skips them.
  • pull --with-sites refreshes the backend, then pulls each site.
A plain npx @xano/sdk pull from the workspace checks each site the project keeps against the build Xano serves. When your frontend does not hold that build, it prints the site pull command that brings it down and changes nothing. A build counts as held when its description names a commit in the project’s git history with no uncommitted changes, or when the last site pull here recorded it in .xano/sites.json.

Promote or roll back a build

site serve puts a build that already exists on Dev or Prod, with no rebuild and no upload: promoting Dev’s build to Prod, or rolling Prod back to an earlier one. It is what Promote and Rollback do in Xano Studio. site list names the build each environment serves.
It asks before it changes Prod (--yes off a terminal).

How long a frontend URL lasts

A deploy that replaces the backend also clears its static hosting, sites included. A deploy without --keep-data takes the published frontend down, and with --static publishes it again, possibly at a new URL. A site named by the staticHost line or a frontend/<site>/ folder is created again on that publish; a site named only by a typed --static-host is refused until you create it. The backend URL stays the same across the refresh. To keep the frontend serving through a backend change, merge instead:
When an ephemeral expires, its backend and frontend go with it.

Routing and size limits

The deploy infers whether the build is a single-page app or one document per route. --static-routing spa|multipage overrides that, and is rarely needed. Both are checked before anything is uploaded, so an oversize build stops the run with nothing written. An upload that fails after the backend landed leaves the backend in place, exits 3, and prints the npx @xano/sdk publish command that retries only the frontend.

Server rendering with SvelteKit on the Engine

On the Xano Engine, a SvelteKit app can render on the server. Build it with the SDK’s adapter, which needs esbuild in the app:
In a scaffolded SvelteKit project, SvelteKit’s config is the object passed to sveltekit() in vite.config.ts, and it already uses this adapter:
The scaffold prerenders every route from frontend/src/routes/+layout.ts. Stop prerendering the routes that should render per request. vite build then writes the client assets and prerendered pages, a 404.html fallback shell, and the server half in .xano-ssr/. Deploy it to the Engine:
The Engine serves files as files and renders every other path (a dynamic route, __data.json, a form action) through the server half. A server load reads the Engine’s URL as XANO_HOST:
Know three things about the server half:
  • It can hold secrets. SvelteKit inlines $env/static/private values into it, which is why the Engine never serves /.xano-ssr/.
  • It runs inside the Engine, not in Node. Keep state in your API, since module state is per runtime. Bodies are buffered (no streaming), request.formData() reads urlencoded forms only, and there is no AsyncLocalStorage. A render has 30 seconds and may answer up to 10 MB.
  • Other hosts serve only the static half. An ephemeral, a tenant or your workspace answers every non-file path with the 404.html shell, which boots the app in the browser. Prerendered routes and routes with a universal load work there; a route whose data comes from +page.server.js does not.

Next