# keobkeig/atlas architecture

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

- Interactive diagram: https://gitdiagram.com/keobkeig/atlas
- Repository: https://github.com/keobkeig/atlas

## Overview

Step 1: Identify Project Type and Purpose
- This is an open-source, Rust-based command-line tool (“AutoDeployment System”) that automates cloud deployments.
- It reads natural-language deployment requests, analyzes a code repository, makes infrastructure decisions, generates Terraform configurations, and orchestrates the deployment across multiple clouds.

Step 2: Analyze the File Structure
- Top-level files:
- src/…: six Rust modules and main.rs.
- src/ai_nlp.rs: NLP engine
- src/repository.rs: Repo analysis
- src/infrastructure.rs: Infra decision engine
- src/credentials.rs: Credential manager
- src/deployment.rs: Deployment orchestrator
- src/main.rs: CLI entry point

Step 3: Examine README for Additional Insights
- README defines five core modules and their responsibilities.
- External dependencies: Google Gemini AI, Git, Terraform, AWS/GCP/Azure.
- Emphasis on secure credential storage, Terraform-based IaC, multi-cloud support.

a. Main Components (Core Layer)
1. CLI Frontend (main.rs + clap)
2. AI-Powered NLP Module
3. Repository Analysis Module
4. Infrastructure Decision Engine
5. Credential Management Module
6. Deployment Orchestration Module

b. External Integrations (Integration Layer, placed below Core Layer)
- Google Gemini AI API
- Git Repository Hosts (GitHub, GitLab)
- Terraform CLI/Service
- Cloud Providers: AWS, GCP, Azure

c. Relationships & Data Flows
1. User invokes CLI → main.rs routes command to either chat or deploy workflow.
2. Core modules communicate sequentially:
– NLP Module parses natural-language description →
– Repo Analyzer clones & introspects code →
– Infra Decision Engine determines VM/container/serverless/K8s + cost estimate →
– Credential Manager injects cloud credentials →
– Deployment Orchestrator generates Terraform files and invokes Terraform →
– Terraform invokes target Cloud Providers.
3. NLP Module ↔ Google Gemini: sends prompts, receives parsed requirements.
4. Repo Analyzer ↔ Git: clones repository.
5. Deployment Orchestrator ↔ Terraform CLI.
6. Terraform ↔ AWS/GCP/Azure APIs.

d. Architectural Patterns & Principles
- Modular separation: each responsibility in its own module.
- Layered architecture: Core logic layer above External Integrations.
- Dependency inversion: Core modules depend on abstract “Integration” interfaces rather than concrete SDKs.
- Single responsibility per module.
- Secure credential handling isolated in Credentials Module.

e. Key Technologies & Libraries
- Rust async (tokio)
- clap (CLI parsing)
- reqwest + serde (HTTP + JSON for AI API)
- git2 or shelling out to Git
- Terraform CLI invoked as external process
- dotenv for .env loading
- Anyhow for error handling

Step 5: Tailoring Guidelines for an Open-Source Tool
- Core functionality and where it “hooks” into external systems.
- Only the six core modules (omit config files, build scripts).
- Extensibility: e.g., “add new cloud provider by implementing Credentials + Terraform template plugin.”

- Clear labels on every component (e.g., “AI-Powered NLP Module”).

Step 7: Emphasize Detail
- Six core modules distinctly.
- Layering: Core at top, Integration at bottom.
- Interactions, e.g., “NLP Module → Google Gemini (HTTP REST)”.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Modules Layer
    subgraph "Core Modules"
        direction TB
        CLI["CLI Frontend"]:::core
        NLP["AI-Powered NLP Module"]:::core
        Repo["Repository Analysis Module"]:::core
        Infra["Infrastructure Decision Engine"]:::core
        CredMgr["Credential Management Module"]:::core
        Deploy["Deployment Orchestration Module"]:::core
    end

    %% Data Stores
    CredStore["Credential Store"]:::datastore
    TFOutput["Terraform Config Output"]:::datastore

    %% External Integrations Layer
    subgraph "External Integrations"
        direction TB
        Gemini["Google Gemini AI API"]:::external
        GitHosts["Git Repository Hosts"]:::external
        TerraformCLI["Terraform CLI"]:::external
        subgraph "Cloud Providers"
            direction TB
            AWS["AWS"]:::external
            GCP["GCP"]:::external
            Azure["Azure"]:::external
        end
    end

    %% Core Flow
    CLI -->|"invoke workflow"| NLP
    NLP -->|"parsed requirements"| Repo
    Repo -->|"repo introspection"| Infra
    Infra -->|"infra decisions"| CredMgr
    CredMgr -->|"injects creds"| Deploy
    Deploy -->|"generate & apply IaC"| TFOutput
    Deploy -->|"invoke Terraform"| TerraformCLI

    %% External Calls
    NLP -->|"HTTP REST"| Gemini
    Repo -->|"git clone"| GitHosts
    TerraformCLI -->|"provisions infra"| AWS
    TerraformCLI -->|"provisions infra"| GCP
    TerraformCLI -->|"provisions infra"| Azure

    %% Credential Store Interaction
    CredMgr -->|"secure storage"| CredStore

    %% Click Events
    click CLI "https://github.com/keobkeig/atlas/blob/main/src/main.rs"
    click NLP "https://github.com/keobkeig/atlas/blob/main/src/ai_nlp.rs"
    click Repo "https://github.com/keobkeig/atlas/blob/main/src/repository.rs"
    click Infra "https://github.com/keobkeig/atlas/blob/main/src/infrastructure.rs"
    click CredMgr "https://github.com/keobkeig/atlas/blob/main/src/credentials.rs"
    click Deploy "https://github.com/keobkeig/atlas/blob/main/src/deployment.rs"

    %% Styles
    classDef core fill:#AED6F1,stroke:#1B4F72,stroke-width:1px;
    classDef external fill:#D5D8DC,stroke:#85929E,stroke-width:1px;
    classDef datastore fill:#AAB7B8,stroke:#566573,stroke-width:1px;
```
