# encoredev/encore architecture

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

- Interactive diagram: https://gitdiagram.com/encoredev/encore
- Repository: https://github.com/encoredev/encore

## Overview

##### Main Components (Core Architecture)

a) CLI Layer:
- Subcomponents for app creation, deployment, and local development
- To the parser and compiler components

b) Parser & Compiler Layer:
- Connections to both Go and TypeScript parsing (`v2/parser` and `tsparser`)
- Code generation components (`codegen`)

c) Runtime Layer:
- Runtime components (`runtimes/go` and `runtimes/js`) below the parser/compiler
- Different runtime features (API, PubSub, Database, etc.)

##### Infrastructure Integration Layer

- AWS services (RDS, SQS/SNS, etc.)
- GCP services (Cloud SQL, Pub/Sub, etc.)
- Local development services (NSQ, PostgreSQL)

##### Key Subsystems

a) Development Tools:
- Local development dashboard
- Tracing system
- Service catalog
- API documentation generator

b) Resource Management:
- Database connections
- PubSub topics/subscriptions
- Secret management
- Caching system
- Object storage

##### Data Flow

- Application code → Parser → Compiler → Runtime
- Runtime → Infrastructure services
- Development tools → Local infrastructure
- Monitoring/tracing data flow

##### Component Details

For each major component, include:
- Component name
- Key responsibilities
- Primary interfaces
- Dependencies

##### Additional Elements

Visual representations of:
- Security boundaries
- Service discovery mechanisms
- Load balancing
- Authentication/Authorization flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph CLI["CLI Layer"]
        CLI_MAIN["Main CLI"]:::cli
        DAEMON["Daemon Service"]:::cli
        CLI_UTILS["Internal Utilities"]:::cli
    end

    subgraph PARSER["Parser Layer"]
        GO_PARSER["Go Parser"]:::parser
        TS_PARSER["TypeScript Parser"]:::parser
        RES_PARSER["Resource Parser"]:::parser
    end

    subgraph RUNTIME["Runtime Layer"]
        CORE_RT["Core Runtime"]:::runtime
        GO_RT["Go Runtime"]:::runtime
        JS_RT["JavaScript Runtime"]:::runtime
    end

    subgraph INFRA["Infrastructure Layer"]
        CLOUD["Cloud Infrastructure"]:::infra
        DB["Database Management"]:::infra
        PUBSUB["PubSub System"]:::infra
        REDIS["Redis Integration"]:::infra
    end

    subgraph DEV_TOOLS["Development Tools"]
        DASH["Development Dashboard"]:::devtools
        API_PROXY["API Proxy"]:::devtools
        TELEMETRY["Telemetry"]:::devtools
    end

    subgraph BUILD["Build System"]
        BUILD_CONFIG["Build Configuration"]:::build
        CODE_GEN["Code Generation"]:::build
        INFRA_GEN["Infrastructure Generation"]:::build
    end

    subgraph DOCS["Documentation"]
        GO_DOCS["Go Docs"]:::docs
        TS_DOCS["TypeScript Docs"]:::docs
        PLAT_DOCS["Platform Docs"]:::docs
    end

    CLI_MAIN --> DAEMON
    DAEMON --> CLI_UTILS
    DAEMON --> PARSER
    
    GO_PARSER --> CORE_RT
    TS_PARSER --> CORE_RT
    RES_PARSER --> INFRA_GEN
    
    CORE_RT --> GO_RT
    CORE_RT --> JS_RT
    
    GO_RT --> CLOUD
    JS_RT --> CLOUD
    
    DAEMON --> DEV_TOOLS
    API_PROXY --> TELEMETRY
    
    PARSER --> BUILD
    BUILD --> INFRA
    
    classDef cli fill:#ff9900
    classDef parser fill:#3498db
    classDef runtime fill:#2ecc71
    classDef infra fill:#95a5a6
    classDef devtools fill:#e74c3c
    classDef build fill:#9b59b6
    classDef docs fill:#f1c40f

    click CLI_MAIN "https://github.com/encoredev/encore/tree/main/cli/cmd/encore"
    click DAEMON "https://github.com/encoredev/encore/tree/main/cli/daemon"
    click CLI_UTILS "https://github.com/encoredev/encore/tree/main/cli/internal"
    click GO_PARSER "https://github.com/encoredev/encore/tree/main/parser"
    click TS_PARSER "https://github.com/encoredev/encore/tree/main/tsparser"
    click RES_PARSER "https://github.com/encoredev/encore/tree/main/v2/parser/resource"
    click CORE_RT "https://github.com/encoredev/encore/tree/main/runtimes/core"
    click GO_RT "https://github.com/encoredev/encore/tree/main/runtimes/go"
    click JS_RT "https://github.com/encoredev/encore/tree/main/runtimes/js"
    click CLOUD "https://github.com/encoredev/encore/tree/main/cli/daemon/run/infra"
    click DB "https://github.com/encoredev/encore/tree/main/cli/daemon/sqldb"
    click PUBSUB "https://github.com/encoredev/encore/tree/main/cli/daemon/pubsub"
    click REDIS "https://github.com/encoredev/encore/tree/main/cli/daemon/redis"
    click DASH "https://github.com/encoredev/encore/tree/main/cli/daemon/dash"
    click API_PROXY "https://github.com/encoredev/encore/tree/main/cli/daemon/dash/apiproxy"
    click TELEMETRY "https://github.com/encoredev/encore/tree/main/cli/daemon/telemetry"
    click BUILD_CONFIG "https://github.com/encoredev/encore/tree/main/pkg/encorebuild"
    click CODE_GEN "https://github.com/encoredev/encore/tree/main/v2/codegen"
    click INFRA_GEN "https://github.com/encoredev/encore/tree/main/v2/codegen/infragen"
    click GO_DOCS "https://github.com/encoredev/encore/tree/main/docs/go"
    click TS_DOCS "https://github.com/encoredev/encore/tree/main/docs/ts"
    click PLAT_DOCS "https://github.com/encoredev/encore/tree/main/docs/platform"
```
