hyperserver

module
v0.0.0-...-f70ecf6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: MIT

README

HyperServer

HyperServer is an experimental Go framework for server-rendered applications with HTMX. It uses standard net/http handlers and html/template, with shared startup, middleware, rendering, and shutdown.

Inspired by Pagoda, HyperServer is a reusable library rather than a starter repository. It requires no ORM. Applications choose optional authentication, session, storage, and mail services.

Public APIs can change during v0.x. HyperServer is not production-ready. Pin a revision and test upgrades. See compatibility and security reporting.

Hyper Gopher

Get started

Use the Go version in go.mod. Stateless applications can build without CGO. SQLite and race tests require CGO and a C compiler. Browser integration targets HTMX 4.

  • Build an application with the standalone quickstart, then read application setup for modules, services, and cleanup.
  • Run the included Markdown blog using its setup guide. It supports posts, nested pages, media, search, RSS, and Admin and Poster roles.

Guides

Topic Guide
Configuration Files, environment overrides, signing keys, and email
Rendering Prepared views, composition, HTMX, and forms
HTTP TLS, proxies, middleware, body limits, and rate limits
Storage Providers, contracts, SQLite migrations, and cleanup
Sessions Reading, saving, rotation, and serialization
Google login Configuration and account linking
Images Processing example
Verification Tests and performance checks
Deployment Local container rehearsal and recovery
Direction Roadmap and remaining work

The framework, blog, and maintenance commands share one Go module. Run go test ./... and go vet ./... from the repository root. See testing for race, browser, and migration checks. Coding agents must follow AGENTS.md.

Feedback and license

Email design feedback to trentnix@gmail.com. HyperServer uses the MIT License, copyright Trent Nix. Third-party components retain their own licenses.

Directories

