Godoclive
GoDoc Live statically analyzes your Go HTTP services — extracts route definitions, request/response contracts, and authentication patterns — then generates beautiful, interactive API documentation.
Install / Use
/learn @syst3mctl/GodocliveREADME
<img src="assets/demo.gif" alt="GoDoc Live demo" width="800">
Your API docs are already in your code. GoDoc Live just reads them.
GoDoc Live uses
go/astandgo/types— the same packages the Go compiler uses — to walk your source, extract every route, parameter, request body, response type, and auth pattern, then generates an interactive docs site and OpenAPI 3.1.0 spec. No YAML to maintain. No annotations to add. No code to change.
Quickstart
go install github.com/syst3mctl/godoclive/cmd/godoclive@latest
godoclive generate ./...
open docs/index.html
Or serve with live reload — docs update as you save:
godoclive watch --serve :8080 ./...
Why GoDoc Live?
API docs written by hand drift. Someone adds a query param and forgets the spec. Someone changes a status code and the YAML still says 200. Six months later your docs and your code contradict each other.
GoDoc Live has no drift problem — it reads the source of truth directly.
| | GoDoc Live | Swagger annotations | Manual OpenAPI |
|---|---|---|---|
| Setup | go install | Add annotations to every handler | Write YAML by hand |
| Stays in sync | Always | Only if you update annotations | Only if you update YAML |
| Code changes required | None | Yes | No |
| Works on existing code | Yes | Partial | No |
What It Detects
| Feature | Description |
|---------|-------------|
| Routes | HTTP methods and path patterns from router registrations |
| Path Params | Type inference from name heuristics ({id} → uuid, {page} → integer) and handler body analysis |
| Query Params | Required/optional detection, default values from DefaultQuery |
| Request Body | Struct extraction from json.Decode / c.ShouldBindJSON with full field metadata |
| Responses | Status codes paired with response body types via branch-aware analysis |
| File Uploads | Multipart detection from r.FormFile / c.FormFile |
| Helper Tracing | One-level tracing through respond(), writeJSON(), sendError() wrappers |
| Auth Detection | JWT bearer, API key, and basic auth from middleware body scanning |
| Auto Naming | Summaries and tags inferred from handler names (GetUserByID → "Get User By ID") |
Supported Routers
| Router | Status | Features |
|--------|--------|----------|
| chi (go-chi/chi/v5) | Done | Route, Group, Mount, inline handlers |
| gin (gin-gonic/gin) | Done | Groups, Use chains, ShouldBindJSON |
| net/http (Go 1.22+ stdlib) | Done | "METHOD /path" patterns, r.PathValue(), http.Handler |
| gorilla/mux (gorilla/mux) | Done | HandleFunc().Methods(), PathPrefix().Subrouter(), mux.Vars(), regex params |
| echo (labstack/echo/v4) | Done | Groups, Use chains, c.Bind(), c.QueryParam(), c.JSON(), c.NoContent() |
| fiber (gofiber/fiber/v2) | Done | Groups, Use chains, c.BodyParser(), c.Query(), c.Params(), c.Status().JSON(), c.SendStatus() |
CLI Reference
godoclive generate [packages]
godoclive generate ./...
godoclive generate --output ./api-docs --theme dark ./...
godoclive generate --format single ./... # Single self-contained HTML (~300KB)
godoclive generate --serve :8080 ./... # Generate + serve
godoclive generate --openapi ./openapi.json ./... # Also emit OpenAPI 3.1.0 spec
| Flag | Default | Description |
|------|---------|-------------|
| --output | ./docs | Output directory |
| --format | folder | folder (separate files) or single (one self-contained HTML) |
| --title | auto | Project title displayed in docs |
| --base-url | — | Pre-fill base URL in Try It |
| --theme | light | light or dark |
| --serve | — | Start HTTP server after generation (e.g., :8080) |
| --openapi | — | Also generate an OpenAPI 3.1.0 spec at the given path (.json or .yaml) |
godoclive analyze [packages]
Run analysis and print a contract summary to stdout.
godoclive analyze ./...
godoclive analyze --json ./... # Machine-readable output
godoclive analyze --verbose ./... # Show unresolved details
| Flag | Default | Description |
|------|---------|-------------|
| --json | false | Output as machine-readable JSON |
| --verbose | false | Show full unresolved list per endpoint |
godoclive openapi [packages]
Generate an OpenAPI 3.1.0 specification without the HTML docs.
godoclive openapi ./... # Outputs ./openapi.json
godoclive openapi --output ./api.yaml ./... # YAML format (inferred from extension)
godoclive openapi --server https://api.example.com ./...
| Flag | Default | Description |
|------|---------|-------------|
| --output | ./openapi.json | Output file path (.json or .yaml) |
| --format | auto | json or yaml — inferred from file extension if omitted |
| --title | auto | API title in the spec info block |
| --server | — | Server URL to include in the servers array |
godoclive watch [packages]
Watch for .go file changes and regenerate docs automatically. Supports the same flags as generate.
godoclive watch --serve :8080 ./...
When --serve is set, the browser auto-reloads via Server-Sent Events — edit your code, save, see updated docs instantly.
godoclive validate [packages]
Report analysis coverage — what percentage of endpoints are fully resolved.
godoclive validate ./...
godoclive validate --json ./...
| Flag | Default | Description |
|------|---------|-------------|
| --json | false | Output as JSON |
| --verbose | false | Show full unresolved list per endpoint |
Configuration
.env file
Create a .env file in your project root to set the API base URL for the Try It panel:
API_URL="http://localhost:8080"
Precedence: --base-url CLI flag > .env API_URL > .godoclive.yaml base_url > default.
.godoclive.yaml
Create an optional .godoclive.yaml in your project root:
# Project metadata
title: "My API"
version: "v2.1.0"
base_url: "https://api.example.com"
theme: "dark"
# Exclude endpoints from documentation
exclude:
- "GET /internal/*"
- "* /debug/*"
# Override or supplement analysis results
overrides:
- path: "POST /users"
summary: "Register a new user account"
tags: ["accounts"]
responses:
- status: 409
description: "Email already registered"
- status: 503
description: "Service temporarily unavailable"
# Auth configuration
auth:
header: "Authorization"
scheme: "bearer"
# OpenAPI 3.1.0 spec metadata
openapi:
description: "Full description of the API."
contact:
name: "API Support"
url: "https://example.com/support"
email: "support@example.com"
license:
name: "MIT"
url: "https://opensource.org/licenses/MIT"
servers:
- url: "https://api.example.com"
description: "Production"
- url: "https://staging.example.com"
description: "Staging"
Zero configuration is always valid — the tool produces useful output without any config file.
How It Works
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
│ 1. Load │──▶│2. Detect │──▶│3. Extract│──▶│4. Resolve│
│ go/pkgs │ │ chi/gin │ │ routes │ │ handlers │
└──────────┘ └──────────┘ └──────────┘ └──────────┘
│
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────▼────┐
│8.Generate│◀──│ 7. Auth │◀──│ 6. Map │◀──│5.Contract│
│ HTML/CSS │ │ middleware│ │ structs │ │params/body│
└──────────┘ └──────────┘ └──────────┘ └──────────┘
- Load — Uses
go/packagesto load and type-check your Go source code - Detect — Identifies the router framework (chi, gin, gorilla/mux, echo, fiber, or stdlib) from imports
- Extract — Walks
main()andinit()AST to find route registrations - Resolve — Resolves handler expressions to function declarations
- Contract — Extracts path params, query params, headers, body, and responses from handler ASTs
- Map — Converts
types.Typeinto recursiveTypeDefwith JSON tags, examples, and field metadata - Auth — Scans middleware function bodies for authentication patterns
- Generate — Transforms endpoint contracts into an interactive HTML documentation site
All analysis uses
go/astandgo/types— no runtime reflection, no annotations, no code generation.
Programmatic API
Use GoDoc Live as a library in your own tools:
import "github.com/syst3mctl/godoclive"
// Analyze a project
en
Related Skills
node-connect
341.6kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
341.6kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
prose
341.6kOpenProse VM skill pack. Activate on any `prose` command, .prose files, or OpenProse mentions; orchestrates multi-agent workflows.
frontend-design
84.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
