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

# Platform Architecture

> Technical architecture and core components of SyneHQ

<Info>
  SyneHQ is engineered for both cloud-hosted SaaS and enterprise self-hosted deployments with the same core architecture and security model.
</Info>

SyneHQ is built on a modern, scalable architecture designed to handle enterprise-grade data analytics workloads while maintaining the simplicity of natural language interaction. Our platform is engineered for both cloud-hosted SaaS and enterprise self-hosted deployments.

### Core Components

| Component            | Purpose                                                        |
| -------------------- | -------------------------------------------------------------- |
| Query Engine         | DuckDB-powered federated analytics across sources              |
| AI Layer             | Natural language understanding, query generation, optimization |
| Connector Framework  | Universal connectivity to SQL/NoSQL/analytic systems           |
| Security Layer       | Zero‑trust, encryption, RBAC, audit logging                    |
| Visualization Engine | Charts, dashboards, sharing, export                            |

## System Architecture

```mermaid theme={"system"}
flowchart TB
  subgraph SyneHQ["SyneHQ Platform"]
    direction TB

    subgraph Presentation["Presentation Layer"]
      WebUI["Web UI"]
      Mobile["Mobile App"]
      API["API Layer"]
    end

    subgraph Application["Application Layer"]
      Query["Query Engine"]
      AI["AI/ML Engine"]
      Security["Security Layer"]
    end

    subgraph Data["Data Layer"]
      Connectors["Database Connectors"]
      Cache["Cache Layer"]
      Logging["Logging & Audit"]
    end
  end

  WebUI --> Query
  Mobile --> Query
  API --> Query

  Query --> Connectors
  AI --> Connectors
  Security --> Logging
  Cache --> Connectors
```

## Architecture at a glance (TANGENT LAKE)

```mermaid theme={"system"}
flowchart LR
  subgraph Sources["Data Sources"]
    A[Postgres]
    B[MySQL]
    C[Mongo / Files]
    Z[many more datasources]
  end

  subgraph Federation["Tangent Lake (Federation)"]
    TL["DuckDB Session<br/>(ATTACH, Orchestration)"]
  end

  subgraph Explore["Explore & Query"]
    Q[Console / SQL]
    AI[AI NLQ]
  end

  subgraph Outcomes["Outcomes"]
    D[Dashboards]
    E[Alerts]
    F[Sharing / RBAC]
  end

  A --> TL
  B --> TL
  C --> TL
  Z --> TL
  TL --> Q
  TL --> AI
  Q --> D
  Q --> E
  AI --> D
  AI --> E
  D --> F
  E --> F
```

## Architecture at a glance (DASHBOARDS + CHAT)

```mermaid theme={"system"}
flowchart LR
  %% --- Data Sources ---
  subgraph Sources["Data Sources"]
    A["Postgres"]
    B["MySQL"]
    C["Mongo"]
    R["REST / CSV"]
  end

  %% --- Connectors ---
  subgraph Connect["Connectors"]
    PG["PG Connector"]
    MY["MySQL Connector"]
    MG["Mongo Bridge"]
    RS["HTTP / File Reader"]
  end

  %% --- Application ---
  subgraph App["SyneHQ App"]
    QE["Query Engine"]
    CH["Chat Assistant (NLQ)"]
    DB["Dashboard"]

    subgraph Charts["Charts on one dashboard"]
      X1["Chart: Postgres metric"]
      X2["Chart: MySQL metric"]
      X3["Chart: Mongo metric"]
    end
  end

  %% --- Edges ---
  A --> PG --> QE
  B --> MY --> QE
  C --> MG --> QE
  R --> RS --> QE

  CH --> QE
  QE --> X1 & X2 & X3
  X1 & X2 & X3 --> DB
```

## Component Details

