O
OmniStack
ComponentsDocsPricing
YouTubeLinkedInWebsiteGitHubGet Started
IntroductionQuick StartInstallation
AuthenticationPaymentsUI ComponentsMediaFormsE-Commerce
Next.jsExpoGo
Back

Gin Docs

Zero-annotation API documentation generator for Go applications using Gin and GORM. Automatically introspects your router tree, reads struct tags via reflection, generates a full OpenAPI 3.1 spec, and serves interactive Swagger UI or Scalar documentation — all with a single gindocs.Mount() call. Supports GORM model variants (Create/Update schemas), fluent route overrides, Postman/Insomnia export, and JWT/API key auth in the Try It panel.

GoDocumentation
View Full Documentation

What's Included

Zero-Annotation Doc Generation
OpenAPI 3.1 Spec (JSON & YAML)
Swagger UI & Scalar UI
GORM Model Variants (Create/Update)
Smart Inference (Summaries, Status Codes, Examples)
Fluent Route Override API
Group Overrides (Tags, Security)
Inline Doc Middleware
Postman & Insomnia Export
Auth Support (Bearer, API Key, Basic)
Custom Sections (Markdown)
11 Scalar Themes

Installation

terminal
$ go get github.com/MUKE-coder/gin-docs

How to Use

1

Install the package

Add Gin Docs to your Go project.

go get github.com/MUKE-coder/gin-docs
2

Mount with one line

Pass your Gin router and optional GORM database to auto-generate docs from your existing routes and models.

import "github.com/MUKE-coder/gin-docs/gindocs"

r := gin.Default()

// Define your routes as usual
r.GET("/api/users", listUsersHandler)
r.POST("/api/users", createUserHandler)

// One line to generate docs
gindocs.Mount(r, db)
r.Run(":8080")
3

Open the documentation

Navigate to /docs in your browser for interactive API documentation. Switch between Swagger UI and Scalar via query parameter.

# Open http://localhost:8080/docs
# Swagger UI: http://localhost:8080/docs?ui=swagger
# Scalar UI:  http://localhost:8080/docs?ui=scalar
# OpenAPI spec: http://localhost:8080/docs/openapi.json
4

Customize with config & overrides

Add metadata, register GORM models for auto-generated schemas, configure auth, and override specific route docs with a fluent API.

docs := gindocs.Mount(r, db, gindocs.Config{
    Title:   "My API",
    Version: "1.0.0",
    UI:      gindocs.UIScalar,
    Auth:    gindocs.AuthConfig{
        Type:         gindocs.AuthBearer,
        BearerFormat: "JWT",
    },
    Models: []interface{}{User{}, Post{}},
})

docs.Route("POST /api/users").
    Summary("Register a new user").
    RequestBody(CreateUserInput{}).
    Response(201, User{}, "User created")
Free
Open source component

Free to use · MIT License

CategoryDocumentation
PlatformsGo
Features12
Resources
Component DocsOmniStack Docs