# wazo-platform/wazo-confd architecture

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

- Interactive diagram: https://gitdiagram.com/wazo-platform/wazo-confd
- Repository: https://github.com/wazo-platform/wazo-confd

## Overview

##### Project type and purpose
- This is a micro-service called “wazo-confd” that exposes a RESTful API for configuring and managing a Wazo server.
- It is part of the larger Wazo Platform ecosystem and is deployed (often via Docker and managed by systemd) as a backend service.
- The service supports dynamic configuration by means of plugins and interacts with a database and other components (like wazo-provd and xivo-manage-db) to provide its functionality.

##### Analyzing the file structure
- Top-Level Artifacts and Build/Deployment: Notice files like Dockerfile, Jenkinsfile, and various configuration files (e.g., .dockerignore, .gitignore). These indicate a containerized, CI/CD-managed service.
- “wazo_confd” directory: Contains the core Python modules. Key files include main.py, http_server.py, controller.py, config.py, and directories for database and helper functionality.
- “wazo_confd/plugins”: Contains hundreds of plugin subdirectories that extend the service functionality (handling agents, endpoints, conferences, call permissions, voicemail, etc.). This plugin architecture is core to the design.
- “wazo_confd/database”: Shows modules managing database interactions.
- “etc”: Provides system-level configurations for nginx, rsyslog, and wazo-confd service configuration.
- “integration_tests”: Contains docker-compose setups, test assets, and integration tests to simulate the full environment.

##### Key elements to highlight
a. Main Service Components:
- HTTP Server: Represented by “wazo_confd/http_server.py” and “main.py”, which handle incoming HTTP requests.
- Controller & API Routing: wazo_confd/controller.py manages routing and delegation to plugins and service methods.
- Configuration Management: wazo_confd/config.py and associated configuration files (in etc/) maintain runtime configuration.
b. Database Layer:
- The “wazo_confd/database” directory shows modules handling data persistence (agent statuses, devices, emails, etc.). Represent a dedicated database component.
c. Plugin Architecture:
- A large collection of plugins under “wazo_confd/plugins” indicates an extensible modular design. Each plugin (such as agent, conference, call_filter, voicemail, etc.) extends the API functionality. Use a separate block labeled “Plugins” with sub-blocks for major plugin groups.
d. Middleware and Helpers:
- Modules in “wazo_confd/helpers” and in individual plugins show middleware and helper functions that (for example) transform or validate data.
e. External Integrations:
- Integration tests and volumes for external libraries (xivo-manage-db, wazo-provd) suggest that wazo-confd interacts with additional external services for provisioning and database management.
f. Infrastructure/Deployment:
- Dockerfile and systemd service (via etc/wazo-confd) indicate containerized deployment and automatic start on system boot.
- CI/CD systems are indicated by Jenkinsfile and integration tests, which can be shown as an external “CI/CD Pipeline” node that feeds new builds to the deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A("Clients"):::client

    subgraph "HTTP Layer"
        B("HTTP Server"):::core
        B2("Main"):::core
    end

    subgraph "Configuration"
        D("Config Module"):::core
        D2("Service Config"):::core
    end

    C("Controller (API Routing)"):::core
    E("Plugin Architecture"):::plugin
    F("Database Layer"):::db
    G("Middleware & Helpers"):::core
    H("External Integrations"):::external
    I("Infrastructure/Deployment"):::infra
    J("CI/CD Pipeline"):::external
    K("System Configurations"):::infra

    A --> B
    B2 --> C
    D --> C
    D2 --> C
    C --> E
    C <==> F
    C --> G
    H --> C
    J --> I
    I --> B2
    K --> I

    click B "https://github.com/wazo-platform/wazo-confd/blob/master/wazo_confd/http_server.py"
    click B2 "https://github.com/wazo-platform/wazo-confd/blob/master/wazo_confd/main.py"
    click C "https://github.com/wazo-platform/wazo-confd/blob/master/wazo_confd/controller.py"
    click D "https://github.com/wazo-platform/wazo-confd/blob/master/wazo_confd/config.py"
    click D2 "https://github.com/wazo-platform/wazo-confd/blob/master/etc/wazo-confd/config.yml"
    click E "https://github.com/wazo-platform/wazo-confd/tree/master/wazo_confd/plugins"
    click F "https://github.com/wazo-platform/wazo-confd/tree/master/wazo_confd/database"
    click G "https://github.com/wazo-platform/wazo-confd/tree/master/wazo_confd/helpers"
    click H "https://github.com/wazo-platform/wazo-confd/tree/master/integration_tests"
    click I "https://github.com/wazo-platform/wazo-confd/tree/master/Dockerfile"
    click J "https://github.com/wazo-platform/wazo-confd/tree/master/Jenkinsfile"
    click K "https://github.com/wazo-platform/wazo-confd/tree/master/etc"

    classDef client fill:#E1F5FE,stroke:#0277BD,stroke-width:2px;
    classDef core fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef plugin fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px;
    classDef db fill:#D1C4E9,stroke:#512DA8,stroke-width:2px;
    classDef external fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
    classDef infra fill:#CFD8DC,stroke:#455A64,stroke-width:2px;
```
