# nitrictech/nitric architecture

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

- Interactive diagram: https://gitdiagram.com/nitrictech/nitric
- Repository: https://github.com/nitrictech/nitric

## Overview

##### High-Level Architecture Overview

a) SDK Layer (Top)
- Supported languages (Node.js, TypeScript, Python, Go, Dart)
- SDK interfaces for different resources (APIs, Storage, Queue, etc.)

b) Core Layer (Middle)
- Protocol Buffer definitions
- Worker management
- Gateway interfaces
- Resource management

c) Cloud Provider Layer (Bottom)
- AWS implementation
- GCP implementation
- Azure implementation

##### Key Components

a) Core Services:
- API Gateway
- Storage Services
- Queue/Topic Services
- Key-Value Store
- Secret Management
- SQL Database
- WebSocket Services
- Batch Processing
- Schedule Services

b) Infrastructure Components:
- Deployment Engine
- Resource Manager
- Security/IAM Manager
- Runtime Environment

##### Detailed Elements

Specific components:

**SDK Layer:**
**[APIs] -- [Storage] -- [Queue] -- [KeyValue] -- [Secrets] -- [SQL] -- [WebSocket]**

- Resource Definitions

**Core Layer:**
**[Proto Definitions] -- [Gateway Manager] -- [Worker Manager]**

**[Resource Manager] ---- [Security Manager] -- [Runtime Manager]**

**Cloud Provider Layer:**
**[AWS Provider] -- [GCP Provider] -- [Azure Provider]**

##### Implementation Details

Specific implementation components:
- Terraform/Pulumi generators
- Protocol buffer services
- Runtime environments
- Deployment workflows

##### Resource provisioning workflow

Remember to highlight the framework's key features:
- Infrastructure as Code generation
- Multi-cloud support
- Security automation
- Resource management
- Plugin extensibility

This will provide a clear visualization of how Nitric orchestrates cloud resources while maintaining provider independence and security best practices.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef sdk fill:#2196F3,stroke:#1565C0,color:white
    classDef core fill:#4CAF50,stroke:#2E7D32,color:white
    classDef cloud fill:#FF9800,stroke:#EF6C00,color:white
    classDef infra fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef legend fill:#EEEEEE,stroke:#BDBDBD,color:black

    %% SDK Layer
    subgraph SDKLayer["SDK Layer"]
        SDK_API["API Interface"]:::sdk
        SDK_Storage["Storage Interface"]:::sdk
        SDK_Queue["Queue Interface"]:::sdk
        SDK_KV["KeyValue Interface"]:::sdk
        SDK_Secret["Secrets Interface"]:::sdk
        SDK_SQL["SQL Interface"]:::sdk
        SDK_WS["WebSocket Interface"]:::sdk
    end

    %% Core Layer
    subgraph CoreLayer["Core Layer"]
        Proto["Protocol Buffers"]:::core
        Gateway["Gateway Manager"]:::core
        Worker["Worker Manager"]:::core
        ResourceMgr["Resource Manager"]:::core
        
        subgraph CoreServices["Core Services"]
            API["API Service"]:::core
            Storage["Storage Service"]:::core
            Queue["Queue Service"]:::core
            Topic["Topic Service"]:::core
            KV["KeyValue Service"]:::core
            Secret["Secret Service"]:::core
            SQL["SQL Service"]:::core
            WS["WebSocket Service"]:::core
            Batch["Batch Service"]:::core
            Schedule["Schedule Service"]:::core
        end
    end

    %% Cloud Provider Layer
    subgraph CloudLayer["Cloud Provider Layer"]
        subgraph AWS["AWS Implementation"]
            AWSRuntime["Runtime"]:::cloud
            AWSDeploy["Deploy"]:::cloud
        end
        
        subgraph GCP["GCP Implementation"]
            GCPRuntime["Runtime"]:::cloud
            GCPDeploy["Deploy"]:::cloud
        end
        
        subgraph Azure["Azure Implementation"]
            AzureRuntime["Runtime"]:::cloud
            AzureDeploy["Deploy"]:::cloud
        end
    end

    %% Connections
    SDKLayer --> Proto
    Proto --> CoreServices
    CoreServices --> Gateway
    Gateway --> Worker
    Worker --> ResourceMgr
    ResourceMgr --> AWS
    ResourceMgr --> GCP
    ResourceMgr --> Azure

    %% Legend
    subgraph Legend["Legend"]
        L1["SDK Components"]:::sdk
        L2["Core Components"]:::core
        L3["Cloud Provider Components"]:::cloud
        L4["Infrastructure Components"]:::infra
    end

    %% Click Events
    click Proto "https://github.com/nitrictech/nitric/tree/main/nitric/proto/"
    click Gateway "https://github.com/nitrictech/nitric/tree/main/core/pkg/gateway/"
    click Worker "https://github.com/nitrictech/nitric/tree/main/core/pkg/workers/"
    click AWS "https://github.com/nitrictech/nitric/tree/main/cloud/aws/"
    click GCP "https://github.com/nitrictech/nitric/tree/main/cloud/gcp/"
    click Azure "https://github.com/nitrictech/nitric/tree/main/cloud/azure/"
    click API "https://github.com/nitrictech/nitric/tree/main/core/pkg/proto/apis/"
    click Storage "https://github.com/nitrictech/nitric/tree/main/core/pkg/proto/storage/"
    click Queue "https://github.com/nitrictech/nitric/tree/main/core/pkg/proto/queues/"
    click Topic "https://github.com/nitrictech/nitric/tree/main/core/pkg/proto/topics/"
    click KV "https://github.com/nitrictech/nitric/tree/main/core/pkg/proto/keyvalue/"
    click Secret "https://github.com/nitrictech/nitric/tree/main/core/pkg/proto/secrets/"
    click SQL "https://github.com/nitrictech/nitric/tree/main/core/pkg/proto/sql/"
    click WS "https://github.com/nitrictech/nitric/tree/main/core/pkg/proto/websockets/"
    click Batch "https://github.com/nitrictech/nitric/tree/main/core/pkg/proto/batch/"
    click Schedule "https://github.com/nitrictech/nitric/tree/main/core/pkg/proto/schedules/"
    click AWSRuntime "https://github.com/nitrictech/nitric/tree/main/cloud/aws/runtime/"
    click GCPRuntime "https://github.com/nitrictech/nitric/tree/main/cloud/gcp/runtime/"
    click AzureRuntime "https://github.com/nitrictech/nitric/tree/main/cloud/azure/runtime/"
    click AWSDeploy "https://github.com/nitrictech/nitric/tree/main/cloud/aws/deploy/"
    click GCPDeploy "https://github.com/nitrictech/nitric/tree/main/cloud/gcp/deploy/"
    click AzureDeploy "https://github.com/nitrictech/nitric/tree/main/cloud/azure/deploy/"
```
