> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oasm.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Architecture

> Understand the distributed architecture of OASM including components, data flow, and system design

The system runs on a distributed architecture consisting of:

* A web-based console for user interaction, asset management, and real-time monitoring.
* A core API service responsible for business logic, data persistence, and job orchestration.
* A Redis-based queue and caching layer enabling asynchronous job distribution, rate limiting, and system decoupling.
* Distributed workers that execute high-performance scanning tasks, designed for horizontal auto-scaling and fault tolerance.
* A PostgreSQL database for persistent storage of assets, scan results, and system state.
* An MCP (Model Context Protocol) server that provides structured context to AI systems.
* Integration with AI/LLM components to enable intelligent querying, analysis, and automation over collected asset data.

```mermaid placement="top-left" theme={null}
graph TD
    %% Actors & External
    User[User / Security Team]
    AI[AI Assistant / LLM]
    Internet[Internet / Attack Surface]

    %% Core Components
    subgraph "OASM Platform"
        Console[Web Console]
        API[Core API Service]
        DB[(PostgreSQL)]
        Redis[(Redis)]
        MCP[MCP Server]

        subgraph "Execution Plane"
            W1[Worker 1]
            W2[Worker 2]
            WN[Worker N]
        end
    end

    %% Relationships
    User -->|Manage & Monitor| Console
    Console <-->|REST API| API

    API <-->|Persist Data| DB
    API <-->|Queue / Cache| Redis

    %% Job Flow (2-way)
    API <-->|Job / Result| W1
    API <-->|Job / Result| W2
    API <-->|Job / Result| WN

    %% Scan
    W1 -->|Scan| Internet
    W2 -->|Scan| Internet
    WN -->|Scan| Internet

    %% AI Flow
    AI <-->|Query Context| MCP
    MCP <-->|Fetch Asset Data| API
```
