---
title: Publish a static site
description: Publish web pages, styles and images as a serverless application, then check the deployed site and its file paths.
slug: /guides/publish-a-static-site
order: 42
visibility: public
redirects_from: []
---

# Publish a static site

Prompt:

> Publish this folder of web pages as a public site.

Publish static files as a [serverless application](/cloud/concepts/serverless-applications-and-servers/), with no start script or health path. To add request handlers, read [Deploy functions](/cloud/guides/deploy-functions/). For an application with its own server, read [Serve a web client](/cloud/guides/serve-a-web-client/).

## What your AI does

- Keeps the site's files under `client/`, preserving their names and relative links.
- Creates a serverless application and submits its manifest.
- Chooses a deploy route, waits for its outcome and checks the page, styles and image.

## What you need

- The HTML pages, stylesheets, images and other files you want visitors to read.
- A connected, signed-in AI assistant ([Connect your AI assistant](/cloud/getting-started/connect-your-tool/)).

This example publishes a public site. A static site can also admit only people you invite, as [Serverless applications and servers](/cloud/concepts/serverless-applications-and-servers/#who-can-read-a-static-site) explains.

## Before your AI starts

For your AI:

- Read the deploy skill with `read_context`, id `skill:deploy`.
- Confirm which files the person wants to publish. Keep secrets and private files outside `client/`.
- Check whether you can read the original bytes of each image. A preview alone does not supply them. If you cannot read the bytes, tell the person they will need to upload the image from the application's page. [Step 3 (Deploy the folder and check the result)](#3-deploy-the-folder-and-check-the-result) explains the upload and when to leave the deploy pending.
- Choose serverless for a site of static files alone, and tell the person why in one line. Include that functions share a process with other customers' functions and a server has its own container. If the person is available, ask before choosing a server, which is charged while awake. Keep their chosen size. For a server with no size chosen and nobody to ask, create Shared 0.5 GB. Report the size, that nobody was available, its awake-time charge and the option to request Shared 1 GB for more memory or CPU. A serverless application has no server charge.
- Call `create_application` with the application's `name` and with `kind` set to `serverless`, without a `size`. Follow [Deploy from your computer](/cloud/getting-started/deploy-an-application/) for manifest submission.
- Use the limits below when preparing the files. A serverless application is charged only for what it serves; the [pricing page](https://dev.turnzero.ai/pricing) gives the rates. There is no free hosting plan to select: a static site's data transfer draws the account's [Free Allowance](/cloud/concepts/glossary/#free-allowance) first, as [Size and usage](/cloud/guides/plan-and-usage/#1-choose-a-size) explains.

## Steps

### 1. Put the page's files in the deploy folder

With a shell, `turnzero scaffold --origin https://dev.turnzero.ai --template static-site` writes a starting site in `app/`. This guide creates the application first. To link the folder to an existing application, supply its ID with `--application <application id>`. This writes the `application` field in `manifest.json`. You can also scaffold first and create the application afterward. If you omit `--application`, the first deploy writes the ID.

Keep an existing site's file names and relative links, with its files under `client/`. For a new site, this example uses:

```text
manifest.json
client/index.html
client/styles.css
client/logo.png
```

The deploy folder holds `client/` at its root, beside `manifest.json`. Zip that folder's contents, so neither sits inside another folder in the zip. A root `package.json` and a `lib/` folder may remain; they are stored but nothing is installed, built or run.

#### Link pages and files

A file's path below `client/` is its path on the site. For this layout, `/styles.css` and `/logo.png` name the stylesheet and image. Names match exactly, including case; the platform does not decode them.

Use `redirects` in the manifest to send visitors from an old path to a new one on the same hostname. For a matching `GET` or `HEAD`, the rule answers before a client file, a folder's page, the automatic redirect that adds a trailing slash, the site's not-found page or a function. The response keeps the request's query string. See [Redirect an exact path](/cloud/guides/serve-a-web-client/#redirect-an-exact-path) for how to declare and check a rule. Check on the deployed site, since `turnzero run --origin https://dev.turnzero.ai` skips manifest redirect rules.

Put an additional page in `client/about.html` and link to `/about.html`. A folder's page belongs in its `index.html`: `client/notes/index.html` answers `/notes/`. A request for `/notes` gets a 302 redirect to `/notes/` when that folder holds an `index.html`.

Relative links start at the page's folder. From `/notes/`, `styles.css` requests `/notes/styles.css`; `/styles.css` requests the root stylesheet. The redirect to a folder's closing slash keeps those relative links working.

With no `client/404.html`, a page path whose last part has no dot gets the root `index.html` when no redirect rule or file matches. This lets a single-page application handle its own page paths after a reload. A missing image or another missing path with a dot gets 404 `not_found` as JSON.

To serve your own not-found page, add `client/404.html`. A GET or HEAD for a path no manifest redirect, file, folder’s `index.html`, folder redirect or function answers then receives status 404. A GET includes your page; a HEAD returns its headers and length without a body. This covers both page paths such as `/orders/42` and missing files such as `/missing.png`.

With this file, the root `index.html` answers `/` unless a manifest rule redirects it, but it no longer answers other missing page paths. For a single-page application that handles page paths after a reload, leave out `client/404.html`. For a site of separate pages that needs its own not-found page, include it.

The not-found page keeps its content type and `no-cache`, and its served bytes count as data transfer. A conditional GET for a missing path still receives 404 with the page, never 304. Requesting `/404.html` directly returns the file with status 200. A `404.html` below the root is an ordinary file.

Use links from the site root in `404.html`, such as `/styles.css` for a stylesheet and `/` for the home page. The browser reads this page at the missing address, so a relative link could request a file below that address.

Methods other than GET and HEAD still receive 404 `not_found` as JSON when no function answers. To check a static site locally, run `turnzero run --origin https://dev.turnzero.ai` from the deploy folder. The preview serves `client/404.html` with status 404 for a missing path. When you finish checking the site, stop the preview with Ctrl+C in its terminal.

For a public site, [`immutable_client_folder`](/cloud/guides/serve-a-web-client/#4-know-the-headers-the-revalidation-and-the-compressed-forms) lets browsers cache one folder of client files for a year.

#### Keep the files within the bounds

The `client/` folder may hold at most 2,000 files. One file may be at most 25 MiB, and all its files together at most 50 MiB. A deploy past a bound is refused `artifact_layout_invalid`, naming the bound.

A root `package.json` or `manifest.json` that is too large is refused too. The refusal names its bound.

### 2. Submit the manifest

Write and submit this `manifest.json` before the first deploy:

```json
{
  "manifest_version": 1,
  "services": [],
  "region": "usa",
  "egress": [],
  "audience": { "kind": "public" },
  "packages": []
}
```

These are the six required members. The manifest needs no `health` member, and the static site uses no health path. [Author the manifest](/cloud/guides/author-the-manifest/) explains its members.

A serverless application can also hold functions and migration files, with a database, schedules or declared outgoing hosts. Follow [Deploy functions](/cloud/guides/deploy-functions/) for those additions. This guide deploys static files alone.

### 3. Deploy the folder and check the result

Follow [Ways to deploy](/cloud/getting-started/ways-to-deploy/) to choose the route. Submit the manifest and call `check_deploy` as that page directs before deploying.

- Prefer the `turnzero` command where it works. It sends the folder and binary image together.
- For `deploy_files`, send the PNG's original bytes as base64 in `content` with `"encoding": "base64"`. Do this only if you can read those bytes. If you can only view a preview, use the upload choice below. Inline files are limited to 512 KiB each; the complete list is limited to 200 entries and 4 MiB in total. The request's JSON also has a 4 MiB bound. [Deploy from a chat](/cloud/getting-started/build-an-app-from-a-chat/) explains splitting calls within those limits.
- Past those limits, use the command or the upload route from Ways to deploy, as the tool permits. If a route refuses permission, report the refusal and stop using that route.

If you cannot read the image's bytes, ask the person to [upload it from the application's page](/cloud/guides/store-files/#upload-a-file-from-the-application-s-page). Declare a storage area bound to the application with `declare_storage_area` first if it has none. Have the person select the same environment the deploy will target. They can upload before any deploy. Leave the deploy pending unless the person agrees to publish the page without its image for now. If nobody is available to upload the image or agree to publishing without it, leave the deploy pending and tell the person what waits.

If the person agrees, deploy the other files first. The deploy checks do not read the page's links; `/logo.png` returns 404 and the page shows a broken image until you add the file.

After the upload, send the complete `deploy_files.files` list: every other file plus `{ "path": "client/logo.png", "stored": { "area": "<area>", "name": "<name>" } }`. Use the area and file name from the upload. This creates a new version. Stored files have no 512 KiB per-file limit but count toward the total bytes and entries. Include the stored name only after the upload: a missing stored name returns `artifact_not_found`, and nothing deploys. If that happens, check the target environment, storage area, and file name against the upload.

A static site needs another deploy to serve a changed stored file; for updates without a redeploy, use a server whose backend reads [Storage](/cloud/backend-packages/storage/) or mints a download grant.

The file-list route needs no root `package.json` for a static site. It publishes the files as one version, without building an image or starting a process.

Read `read_status` with `wait_seconds` until the deploy ends. Then request `/`, `/styles.css` and `/logo.png` on the hostname the platform returned. With no shell, use `request_route`. Read a failed outcome before retrying; a lost response does not show whether the deploy started.

If you included `client/404.html`, also request a missing page path and a missing file path. Each GET must return your page with status 404; `/404.html` itself must return it with status 200.

## Expected result

The deploy reaches `deployed`, and the page, stylesheet and image load on the returned hostname. The platform serves the files without a container of the application's own. Every file served counts its bytes as data transfer, including the root page; no request is counted for a static file.

With development turned on, a deploy serves development. If production already serves a version, that version stays live. If production has never served a version, it stays empty until the first promotion ([Test in development, then promote](/cloud/guides/turn-on-development-and-promote/)). Promote and rollback select a version whose published files are still kept.

The daily cleanup keeps the files for three distinct deployed versions per environment, with the serving version first. It also keeps files for any version either environment keeps, or for a deploy or promote in progress. To use an earlier version, choose one listed as `promotable`, or deploy its files again as a new version.

Nothing sleeps or needs to wake. A restart serves the same version again without starting a process. While an environment is halted, every path returns 503 `environment_halted`. Resume the environment to serve the files again. If the account is suspended, requests return 503 `account_suspended`.

While its account is [paused](/cloud/concepts/glossary/#pause), every path answers 429 `account_paused`. The pause ends when the account has Free Allowance available again or credit it can use. No file is read and no bytes count as data transfer.

## Refusals

| What you see | Cause | Remedy |
| --- | --- | --- |
| `artifact_layout_invalid` | The zip has no `client/` folder at its root, or a file or folder is past a bound. | Follow the named bound. If the refusal names an enclosing folder, zip that folder's contents instead. |
| `serverless_unsupported` | The platform serving this request admits static serverless sites but has not enabled functions or their services. | Keep this deploy to static files, or create a separate server application for work that requires one. Ask the owner before choosing a server if they are available, and keep their chosen size. For a server with no size chosen and nobody to ask, use Shared 0.5 GB. For that unattended choice, report the size, that nobody was available, its awake-time charge and the option to request Shared 1 GB for more memory or CPU. Report the refusal through `submit_feedback` if you need functions. |
| `deploy_files_too_large` | The file list is past that route's limits. | Use the command or upload route where available; do not split calls to bypass the total limit. |
| 404 `not_found` as JSON | A path has no file or page fallback, or the method is neither GET nor HEAD. A site with a root `404.html` answers a missing GET or HEAD with its page instead. | Match the file’s path and case. Use GET or HEAD to read files. |
| 404 `not_deployed` | No version is serving. | Finish a deploy to this environment; promote a published version for production when development is turned on. |
| 409 `version_client_pruned` | A promote or rollback named a version whose deployment is still kept. The daily cleanup deleted its published client files. | Choose a version `tzcloud_list_versions` marks `promotable`, or deploy the files again as a new version. |
| 503 `environment_halted` | The environment is halted. | Resume the environment before checking its files. |
| 503 `account_suspended` | The account is suspended. | Ask the account owner to resolve the suspension. |
| 429 `account_paused` | The account is paused, so every path is refused before a file is read. | Wait for Free Allowance to renew or for credit you can use. [Pause](/cloud/concepts/glossary/#pause) explains what remains available. |

## Related

- [Serverless applications and servers](/cloud/concepts/serverless-applications-and-servers/) explains the choice of kind and an invited audience.
- [Ways to deploy](/cloud/getting-started/ways-to-deploy/) chooses a route your AI assistant can use.
- [Serve a web client](/cloud/guides/serve-a-web-client/) serves a site's files alongside its server code.
- [Manage versions and environments](/cloud/guides/manage-versions-and-environments/) covers promote, rollback, halt and deletion.
