# vg006/vgo architecture

> Architecture diagram of the GitHub repository vg006/vgo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vg006/vgo
- Repository: https://github.com/vg006/vgo

## Overview

##### Main Components Identification
The system should be represented with these key components:

a. Command Layer (Entry Points)
- Main CLI interface components
- Three main commands: init, root, and update

b. Core Application Layer
- Template Engine
- Asset Management
- Project Generation Logic

c. Template Repository
- Framework Templates
- Database Templates
- Project Structure Templates

**User Input Layer**

**Command Layer (cmd/)**

**Core Application Layer (internal/)**

**Template Engine ─────────┐**

**Asset Management        Template Repository**

##### Component Details

a. Command Layer:
- Direct connection to the core application layer

b. Core Application Layer:
- As a central rectangular component
- App.go logic that orchestrates the scaffolding process
- Bidirectional connections to both template and asset management

c. Template Repository:
- Use a database-like symbol to represent the template storage
- Into subgroups:
- Framework templates (chi, echo, fiber, gin, stdlib)
- Database templates (mongo, mysql, postgres, sqlite)
- Project structure templates

##### Data Flow Representation

- User input → Command Layer
- Command Layer → Core Application
- Core Application ↔ Template Engine
- Template Engine → Generated Project Output

##### Additional Elements

Include:
- Version information
- Supported framework and database options
- File generation flow

##### Technical Details

- Go version requirement (1.23.3+)
- Template processing pipeline
- Asset embedding system
- Project generation workflow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph User["User Interface"]
        UI[User Input]
    end

    subgraph Commands["Command Layer"]
        Init["Init Command"]:::command
        Root["Root Command"]:::command
        Update["Update Command"]:::command
    end

    subgraph Core["Core Application Layer"]
        App["Application Logic"]:::core
        AppDef["Application Definitions"]:::core
    end

    subgraph Engine["Template Processing"]
        TemplateEngine["Template Engine"]:::engine
        AssetMgmt["Asset Management"]:::asset
    end

    subgraph Templates["Template Repository"]
        Frameworks["Framework Templates"]:::template
        Databases["Database Templates"]:::template
        ProjectStructure["Project Structure Templates"]:::template
        
        subgraph StructureTemplates["Structure Templates"]
            AppTemplate["Application Template"]:::template
            ServerTemplate["Server Template"]:::template
            ConfigTemplate["Configuration Template"]:::template
        end
    end

    subgraph Output["Generated Output"]
        Project["Generated Project"]:::output
    end

    UI --> Root
    UI --> Init
    UI --> Update

    Root --> App
    Init --> App
    Update --> App

    App --> AppDef
    App --> TemplateEngine
    App --> AssetMgmt

    TemplateEngine --> Frameworks
    TemplateEngine --> Databases
    TemplateEngine --> ProjectStructure

    ProjectStructure --> AppTemplate
    ProjectStructure --> ServerTemplate
    ProjectStructure --> ConfigTemplate

    TemplateEngine --> Project
    AssetMgmt --> Project

    %% Click Events
    click Init "https://github.com/vg006/vgo/blob/main/cmd/init.go"
    click Root "https://github.com/vg006/vgo/blob/main/cmd/root.go"
    click Update "https://github.com/vg006/vgo/blob/main/cmd/update.go"
    click App "https://github.com/vg006/vgo/blob/main/internal/app.go"
    click AppDef "https://github.com/vg006/vgo/blob/main/internal/app.d.go"
    click TemplateEngine "https://github.com/vg006/vgo/blob/main/internal/templates/template.go"
    click AssetMgmt "https://github.com/vg006/vgo/blob/main/internal/assets/assets.go"
    click Frameworks "https://github.com/vg006/vgo/tree/main/internal/templates/framework/"
    click Databases "https://github.com/vg006/vgo/tree/main/internal/templates/database/"
    click AppTemplate "https://github.com/vg006/vgo/blob/main/internal/templates/app/app.go.tmpl"
    click ServerTemplate "https://github.com/vg006/vgo/blob/main/internal/templates/cmd/server/server.go.tmpl"
    click ConfigTemplate "https://github.com/vg006/vgo/blob/main/internal/templates/files/env.tmpl"

    %% Styles
    classDef command fill:#2374ab,stroke:#2374ab,color:#fff
    classDef core fill:#048a81,stroke:#048a81,color:#fff
    classDef engine fill:#06d6a0,stroke:#06d6a0,color:#333
    classDef asset fill:#54478c,stroke:#54478c,color:#fff
    classDef template fill:#ffd166,stroke:#ffd166,color:#333
    classDef output fill:#ef476f,stroke:#ef476f,color:#fff

    %% Legend
    subgraph Legend
        L1["Command Layer"]:::command
        L2["Core Components"]:::core
        L3["Template Engine"]:::engine
        L4["Asset Management"]:::asset
        L5["Templates"]:::template
        L6["Output"]:::output
    end
```
