# tomoki108/burny architecture

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

- Interactive diagram: https://gitdiagram.com/tomoki108/burny
- Repository: https://github.com/tomoki108/burny

## Overview

##### Main Components
- API Service (Backend):
- Represents the Go-based REST API found under the “api/” directory.
▪ Domain layer (domain, model packages): business models like User, Project, Sprint, etc.
▪ Handler layer (handler, middleware): responsible for routing HTTP requests, JWT authentication, API key handling, and error management.
▪ Usecase layer: contains business logic operations such as authentication, API key processing, project and sprint management.
▪ Infrastructure layer (db connections, repositories, email via SES): implementation for persistence and integrations.
▪ Server & Dependency Injection (server folder and di.go): bootstraps the service.
- Support for API documentation (Swagger files under api/docs and scenario tests in api/scenario).

- Web Application (Frontend):
- Representing the single-page application built on Vue.js located in “web/”.
- Components include:
▪ Main Application structure (App.vue, main.ts) and router configuration.
▪ API modules (api/ folder): handling interactions with the backend REST API endpoints.
▪ UI components (under components/): reusable pieces like dialogs, charts, and modals for project and sprint management.
▪ State management using stores (auth_store, projects_store, sprints_store) to maintain application state.
- Inclusion of testing with several test files highlighting the app’s reliability (web/tests).

- Infrastructure:
- Managed through Terraform files contained in “infra/”.
- Separate environments for dev, prod, and DNS configuration along with reusable modules (backend, frontend, github) for consistent cloud resource provisioning.
- Represents the deployment layer on Google Cloud.

- CI/CD Pipeline:
- Under “.github/” directory – Automated workflows that deploy both backend and frontend services.
- These workflows show integration with the source code repositories leading to containerization (see the Dockerfile for the API) and deployment sequences.

##### Relationships and Interactions
- The Web Frontend communicates with the API backend via RESTful HTTP calls.
- The API backend itself interacts with the database (and possibly other external services such as email via SES) through its infrastructure components.
- CI/CD workflows trigger deployments for both API and web services using GitHub Actions.
- The Infrastructure layer provides the resources (compute, networking, storage) needed by both the API and Web components in a cloud setting.

##### Architectural Patterns and Design Principles
- Clean architectural separation in the API layer: distinct separation between Domain, Handler, Usecase, and Infrastructure indicates domain-driven design principles.
- The Frontend follows component-based design (Vue single-file components) and uses state management to separate concerns.
- Infrastructure-as-Code (Terraform) ensures reproducible cloud resource provisioning.
- Microservice boundary is demarcated by having separate repositories for API and Web, which enhances maintainability and scalability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "API Service (Go REST API)"
        A_Domain["Domain Layer (Business Models)"]:::api
        A_Routing["Routing (HTTP)"]:::api
        A_Middleware["Middleware (JWT&APIKeys)"]:::api
        A_Usecase["Usecase Layer (Business Logic)"]:::api
        A_Infra["Infrastructure Layer (DB&Integrations)"]:::api
        A_Server["Server & DI (Bootstrapping)"]:::api
        A_Docs["Documentation & Tests (Swagger&Scenarios)"]:::api
    end

    subgraph "Web Application (Vue.js SPA)"
        W_Main["Main Structure & Routing"]:::frontend
        W_API["Frontend API Modules"]:::frontend
        W_Components["UI Components"]:::frontend
        W_State["State Management (Stores)"]:::frontend
    end

    subgraph "Infrastructure (Terraform)"
        INFRA["Terraform Deployment"]:::infra
    end

    subgraph "CI/CD Pipeline (GitHub Actions)"
        CI_CD["CI/CD Workflows"]:::cicd
    end

    %% Data Flow Connections
    W_Main -->|"RESTCalls"| A_Routing
    A_Routing --> A_Middleware
    A_Middleware -->|"Executes"| A_Usecase
    A_Usecase -->|"UsesModels"| A_Domain
    A_Usecase -->|"Persists"| A_Infra
    A_Infra -->|"UsesCloudResources"| INFRA
    CI_CD -->|"DeploysAPI"| A_Server
    CI_CD -->|"DeploysWeb"| W_Main

    %% Click Events for API Service
    click A_Domain "https://github.com/tomoki108/burny/tree/dev/api/domain/"
    click A_Routing "https://github.com/tomoki108/burny/tree/dev/api/handler/"
    click A_Middleware "https://github.com/tomoki108/burny/tree/dev/api/middleware/"
    click A_Usecase "https://github.com/tomoki108/burny/tree/dev/api/usecase/"
    click A_Infra "https://github.com/tomoki108/burny/tree/dev/api/infrastructure/"
    click A_Server "https://github.com/tomoki108/burny/blob/dev/api/server/di.go"
    click A_Docs "https://github.com/tomoki108/burny/tree/dev/api/docs/"

    %% Click Events for Web Application
    click W_Main "https://github.com/tomoki108/burny/blob/dev/web/src/App.vue"
    click W_API "https://github.com/tomoki108/burny/tree/dev/web/src/api/"
    click W_Components "https://github.com/tomoki108/burny/tree/dev/web/src/components/"
    click W_State "https://github.com/tomoki108/burny/tree/dev/web/src/stores/"

    %% Click Events for Infrastructure & CI/CD
    click INFRA "https://github.com/tomoki108/burny/tree/dev/infra/"
    click CI_CD "https://github.com/tomoki108/burny/tree/dev/.github/"

    %% Styling
    classDef api fill:#a8e6cf,stroke:#333,stroke-width:2px;
    classDef frontend fill:#81d4fa,stroke:#333,stroke-width:2px;
    classDef infra fill:#ffd54f,stroke:#333,stroke-width:2px;
    classDef cicd fill:#ce93d8,stroke:#333,stroke-width:2px;
```
