Skip to content

Static Sites

Deploy static HTML/CSS/JS sites without containers. Caddy serves them directly for maximum performance.

What's a Static Site?

Static sites are pre-built HTML, CSS, and JavaScript files that don't require server-side processing. Examples:

  • Landing pages
  • Documentation sites
  • SPAs (React, Vue, Svelte builds)
  • Blogs built with static generators (Hugo, Astro, etc.)

Quick Deploy

bash
# Build your site
npm run build

# Initialize
cd mysite
bp init
# Select: Static site
# Public dir: dist/

# Deploy
git add . && git commit -m "Deploy"
bp deploy

Configuration

Your basepod.yaml for a static site:

yaml
name: mysite
type: static
public: dist/
domain: mysite.example.com

Common Public Directories

FrameworkPublic Directory
Vitedist/
Nuxt (SSG).output/public/
Next.js (export)out/
Astrodist/
Hugopublic/
Jekyll_site/

How It Works

  1. bp deploy uploads your public directory
  2. Server stores files at /data/apps/{name}/public
  3. Caddy serves files directly (no container)
  4. Automatic HTTPS via Let's Encrypt

Benefits

  • Fast - No container overhead
  • Efficient - Low memory usage
  • Simple - No Dockerfile needed
  • Instant - Deploy in seconds

Example: Nuxt SSG

bash
# Generate static site
nuxt generate

# Initialize
bp init
# App name: mysite
# Type: Static site
# Public dir: .output/public

# Deploy
git add .
git commit -m "Initial deploy"
bp deploy

Example: Vite/React

bash
# Build
npm run build

# Initialize
bp init
# Type: Static site
# Public dir: dist

# Deploy
git add . && git commit -m "Deploy"
bp deploy

SPA Routing

For single-page apps with client-side routing, Caddy automatically handles fallback to index.html for 404s.

Custom Headers

Need custom headers? Create a _headers file in your public directory:

/*
  X-Frame-Options: DENY
  X-Content-Type-Options: nosniff

/assets/*
  Cache-Control: public, max-age=31536000

Released under the MIT License.