<AccordionGroup>
  <Accordion title="Query Engine written in Go">
    * **Federated Analytics**: Cross-database query execution (TangentLake -> DuckDB)
    * **Query Optimization**: Automatic performance tuning
    * **Type System**: Universal data type handling
    * **Memory Management**: Efficient resource utilization
  </Accordion>

  <Accordion title="AI Layer">
    * **Natural Language Processing**: Converts questions to queries
    * **Schema Understanding**: Analyzes database structure
    * **Context Management**: Maintains conversation state
    * **Learning System**: Improves with user interactions
  </Accordion>

  <Accordion title="Connector Framework">
    * **Universal Connectivity**: 20+ database types supported
    * **Protocol Support**: SQL, NoSQL, and API connections
    * **Authentication**: Secure credential management
    * **Connection Pooling**: Efficient resource sharing
  </Accordion>

  <Accordion title="Security Layer">
    * **Zero Trust**: No implicit trust assumptions
    * **Encryption**: End-to-end data protection
    * **Access Control**: Role-based permissions
    * **Audit Logging**: Comprehensive activity tracking
  </Accordion>
</AccordionGroup>

## Data Flow

<AccordionGroup>
  <Accordion title="Query Processing Pipeline">
    1. **Natural Language Input**: User asks question in plain English
    2. **AI Processing**: Language model converts to query intent
    3. **Schema Analysis**: AI understands database structure
    4. **Query Generation**: SQL/NoSQL query created
    5. **Execution**: Query runs against target database
    6. **Result Processing**: Data formatted and visualized
    7. **Response**: Results returned to user
  </Accordion>

  <Accordion title="Security Flow">
    1. **Authentication**: User credentials verified
    2. **Authorization**: Permissions checked for data access
    3. **Query Validation**: Query analyzed for security risks
    4. **Execution**: Query runs in user's environment
    5. **Audit Logging**: All activities recorded
    6. **Response**: Results encrypted and returned
  </Accordion>
</AccordionGroup>

## Scalability Features

### Horizontal Scaling

* **Load Balancing**: Intelligent query distribution
* **Multi-Instance**: Support for multiple SyneHQ instances
* **Database Sharding**: Automatic query routing
* **Resource Management**: Dynamic resource allocation

### Performance Optimization

* **Query Caching**: Intelligent result caching
* **Connection Pooling**: Efficient database connections
* **Memory Management**: Optimized memory usage
* **Index Recommendations**: Database optimization guidance

## Technology Stack

### Core Technologies

| Area                 | Technologies                                   |
| -------------------- | ---------------------------------------------- |
| Backend              | Node.js/TypeScript, Rust, Go Lang, Python      |
| Database Engine (Go) | DuckDB for federated analytics                 |
| AI/ML                | GPT-5, Claude, Fine-tuned models               |
| Security             | End-to-end encryption, Zero-trust architecture |

### Infrastructure

* **Containerization**: Docker for deployment
* **Orchestration**: Kubernetes support
* **Monitoring**: Prometheus and Grafana
* **Logging**: Structured logging with ELK stack

## Enterprise Features

### Multi-Tenancy

| Capability            | Description                                 |
| --------------------- | ------------------------------------------- |
| Isolated Environments | Complete data and user isolation per tenant |
| Custom Branding       | White-label themes and assets               |
| Resource Limits       | Configurable limits per tenant/workspace    |
| Usage Analytics       | Detailed usage tracking and billing exports |

### High Availability

| Capability        | Description                                    |
| ----------------- | ---------------------------------------------- |
| Auto-Scaling      | Scale compute automatically based on demand    |
| Failover          | Automatic failover to backup instances         |
| Backup & Recovery | Scheduled backups and point‑in‑time recovery   |
| Monitoring        | Real-time health checks, metrics, and alerting |

### Compliance & Security

| Standard/Control     | Coverage                                        |
| -------------------- | ----------------------------------------------- |
| SOC2 Type II         | Certified security controls and processes       |
| GDPR                 | Data privacy, subject rights, residency options |
| HIPAA (Enterprise)   | PHI handling and administrative controls        |
| PCI DSS (Enterprise) | Secure handling of payment-related data         |

<Card title="Deployment Guide" icon="download" href="/deployment">
  Learn how to deploy SyneHQ in your environment
</Card>

<CardGroup cols={2}>
  <Card title="Performance Tuning" icon="speed" href="/performance">
    Optimize SyneHQ for your workload
  </Card>

  <Card title="Security Configuration" icon="shield" href="/security">
    Configure security settings and compliance
  </Card>
</CardGroup>
