Configuration
The Options struct and the public API.
Options
type Options struct {
// Root is the module directory to analyze. Defaults to ".".
Root string
// BasePath is the mount path for the UI. Defaults to "/graph".
BasePath string
// Editor is the click-to-source scheme: "vscode" or "cursor".
// Defaults to "vscode".
Editor string
// Extractors overrides the route extractors.
// Defaults to net/http + gin + echo + gRPC + GraphQL.
Extractors []Extractor
// Classify optionally extends layer-classification keywords.
Classify *classify.Config
// ShowPorts surfaces outbound hexagonal ports as nodes.
ShowPorts bool
// DetectBuses recovers command/query/event mediator routing.
DetectBuses bool
// DisableAutoLayer turns off chain-based inference (on by default).
DisableAutoLayer bool
// ShowHelpers keeps unexported free-function helpers as nodes.
ShowHelpers bool
}| Field | Default | Notes |
|---|---|---|
Root | "." | Directory of the module to analyze. |
BasePath | "/graph" | UI is served here; JSON at {BasePath}/data. |
Editor | "vscode" | "vscode" or "cursor". |
Extractors | net/http, gin, echo, gRPC, GraphQL | Replace to add a framework. See Frameworks. |
Classify | built-ins | Extend layer keywords. See Layer classification. |
ShowPorts | false | Surface outbound ports. See Ports. |
DetectBuses | false | Recover bus routing. See Buses. |
DisableAutoLayer | false | Auto-layer is on by default; set true for keyword-only. See Auto-layer. |
ShowHelpers | false | Keep trivial helper functions as nodes. |
API
av, err := archview.New(opts)
av.Handler() // http.Handler serving the UI + /data
av.Mount(mux) // registers BasePath and BasePath+"/" on a *http.ServeMux
av.Graph() // the analyzed graph.Graph (for tests / custom rendering)
av.Base() // normalized mount path, e.g. "/graph"Click-to-source
Every function node carries an absolute file:line:col, turned into a deep link:
vscode://file/<abs-path>:<line>:<col>
cursor://file/<abs-path>:<line>:<col>Set Editor to match your editor. JetBrains support is on the
roadmap.