
The highest tagged major version is
v2.
directory
Version:
v0.33.1
Opens a new window with list of versions in this module.
Published: May 18, 2026
License: MIT
Opens a new window with license information.
README
¶
HyperServe examples
Each subdirectory is a self-contained main package. Run with go run ./examples/<name>.
Getting started
| Example |
What it shows |
| hello-world |
The smallest possible server — one route, default options. |
| static-files |
Serving HTML/CSS/JS with security headers. |
| json-api |
REST API: CRUD over an in-memory TODO list with request parsing and error handling. |
| middleware-basics |
Building a middleware stack (logging, rate limiting, CORS) step by step. |
| configuration |
Env vars, JSON config files, programmatic With* options, and their precedence. |
| binding |
BindJSON/BindQuery/BindForm + struct-tag validation, with structured 400 responses. |
HTMX / templating
| Example |
What it shows |
| htmx-dynamic |
Server-rendered templates with HTMX-driven partial updates. |
| htmx-stream |
Live HTMX updates over Server-Sent Events. |
Auth & enterprise
| Example |
What it shows |
| auth |
JWT (RS256), API keys, Basic auth, per-token rate limiting, RBAC. |
| enterprise |
FIPS-approved TLS cipher suites + post-quantum key exchange. Generate certs first (./generate_certs.sh). |
MCP (Model Context Protocol)
| Example |
What it shows |
| mcp-basic |
Smallest MCP server: enable, expose built-in tools/resources. |
| mcp-cli |
Command-line MCP client hitting an MCP server over HTTP. |
| mcp-sse |
The unified /mcp endpoint serving both regular HTTP and SSE. |
| mcp-stdio |
MCP over stdio for embedding in editors / process-supervised hosts. |
| mcp-discovery |
/.well-known/mcp.json discovery with policy filtering. |
| mcp-extensions |
Custom MCP tools and resources beyond the built-ins. |
Operations / lifecycle
| Example |
What it shows |
| deferred-init |
WithDeferredInit + WithOnReady — serve /healthz while bootstrap runs. |
| devops |
Health endpoints + metrics + graceful shutdown wired together. |
| best-practices |
Idiomatic patterns: error handling, logging, structured config. |
| complete |
Multiple features in one binary, useful as a reference implementation. |
WebSocket / browser
| Example |
What it shows |
| websocket-demo |
RFC 6455 upgrade + echo handler + minimal browser client. |
| web-worker-csp |
WithCSPWebWorkerSupport() for blob:-URL Web Workers (Tone.js, PDF.js, etc.). |
Running
go run ./examples/hello-world
Most examples listen on :8080. The enterprise example uses :8443 for HTTPS and
requires generated certs.
Test a running example with curl:
curl http://localhost:8080/
Directories
¶
Package main demonstrates best practices for using serverpkg.
|
Package main demonstrates best practices for using serverpkg. |
Example: request binding + validation, three ways.
|
Example: request binding + validation, three ways. |
|
|
|
|
|
|
|
|
Deferred-init example. |
Example demonstrating DevOps features: debug logging and MCP resources
|
Example demonstrating DevOps features: debug logging and MCP resources |
Enterprise example demonstrating FIPS 140-3 compliance and enhanced security features
|
Enterprise example demonstrating FIPS 140-3 compliance and enhanced security features |
|
|
|
|
|
|
|
|
|
|
|
|
Package main demonstrates MCP with Server-Sent Events (SSE) support.
|
Package main demonstrates MCP with Server-Sent Events (SSE) support. |
Example: Using command-line flags to configure MCP
|
Example: Using command-line flags to configure MCP |
|
|
|
Example: typed MCP tools — one tool per verb.
|
Example: typed MCP tools — one tool per verb. |
|
|
Example: MCP over SSE. |
Package main demonstrates hyperserve's MCP support as a stdio server for Claude Desktop.
|
Package main demonstrates hyperserve's MCP support as a stdio server for Claude Desktop. |
|
|
|
|
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.