archview

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
}
FieldDefaultNotes
Root"."Directory of the module to analyze.
BasePath"/graph"UI is served here; JSON at {BasePath}/data.
Editor"vscode""vscode" or "cursor".
Extractorsnet/http, gin, echo, gRPC, GraphQLReplace to add a framework. See Frameworks.
Classifybuilt-insExtend layer keywords. See Layer classification.
ShowPortsfalseSurface outbound ports. See Ports.
DetectBusesfalseRecover bus routing. See Buses.
DisableAutoLayerfalseAuto-layer is on by default; set true for keyword-only. See Auto-layer.
ShowHelpersfalseKeep 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.

On this page