Deploy a static site

View as Markdown

This tutorial takes a Vite single-page application and deploys it to Hyjal on the static lane. You end with a live HTTPS URL served by the platform’s static engine, with pre-compressed assets generated at deploy.

Time: about five minutes. You need the hyjal CLI installed and a logged-in session (hyjal login).

1. Create the site

Scaffold a Vite project. Any static output directory works; this tutorial uses Vite’s default dist.

$$ npm create vite@latest acme-web -- --template vanilla
$$ cd acme-web
$$ npm install

Build once locally to confirm the output directory:

$$ npm run build
$vite v5.4.0 building for production...
$ 14 modules transformed.
$dist/index.html 0.46 kB
$dist/assets/index-D9x2.css 1.20 kB
$dist/assets/index-8fA1.js 142.84 kB
$ built in 412ms

The build wrote dist/. That is what Hyjal deploys.

2. Initialize the manifest

Run hyjal init from the project root. It detects the Vite build and writes a starting hyjal.toml.

$$ hyjal init
$Detected: static site (build: npm run build, output: dist)
$Wrote hyjal.toml
$ project = acme
$ resource.web lane = static
$
$Review hyjal.toml, then run: hyjal deploy

Open the generated manifest. It declares one Project, acme, with one Resource, web, on the static lane:

1[project]
2name = "acme"
3
4[resource.web]
5lane = "static"
6build = "npm run build"
7output = "dist"

3. Enable SPA fallback

Vite’s router serves every route from index.html. Set spa = true so unknown paths rewrite to index.html instead of returning 404.

1[resource.web]
2lane = "static"
3build = "npm run build"
4output = "dist"
5spa = true

4. Deploy

Run hyjal deploy. The CLI runs your build, uploads the output to the Project’s Bucket, generates brotli and gzip variants, and flips the route atomically.

$$ hyjal deploy
$Building resource web (lane: static)...
$ npm run build
$ compressing assets (brotli, gzip) ✓
$Uploading artifact... digest sha256:1c9a4f…7be2
$Applying policy...
$Flipping route...
$
$Deployed acme/web
$ https://web--acme.hyjal.cloud

5. Open the live URL

$$ hyjal open web
$Opening https://web--acme.hyjal.cloud

The site is live. Because static assets carry no compile step, later asset-only redeploys are near-instant.

6. Confirm the request in the logs

Stream logs and reload the page. Each request row carries method, path, status, and latency.

$$ hyjal logs -f --resource web
$[14:02:11] GET / 200 9ms
$[14:02:11] GET /assets/index-D9x2.css 200 3ms
$[14:02:11] GET /assets/index-8fA1.js 200 5ms

Press Ctrl-C to stop. The same timeline appears in the Console Logs tab.

What you built

  • A Vite static site deployed to the web Resource on the static lane.
  • A live URL at https://web--acme.hyjal.cloud with SPA fallback and pre-compressed assets.
  • Request-correlated logs streaming to your terminal and the Console.

Next steps