archview

Quickstart

Mount archview and open the graph in under a minute.

1. Install

go get github.com/eularixs/archview

2. Mount it

archview serves its UI on its own path (/graph by default). Mount it on a *http.ServeMux and let your framework handle everything else.

package main

import (
	"log"
	"net/http"

	"github.com/eularixs/archview"
)

func main() {
	mux := http.NewServeMux()

	av, err := archview.New(archview.Options{
		Root:     ".",      // module dir to analyze
		BasePath: "/graph", // mount path
		Editor:   "vscode", // click-to-source target
	})
	if err != nil {
		log.Fatal(err)
	}
	av.Mount(mux) // serves /graph and /graph/data

	// ... register your own handlers on mux ...

	log.Println("open http://localhost:8080/graph")
	http.ListenAndServe(":8080", mux)
}

3. Open the graph

Run your app and open http://localhost:8080/graph.

archview analyzes your module's source at startup (dev-live mode), so the source tree and Go toolchain must be present at runtime. See Limitations.

Using a framework?

archview owns its own path; let gin (or any router) handle the rest:

mux := http.NewServeMux()
av.Mount(mux)
mux.Handle("/", ginEngine) // gin handles everything except /graph

On this page