system-spec

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2026 License: MIT

README ΒΆ

System Spec

Go CI Go Lint Go SAST Go Report Card Docs Docs Visualization License

A Go-native system topology specification for modeling microservices, infrastructure, and connectivity.

Features

  • πŸ”’ Strongly-typed - Go structs are source of truth; no interface{} or any
  • πŸ“„ JSON-first - JSON format with generated JSON Schema
  • πŸ”— Graph-aware - Services as nodes, connections as edges
  • ☁️ Multi-cloud - AWS, GCP, and Cloudflare resource bindings
  • 🎨 Multi-render - D2, Mermaid, Cytoscape.js, Sigma.js, GraphViz

Installation

CLI
go install github.com/plexusone/system-spec/cmd/system-spec@latest
Go SDK
go get github.com/plexusone/system-spec@latest

Quick Start

Create system.json:

{
  "name": "my-system",
  "services": {
    "api": {
      "image": { "name": "myorg/api", "tag": "v1.0" },
      "repo": { "url": "https://github.com/myorg/api" },
      "connections": {
        "database": { "port": 5432, "protocol": "sql" }
      }
    },
    "database": {
      "image": { "name": "postgres", "tag": "15" }
    }
  }
}

Validate and render:

# Validate
system-spec validate system.json

# Render to D2
system-spec render system.json --format d2 > system.d2
d2 system.d2 system.svg

# Render to Mermaid (GitHub-compatible)
system-spec render system.json --format mermaid

# Render to Cytoscape.js (web visualization)
system-spec render system.json --format cytoscape > system.json

Go SDK Usage

import (
    "github.com/plexusone/system-spec/spec"
    "github.com/plexusone/system-spec/graph"
    "github.com/plexusone/system-spec/render"
)

// Load and validate
sys, err := spec.LoadFromFile("system.json")
if err != nil {
    log.Fatal(err)
}

// Convert to graph
g := graph.FromSystem(sys)

// Render
renderers := render.NewRenderers()
output, err := renderers.D2.Render(g)

Specification

Version Spec Schema
v0.1.0 spec.md system.schema.json

The human-readable spec (spec.md) is for developers. The JSON Schema is for tools and AI agents.

Supported Resources

Cloud Providers
Provider Resources
AWS RDS, DynamoDB, SQS, SNS, S3, Bedrock
GCP CloudSQL, PubSub, GCS
Cloudflare Workers, R2
Deployment Tools
Tool Support
Helm Chart references with service mapping
Terraform Module references with resource mapping

Rendering Formats

Format Output Use Case
D2 Text Static diagrams, documentation
Mermaid Text GitHub Markdown, wikis
Cytoscape JSON Interactive web visualization
Sigma JSON Large graph visualization
DOT Text GraphViz, PDF/PNG export

Design Principles

  1. Go-first: Go structs β†’ JSON Schema (not the reverse)
  2. No polymorphism: map[string]Service not map[string]interface{}
  3. Schema validation: Must pass schemalint
  4. Graph-native: Built for visualization and dependency analysis

Documentation

Project Structure

system-spec/
β”œβ”€β”€ spec/           # Core Go types (System, Service, etc.)
β”œβ”€β”€ graph/          # Graph representation and conversion
β”œβ”€β”€ render/         # Multi-format renderers
β”œβ”€β”€ schema/         # JSON Schema generation
β”œβ”€β”€ cmd/system-spec/# CLI tool
β”œβ”€β”€ versions/       # Versioned specs and schemas
β”‚   └── v0.1.0/
β”‚       β”œβ”€β”€ spec.md              # Human-readable
β”‚       └── system.schema.json   # Machine-readable
β”œβ”€β”€ docs/           # MkDocs documentation
└── examples/       # Example system specs

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make changes with tests
  4. Run go test ./... and golangci-lint run
  5. Submit a pull request

Changelog

See CHANGELOG.md for release history.

Generated from CHANGELOG.json using structured-changelog.

License

MIT License - see LICENSE for details.

Directories ΒΆ

Path Synopsis
cmd
system-spec command
Command system-spec provides CLI tools for working with system specifications.
Command system-spec provides CLI tools for working with system specifications.
Package graph provides an intermediate graph representation for rendering system-spec to various diagram formats.
Package graph provides an intermediate graph representation for rendering system-spec to various diagram formats.
Package graphize provides integration with the graphize code graph tool.
Package graphize provides integration with the graphize code graph tool.
Package render provides multiple output formats for system-spec graphs.
Package render provides multiple output formats for system-spec graphs.
Package schema provides JSON Schema generation from Go types.
Package schema provides JSON Schema generation from Go types.
Package spec defines the core system-spec types.
Package spec defines the core system-spec types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL