Docs / Get Started
v1.0.2Latest / April 2026

Quick Start

Build a small HTTP server with Gun.

Create a server

Create server.ts:

import { createServer } from 'http'

const port = Number(process.env.PORT ?? 8080)

createServer((req, res) => {
  res.writeHead(200, { 'content-type': 'text/plain' })
  res.end(`hello from ${req.url}\n`)
}).listen(port)

console.log(`listening on :${port}`)

Check compatibility

gun check server.ts

Fix check errors before building. They usually point to unsupported APIs, dynamic imports, or dependency behavior that needs an adapter.

Build with Gun

gun transpile server.ts -o build/gun

Use the same pattern for a project entrypoint:

gun transpile src/index.ts -o build/gun

Run locally

go run ./build/gun

For a faster edit loop, keep watch mode running:

gun watch server.ts -o build/gun

Build a binary

go build -o app ./build/gun
./app

The binary is the deployable artifact. Build it from a clean checkout in CI for release.