# wahyurudiyan/sunny-go architecture

> Architecture diagram of the GitHub repository wahyurudiyan/sunny-go, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wahyurudiyan/sunny-go
- Repository: https://github.com/wahyurudiyan/sunny-go

## Overview

sgo is a proto-first Go service generator and local development tool. The principal workflow starts with a developer initializing a project, defining a service in proto, and generating the compiled contract plus DDD layers and transport/persistence adapters; the generated service is then run over HTTP and gRPC. Separate product branches provide OpenAPI generation/viewing, optional cache and search adapters, a browser-based project UI, and a debug dashboard that edits configuration and restarts the supervised service. The README documents these capabilities; some generator wiring is represented at subsystem level because its implementation was not sampled.

Main entry points: [`internal/codegen/generate.go`](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/generate.go) (Generation orchestrator), [`internal/commands/commands.go`](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/commands/commands.go) (CLI commands), [`internal/webui/server.go`](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/webui/server.go) (Project web UI), [`internal/dashboard/server.go`](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/dashboard/server.go) (Debug dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and Setup"]
  node_main["CLI entry<br/>[main.go]"]
  node_commands["CLI commands<br/>[commands.go]"]
  node_project["Project scaffold<br/>[project.go]"]
  node_config["Project config<br/>[config.go]"]
end

subgraph group_generation["Code Generation"]
  node_codegen["Generation orchestrator<br/>[generate.go]"]
  node_proto["Proto compiler<br/>[compile.go]"]
  node_core["Domain and CQRS<br/>[core.go]"]
  node_wire["Wire generation<br/>[wiregen.go]"]
  node_httpgen["HTTP adapters<br/>[httpgen.go]"]
  node_grpcgen["gRPC adapters<br/>[grpcgen.go]"]
  node_persistence["Persistence adapters<br/>[sqlgen.go]"]
  node_optional["Cache and search<br/>[cachegen.go]"]
  node_openapigen["OpenAPI generator<br/>[generate.go]"]
end

subgraph group_runtime["Service Runtime"]
  node_run["Run supervisor<br/>[supervisor.go]"]
  node_envsource["Config sources<br/>[source.go]"]
end

subgraph group_interfaces["Browser Interfaces"]
  node_dashboard["Debug dashboard<br/>[server.go]"]
  node_webui["Project web UI<br/>[server.go]"]
  node_openapiui["OpenAPI viewer<br/>[server.go]"]
end

node_developer(("Developer"))
node_service["Generated service"]

node_developer -->|"runs CLI"| node_main
node_main -->|"executes"| node_commands
node_commands -->|"initializes project"| node_project
node_commands -->|"loads config"| node_config
node_commands -->|"requests generation"| node_codegen
node_project -->|"writes config"| node_config
node_codegen -->|"compiles proto"| node_proto
node_codegen -->|"generates domain"| node_core
node_codegen -->|"generates wiring"| node_wire
node_codegen -->|"generates HTTP"| node_httpgen
node_codegen -->|"generates gRPC"| node_grpcgen
node_codegen -->|"generates storage"| node_persistence
node_codegen -.->|"generates optional adapters"| node_optional
node_codegen -->|"generates spec"| node_openapigen
node_codegen -->|"writes generated layers"| node_service
node_commands -->|"starts service"| node_run
node_run -->|"reads environment"| node_envsource
node_commands -->|"serves debug UI"| node_dashboard
node_dashboard -->|"reads and writes config"| node_envsource
node_dashboard -->|"restarts child"| node_run
node_commands -->|"serves project UI"| node_webui
node_webui -->|"scaffolds project"| node_project
node_webui -->|"requests generation"| node_codegen
node_webui -->|"reads and saves config"| node_config
node_commands -->|"serves spec viewer"| node_openapiui
node_openapiui -->|"reads generated document"| node_openapigen

click node_main "https://github.com/wahyurudiyan/sunny-go/blob/main/cmd/sgo/main.go"
click node_commands "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/commands/commands.go"
click node_project "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/project/project.go"
click node_config "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/config/config.go"
click node_codegen "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/generate.go"
click node_proto "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/proto/compile.go"
click node_core "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/core/core.go"
click node_wire "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/wiregen/wiregen.go"
click node_httpgen "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/httpgen/httpgen.go"
click node_grpcgen "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/grpcgen/grpcgen.go"
click node_persistence "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/sqlgen/sqlgen.go"
click node_optional "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/cachegen/cachegen.go"
click node_openapigen "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/openapigen/generate.go"
click node_run "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/run/supervisor.go"
click node_envsource "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/run/envsource/source.go"
click node_dashboard "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/dashboard/server.go"
click node_webui "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/webui/server.go"
click node_openapiui "https://github.com/wahyurudiyan/sunny-go/blob/main/internal/openapiui/server.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_commands,node_project,node_config toneBlue
class node_codegen,node_proto,node_core,node_wire,node_httpgen,node_grpcgen,node_persistence,node_optional,node_openapigen toneAmber
class node_run,node_envsource toneMint
class node_dashboard,node_webui,node_openapiui toneRose
class node_developer,node_service toneIndigo
```

## Components

### CLI and Setup

- [CLI entry](https://github.com/wahyurudiyan/sunny-go/blob/main/cmd/sgo/main.go): `cmd/sgo/main.go`
- [CLI commands](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/commands/commands.go): `internal/commands/commands.go`
- [Project scaffold](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/project/project.go): `internal/codegen/project/project.go`
- [Project config](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/config/config.go): `internal/config/config.go`

### Code Generation

- [Generation orchestrator](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/generate.go): `internal/codegen/generate.go`
- [Proto compiler](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/proto/compile.go): `internal/codegen/proto/compile.go`
- [Domain and CQRS](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/core/core.go): `internal/codegen/core/core.go`
- [Wire generation](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/wiregen/wiregen.go): `internal/codegen/wiregen/wiregen.go`
- [HTTP adapters](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/httpgen/httpgen.go): `internal/codegen/httpgen/httpgen.go`
- [gRPC adapters](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/grpcgen/grpcgen.go): `internal/codegen/grpcgen/grpcgen.go`
- [Persistence adapters](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/sqlgen/sqlgen.go): `internal/codegen/sqlgen/sqlgen.go`
- [Cache and search](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/cachegen/cachegen.go): `internal/codegen/cachegen/cachegen.go`
- [OpenAPI generator](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/codegen/openapigen/generate.go): `internal/codegen/openapigen/generate.go`

### Service Runtime

- [Run supervisor](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/run/supervisor.go): `internal/run/supervisor.go`
- [Config sources](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/run/envsource/source.go): `internal/run/envsource/source.go`

### Browser Interfaces

- [Debug dashboard](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/dashboard/server.go): `internal/dashboard/server.go`
- [Project web UI](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/webui/server.go): `internal/webui/server.go`
- [OpenAPI viewer](https://github.com/wahyurudiyan/sunny-go/blob/main/internal/openapiui/server.go): `internal/openapiui/server.go`

### Other components

- **Developer**
- **Generated service**

## Connections

- Developer → CLI entry: runs CLI
- CLI entry → CLI commands: executes
- CLI commands → Project scaffold: initializes project
- CLI commands → Project config: loads config
- CLI commands → Generation orchestrator: requests generation
- Project scaffold → Project config: writes config
- Generation orchestrator → Proto compiler: compiles proto
- Generation orchestrator → Domain and CQRS: generates domain
- Generation orchestrator → Wire generation: generates wiring
- Generation orchestrator → HTTP adapters: generates HTTP
- Generation orchestrator → gRPC adapters: generates gRPC
- Generation orchestrator → Persistence adapters: generates storage
- Generation orchestrator → Cache and search: generates optional adapters
- Generation orchestrator → OpenAPI generator: generates spec
- Generation orchestrator → Generated service: writes generated layers
- CLI commands → Run supervisor: starts service
- Run supervisor → Config sources: reads environment
- CLI commands → Debug dashboard: serves debug UI
- Debug dashboard → Config sources: reads and writes config
- Debug dashboard → Run supervisor: restarts child
- CLI commands → Project web UI: serves project UI
- Project web UI → Project scaffold: scaffolds project
- Project web UI → Generation orchestrator: requests generation
- Project web UI → Project config: reads and saves config
- CLI commands → OpenAPI viewer: serves spec viewer
- OpenAPI viewer → OpenAPI generator: reads generated document
