Code Monkey home page Code Monkey logo

archview's Introduction

ArchView

ArchView is a tool for creating and inspecting Go program architecture based on annotations.

Introduction

To start using, add annotations like so:

// architecture: Database
type DB interface {
	Query() string
}

// architecture: Service
type Users struct {
	db       *DB
	comments *Comments
}

// architecture: Service
type Comments struct {
	db    *DB
	users *Users
}

// architecture: Server
type Server struct {
	comments *Comments
	users    *Users
}

// we can create links between interfaces and implementations with idiomatic Go
var _ DB = &PostgresDB{}
var _ DB = (*SqliteDB)(nil)

// architecture: Database Implementation
type PostgresDB struct{}

// architecture: Database Implementation
type SqliteDB struct{}

When we run the tool to output a graphviz dot file:

archview ./... | dot -Tsvg > graph.svg

Basic Diagram

We can also use more complicated tools, by outputting a graphml file:

archview -out example.graphml ./... 

With a tool like yEd we can try different ways of visualizing:

Prettier Diagram

Tools

To install archview run:

go get -u github.com/storj/archview

You'll also need a tool to layout the graph, for example:

  1. GraphViz for dot formats.
  2. yEd for graphml formats.

Running the tool outputs the graph definition:

archview [-format (dot|dot-basic|graphml)] [-out <output file>] [packages]

archview's People

Contributors

egonelbre avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.