Path Synopsis
Package auth coordinates authentication providers and their HTTP handlers.
Package auth coordinates authentication providers and their HTTP handlers.
identity
Package identity connects accounts to authenticated browser sessions.
Package identity connects accounts to authenticated browser sessions.
middleware
Package middleware loads authenticated users and guards routes using account and session services.
Package middleware loads authenticated users and guards routes using account and session services.
modules/email
Package auth implements the email/password authentication provider.
Package auth implements the email/password authentication provider.
modules/google
Package google implements server-side Google OpenID Connect authentication.
Package google implements server-side Google OpenID Connect authentication.
password
Package password hashes passwords with bcrypt and checks password complexity.
Package password hashes passwords with bcrypt and checks password complexity.
cmd
blog-maintenance command
Command blog-maintenance creates and verifies archives offline.
Command blog-maintenance creates and verifies archives offline.
cleanup command
Command cleanup removes one bounded batch of expired sessions and account tokens from configured storage.
Command cleanup removes one bounded batch of expired sessions and account tokens from configured storage.
optimize-images command
Command optimize-images regenerates blog image copies while the server is stopped.
Command optimize-images regenerates blog image copies while the server is stopped.
web command
Command web runs the blog configured by config.yaml and modules/blog/config.yaml.
Command web runs the blog configured by config.yaml and modules/blog/config.yaml.
Package config loads and validates HyperServer configuration.
Package config loads and validates HyperServer configuration.
internal
backup
Package backup creates ordinary ZIP archives for offline blog recovery.
Package backup creates ordinary ZIP archives for offline blog recovery.
maintenance
Package maintenance coordinates the blog server and offline maintenance.
Package maintenance coordinates the blog server and offline maintenance.
opaquetoken
Package opaquetoken creates versioned, URL-safe bearer tokens.
Package opaquetoken creates versioned, URL-safe bearer tokens.
test/authpages
Package authpages supplies site-owned routes for authentication integration tests.
Package authpages supplies site-owned routes for authentication integration tests.
test/perfcheck command
Command perfcheck checks repeated Go benchmark results against explicit budgets.
Command perfcheck checks repeated Go benchmark results against explicit budgets.
test/tlstest
Package tlstest creates temporary TLS credentials for server integration tests.
Package tlstest creates temporary TLS credentials for server integration tests.
modules
blog
Package blog provides a Markdown blog with role-based publishing.
Package blog provides a Markdown blog with role-based publishing.
pkg
application
Package application assembles configured services and modules around the core server.
Package application assembles configured services and modules around the core server.
components/content
Package content combines page data and templates into full-page or HTMX responses.
Package content combines page data and templates into full-page or HTMX responses.
components/form
Package form binds HTTP input and records field and form-level validation errors.
Package form binds HTTP input and records field and form-level validation errors.
components/htmx
Package htmx reads HTMX request headers, writes HTMX response headers, and serves optional browser error handling.
Package htmx reads HTMX request headers, writes HTMX response headers, and serves optional browser error handling.
components/messages
Package messages defines message values used by forms and templates.
Package messages defines message values used by forms and templates.
components/types
Package types defines template paths shared by rendering components and services.
Package types defines template paths shared by rendering components and services.
database
Package database opens SQL connection pools and resolves connection paths.
Package database opens SQL connection pools and resolves connection paths.
database/sqlite
Package sqlite opens SQLite pools with the built-in providers' connection policy.
Package sqlite opens SQLite pools with the built-in providers' connection policy.
errors
Package errors defines the common error wrapper used by HyperServer packages.
Package errors defines the common error wrapper used by HyperServer packages.
handlers
Package handlers catalogs module factories.
Package handlers catalogs module factories.
health
Package health supplies HTTP probes with application-selected readiness checks.
Package health supplies HTTP probes with application-selected readiness checks.
imaging
Package imaging prepares bounded JPEG, PNG, and GIF uploads without storage or HTTP dependencies.
Package imaging prepares bounded JPEG, PNG, and GIF uploads without storage or HTTP dependencies.
ratelimit
Package ratelimit provides bounded, per-client HTTP request budgets.
Package ratelimit provides bounded, per-client HTTP request budgets.
requestinfo
Package requestinfo reports client addresses and HTTPS state without replacing net/http's connection metadata.
Package requestinfo reports client addresses and HTTPS state without replacing net/http's connection metadata.
routing
Package routing registers ordinary net/http handlers with body and rate policies.
Package routing registers ordinary net/http handlers with body and rate policies.
server
Package server assembles routing, rendering, and application-owned services.
Package server assembles routing, rendering, and application-owned services.
services/configured
Package configured supplies built-in account and session providers for configuration-driven setup.
Package configured supplies built-in account and session providers for configuration-driven setup.
services/content
Package content configures shared templates and response handlers for rendering.
Package content configures shared templates and response handlers for rendering.
services/flash
Package flash stores categorized flash messages, notifications, and browser console messages in sessions.
Package flash stores categorized flash messages, notifications, and browser console messages in sessions.
services/logger
Package logger attaches standard slog loggers to request contexts and logs errors.
Package logger attaches standard slog loggers to request contexts and logs errors.
services/messaging
Package messaging composes HTML email and sends it through a replaceable MailSender.
Package messaging composes HTML email and sends it through a replaceable MailSender.
services/messaging/smtp
Package smtp supplies a context-aware SMTP mail sender.
Package smtp supplies a context-aware SMTP mail sender.
services/middleware
Package middleware composes net/http handlers for logging, browser security, and application-defined authorization without loading identity or sessions.
Package middleware composes net/http handlers for logging, browser security, and application-defined authorization without loading identity or sessions.
services/session
Package session manages named sessions through application-supplied stores.
Package session manages named sessions through application-supplied stores.
services/session/cookie
Package cookie stores session data in signed browser cookies.
Package cookie stores session data in signed browser cookies.
services/session/internal/sessioncookie
Package sessioncookie implements the signed-cookie format shared by session providers.
Package sessioncookie implements the signed-cookie format shared by session providers.
services/session/sessiontest
Package sessiontest checks common and revocable session-storage contracts.
Package sessiontest checks common and revocable session-storage contracts.
services/session/sqlite
Package sqlite provides SQLite-backed sessions with opaque bearer cookies.
Package sqlite provides SQLite-backed sessions with opaque bearer cookies.
services/user
Package user defines accounts, account tokens, and their persistence contract.
Package user defines accounts, account tokens, and their persistence contract.
services/user/accounttest
Package accounttest checks account storage through its consumer contract.
Package accounttest checks account storage through its consumer contract.
services/user/sqlite
Package sqlite provides account and token storage using a borrowed SQLite pool.
Package sqlite provides account and token storage using a borrowed SQLite pool.
util
Package util provides URL, template-file, and HTTP response helpers.
Package util provides URL, template-file, and HTTP response helpers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL