Basic site

The smallest useful sitelo site: one page, one stylesheet, and host configs that publish dist/. Copy the configs into any sitelo project — they only assume npm run build → dist/.

A runnable copy lives in the sitelo repo under examples/basic/.

What you get

Project layout

my-site/
  sitelo.config.js
  netlify.toml           # Netlify
  vercel.json            # Vercel
  wrangler.jsonc         # Cloudflare Workers
  amplify.yml            # AWS Amplify
  cloudfront-function.js # AWS S3 + CloudFront
  firebase.json          # Firebase Hosting
  .gitlab-ci.yml         # GitLab Pages
  render.yaml            # Render
  .do/app.yaml           # DigitalOcean App Platform
  Caddyfile              # Railway, Fly.io, Heroku, Cloud Run
  Dockerfile             # Railway, Fly.io, Heroku, Cloud Run
  .dockerignore          # Railway, Fly.io, Heroku, Cloud Run
  fly.toml               # Fly.io
  heroku.yml             # Heroku
  nginx.conf             # Your own server
  package.json
  public/
    staticwebapp.config.json  # Azure Static Web Apps
  src/
    index.ht.js
    css/
      styles.css
import { html, head, title, link, body, h1 } from 'javascript-to-html'

export default () =>
  html({ lang: 'en' },
    head(
      title('sitelo — basic example'),
      link({ rel: 'stylesheet', href: '/styles.css' }),
    ),
    body(h1('Hello from sitelo')),
  )

Build

npm install
npm run build

Deploy

From the sitelo monorepo, set the platform’s root/base directory to examples/basic.

Netlify

[build]
  command = "npm run build"
  publish = "dist"

Vercel

{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "framework": null,
  "buildCommand": "npm run build",
  "outputDirectory": "dist",
  "installCommand": "npm install"
}

Deploy to Vercel · Deploy to Netlify (set base directory to examples/basic when prompted).

Cloudflare

Cloudflare now points new projects at Workers. npx wrangler deploy builds and uploads dist/, or connect the repo in the Cloudflare dashboard. On Pages instead, use build command npm run build and output directory dist.

{
  "name": "sitelo-basic",
  "compatibility_date": "2026-10-01",
  "build": {
    "command": "npm run build"
  },
  "assets": {
    "directory": "./dist",
    "not_found_handling": "404-page",
    "html_handling": "drop-trailing-slash"
  }
}

AWS Amplify

Connect the repo in Amplify Hosting.

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm install
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: dist
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

AWS S3 + CloudFront

Attach cloudfront-function.js to the distribution’s viewer requests, and add custom error responses for 403 and 404 that return /404.html with status 404. Then upload each build:

function handler(event) {
  var request = event.request
  var uri = request.uri

  if (uri.endsWith('/')) {
    request.uri += 'index.html'
  } else if (uri.slice(uri.lastIndexOf('/') + 1).indexOf('.') === -1) {
    request.uri += '/index.html'
  }

  return request
}
npm run build
aws s3 sync dist/ s3://my-bucket --delete
aws cloudfront create-invalidation --distribution-id MY_DISTRIBUTION_ID --paths "/*"

Azure Static Web Apps

Create the Static Web App with app location / and output location dist. sitelo copies public/staticwebapp.config.json into dist/, where Azure picks it up and serves 404.html for unknown URLs.

{
  "responseOverrides": {
    "404": {
      "rewrite": "/404.html"
    }
  }
}

Google Cloud

Firebase Hosting: pick a project with firebase use --add, then firebase deploy builds and uploads. For Cloud Run, gcloud run deploy --source . builds the Dockerfile below.

{
  "hosting": {
    "public": "dist",
    "predeploy": "npm run build",
    "trailingSlash": false
  }
}

GitLab Pages

Copy .gitlab-ci.yml to the root of a GitLab repository; the job builds and publishes dist/.

deploy-pages:
  image: node:24
  script:
    - npm ci
    - npm run build
  pages:
    publish: dist
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

Render

Add render.yaml and create a Blueprint from it, or set the same build command and publish directory on a new static site. Clean URLs and 404.html work with no rules.

services:
  - type: web
    name: sitelo-basic
    runtime: static
    buildCommand: npm install && npm run build
    staticPublishPath: ./dist

DigitalOcean App Platform

Set github.repo to your repository, then run doctl apps create --spec .do/app.yaml.

name: sitelo-basic
static_sites:
  - name: site
    github:
      repo: your-name/your-site
      branch: main
      deploy_on_push: true
    build_command: npm run build
    output_dir: dist

Railway

Railway builds the Dockerfile (see Fly.io below), so there’s nothing to set. In a project without one, add the service variable RAILPACK_SPA_OUTPUT_DIR=dist instead: Railpack then serves dist/ through the Caddyfile, which answers unknown URLs with 404.html.

:{$PORT:80} {
  root * /app/dist
  encode zstd gzip
  try_files {path} {path}/index.html
  file_server
  handle_errors {
    rewrite * /{err.status_code}.html
    file_server
  }
}

Fly.io

The Dockerfile builds with Node and serves dist/ with Caddy. Run fly launch to create the app, then fly deploy.

FROM node:24-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM caddy:2-alpine
COPY Caddyfile /etc/caddy/Caddyfile
COPY --from=build /app/dist /app/dist
node_modules
dist
.git
app = "sitelo-basic"

[http_service]
  internal_port = 80
  force_https = true
  auto_stop_machines = "stop"
  auto_start_machines = true
  min_machines_running = 0

Heroku

Run heroku stack:set container once, then git push heroku main: Heroku builds the Dockerfile and sets PORT for Caddy.

build:
  docker:
    web: Dockerfile

Your own server

Copy the build to the server with rsync -a --delete dist/ you@server:/var/www/my-site/ and serve it with nginx.conf — or with the Caddyfile above, swapping :{$PORT:80} for your domain and /app/dist for the directory.

server {
  listen 80;
  server_name example.com;
  root /var/www/my-site;

  location / {
    try_files $uri $uri/index.html =404;
  }

  error_page 404 /404.html;
}

Render, Railway, Fly.io, Heroku, and Cloud Run only see the folder they deploy, so the example’s file:../.. link to sitelo won’t resolve there — deploy a copy that installs sitelo from npm.

Working with Cursor, Copilot, or another agent? Copy AGENTS.md from this example (or see Build with AI) so tools don’t invent React/Next patterns.

Getting started · Build with AI · Todo app · Server islands example