<what>
title: "Step 10 — Deploy"
active_step: 10
</what>
<h1 class="text-3xl font-bold mb-2" style="color: #111827; letter-spacing: -0.02em;">Step 10 — Deploy</h1>
<p class="text-gray-500 text-sm mb-8">Ship to production. Static build, compiled binary, or Docker.</p>
<section class="mb-8">
<h2 class="text-lg font-semibold mb-3" style="color: #111827;">Option 1 — Static build</h2>
<p class="text-gray-600 mb-3" style="line-height: 1.7;">
For sites without sessions or auth, build a fully static output. Every page is pre-rendered to HTML. Deploy to any CDN: Cloudflare Pages, Netlify, Vercel, S3.
</p>
<pre class="bg-gray-50 p-4 rounded text-sm font-mono" style="border: 1px solid #e5e7eb; overflow-x: auto;"><code>run-what build --path . --output dist</code></pre>
<p class="text-sm text-gray-500 mt-2">
Output is in <code>dist/</code>. All assets are fingerprinted. Upload the directory to your CDN.
</p>
</section>
<section class="mb-8">
<h2 class="text-lg font-semibold mb-3" style="color: #111827;">Option 2 — Compiled binary</h2>
<p class="text-gray-600 mb-3" style="line-height: 1.7;">
For apps with sessions, database, or auth — compile a single binary. Copy it to any Linux server. No runtime dependencies.
</p>
<pre class="bg-gray-50 p-4 rounded text-sm font-mono" style="border: 1px solid #e5e7eb; overflow-x: auto;"><code># Build the binary
cargo build --release --bin run-what
# Copy binary + project to your server
scp target/release/run-what user@server:/app/
scp -r site/ components/ wwwhat.toml user@server:/app/
# Run it
./run-what dev --path /app --port 8085</code></pre>
</section>
<section class="mb-8">
<h2 class="text-lg font-semibold mb-3" style="color: #111827;">Option 3 — Docker</h2>
<pre class="bg-gray-50 p-4 rounded text-sm font-mono" style="border: 1px solid #e5e7eb; overflow-x: auto;"><code>FROM rust:1.75-slim AS builder
WORKDIR /app
COPY . .
RUN cargo build --release --bin run-what
FROM debian:bookworm-slim
WORKDIR /app
COPY --from=builder /app/target/release/run-what .
COPY site/ site/
COPY components/ components/
COPY wwwhat.toml .
EXPOSE 8085
CMD ["./run-what", "dev", "--path", ".", "--port", "8085"]</code></pre>
</section>
<section class="mb-8">
<h2 class="text-lg font-semibold mb-3" style="color: #111827;">Production databases</h2>
<p class="text-gray-600 mb-3" style="line-height: 1.7;">
SQLite works well for single-server deployments. For scale-out or serverless, switch to Cloudflare D1 or Supabase — same <code>local:</code> query syntax, no code changes.
</p>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;">
<div class="card">
<div class="card-body">
<div class="font-semibold text-sm mb-2">Cloudflare D1</div>
<pre class="bg-gray-50 p-3 rounded text-xs font-mono" style="border: 1px solid #e5e7eb; margin: 0; overflow-x: auto;"><code>[database]
type = "d1"
account_id = "..."
database_id = "..."
api_token = "..."</code></pre>
<p class="text-xs text-gray-500 mt-2">Free tier. Serverless SQLite at the edge.</p>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="font-semibold text-sm mb-2">Supabase</div>
<pre class="bg-gray-50 p-3 rounded text-xs font-mono" style="border: 1px solid #e5e7eb; margin: 0; overflow-x: auto;"><code>[database]
type = "supabase"
url = "https://xyz.supabase.co"
anon_key = "..."</code></pre>
<p class="text-xs text-gray-500 mt-2">Postgres via PostgREST API. Free tier.</p>
</div>
</div>
</div>
</section>
<section class="mb-8">
<h2 class="text-lg font-semibold mb-3" style="color: #111827;">Deployment via CLI</h2>
<pre class="bg-gray-50 p-4 rounded text-sm font-mono" style="border: 1px solid #e5e7eb; overflow-x: auto;"><code># Build a static deployment
run-what deploy --target static --output dist
# Generate sitemap.xml
run-what sitemap --host https://yoursite.com
# Run project health checks
run-what doctor</code></pre>
</section>
<div class="card mb-6" style="border-color: #c7d2fe; background: #eef2ff;">
<div class="card-body">
<div class="text-lg font-bold mb-2" style="color: #3730a3;">You made it. Tutorial complete.</div>
<p class="text-sm mb-3" style="color: #4338ca; line-height: 1.7;">
You now know how to build full-stack apps with nothing but HTML. Routing, components, layouts, sessions, database CRUD, form validation, authentication, and deployment — all without writing a line of JavaScript or backend code.
</p>
<div class="flex gap-3" style="flex-wrap: wrap;">
<a href="https://getwhatnow.com" target="_blank" class="btn btn-primary btn-sm">
Read the full docs →
</a>
<a href="/" class="btn btn-outline btn-sm">
Start over
</a>
</div>
</div>
</div>
<div class="card" style="border-color: #bbf7d0; background: #f0fdf4;">
<div class="card-body">
<div class="text-sm font-semibold mb-2" style="color: #14532d;">What you learned</div>
<ul class="text-sm space-y-1" style="color: #166534; padding-left: 1.25rem; list-style: disc;">
<li><code>run-what build</code> generates a static site — deploy to any CDN</li>
<li>Single compiled binary — copy to any Linux server, no runtime needed</li>
<li>Docker build with multi-stage Dockerfile keeps image size small</li>
<li>Switch databases with a <code>wwwhat.toml</code> config change — no code changes</li>
<li>D1 (Cloudflare) and Supabase are both supported as production backends</li>
</ul>
</div>
</div>