Docs/Tooling & Production/Deployment & SSG

Production Deployment & SSG

Deploy GoKS anywhere: as a single self-contained binary, a lightweight Docker container, or 100% static HTML on a CDN.

GoKS offers unprecedented deployment flexibility compared to traditional Node.js/JS stacks. You can run it as an ultra-fast dynamic server or pre-render 100% static HTML with zero server running costs.

Strategy 1: Single Standalone Binary

Similar to Next.jsoutput: standalone, GoKS bundles the Go HTTP server, compiled WebAssembly client, Tailwind CSS, and embedded static assets into a single executable:

Terminal
bash
goks build --standalone
./.goks/build/server 8080

Strategy 2: Lightweight Docker Container

Because GoKS compiles into a native static binary without Node.js or npm dependencies, your final production Docker image is tiny (typically < 25 MB):

Dockerfile
dockerfile
FROM golang:1.26-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go install github.com/misbakhul29/goks@latest
RUN goks build --standalone

FROM alpine:latest
WORKDIR /app
COPY --from=builder /app/.goks/build/server /app/server
EXPOSE 8080
CMD ["/app/server", "8080"]

Strategy 3: Static Site Export (SSG)

If your site does not require dynamic database mutations or server-side actions, export all routes as static HTML files:

Terminal
bash
goks export

The resultingout/directory can be uploaded directly to Cloudflare Pages, Netlify, Vercel, or GitHub Pages.

TinyGo WASM Compilation

For edge deployments or bandwidth-sensitive mobile users, compile client WebAssembly with TinyGo to reduce bundle sizes below 300KB:

goks build --standalone --compiler=tinygo
Powered byGoKS WASM16 topics