# Basic site

> A minimal sitelo project and static deploy configs for Netlify, Vercel, Cloudflare, AWS, Azure, Firebase, GitLab Pages, Render, DigitalOcean, Railway, Fly.io, and Heroku.

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

- A one-page static site built with sitelo
- `netlify.toml`, `vercel.json`, `wrangler.jsonc`, `amplify.yml`, `cloudfront-function.js`, `staticwebapp.config.json`, `firebase.json`, `.gitlab-ci.yml`, `render.yaml`, `.do/app.yaml`, `Caddyfile`, `Dockerfile`, `fly.toml`, `heroku.yml`, and `nginx.conf`
- One-click / connect-repo deploy from the example folder

## Project layout

`project`

```bash
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
```

`src/index.ht.js — Template literal`

```javascript
export default () => `
  <html lang="en">
    <head>
      <title>sitelo — basic example</title>
      <link rel="stylesheet" href="/css/styles.css">
    </head>
    <body>
      <h1>Hello from sitelo</h1>
    </body>
  </html>
`
```

`src/index.ht.js — ht.js (recommended)`

```javascript
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')),
  )
```

`src/index.ht.jsx — JSX`

```jsx
export default function Home() {
  return (
    <html lang="en">
      <head>
        <title>sitelo — basic example</title>
        <link rel="stylesheet" href="/css/styles.css" />
      </head>
      <body>
        <h1>Hello from sitelo</h1>
      </body>
    </html>
  )
}
```

## Build

`shell`

```bash
npm install
npm run build
```

## Deploy

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

### Netlify

`netlify.toml`

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

### Vercel

`vercel.json`

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

[Deploy to Vercel](https://vercel.com/new/clone?repository-url=https://github.com/paul-browne/sitelo&root-directory=examples/basic&project-name=sitelo-basic) · [Deploy to Netlify](https://app.netlify.com/start/deploy?repository=https://github.com/paul-browne/sitelo) (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`.

`wrangler.jsonc`

```json
{
  "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.

`amplify.yml`

```yaml
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:

`cloudfront-function.js`

```javascript
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
}
```

`shell`

```bash
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.

`public/staticwebapp.config.json`

```json
{
  "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.

`firebase.json`

```json
{
  "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/`.

`.gitlab-ci.yml`

```yaml
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.

`render.yaml`

```yaml
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`.

`.do/app.yaml`

```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`.

`Caddyfile`

```caddyfile
:{$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`.

`Dockerfile`

```dockerfile
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
```

`.dockerignore`

```text
node_modules
dist
.git
```

`fly.toml`

```toml
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.

`heroku.yml`

```yaml
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.

`nginx.conf`

```nginx
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](https://sitelo.dev/docs/build-with-ai)) so tools don’t invent React/Next patterns.

[Getting started](https://sitelo.dev/docs) · [Build with AI](https://sitelo.dev/docs/build-with-ai) · [Todo app](https://sitelo.dev/examples/todo) · [Server islands example](https://sitelo.dev/examples/islands)
