# azavea/iow-boundary-tool architecture

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

- Interactive diagram: https://gitdiagram.com/azavea/iow-boundary-tool
- Repository: https://github.com/azavea/iow-boundary-tool

## Overview

##### Main Components
- Frontend Client: Located under src/app. This component is built with React (evidenced by files like App.js, components, pages, and store) and appears to focus on map interactions (drawing tools, layers, geocoder, etc.).
- Backend Server: Found under src/django. This is a Django application that uses gunicorn for production (as noted in the README under “Gunicorn for Django app”) and provides RESTful API endpoints under src/django/api (with models, serializers, views, and a robust migrations structure).
- Deployment & Infrastructure Automation: There are several directories for deployment:
– Docker & Docker Compose (docker-compose.yml, docker-compose.override.yml, docker-compose.ci.yml), which handle containerization.
– Vagrant (Vagrantfile and related setup scripts) for VM-based development environments.
– Ansible and Terraform scripts (under deployment/ansible and deployment/terraform) which manage environment provisioning, configuration, and infrastructure as code.
- Data & Testing: The data directory and test scripts (inside src/django/api/tests and scripts/test) indicate components for data ingestion (municipal data, vector tiles, etc.) and automated testing.
- CI/CD: GitHub workflows (in .github/workflows) and various scripts (in scripts/) show that there is automated continuous integration and deployment integration.

##### Relationships and Interactions
- Deployment tools (Docker, Vagrant, Ansible, Terraform) interact with both environments – managing the build, test, and deployment of the Frontend and Backend components.
- CI/CD pipelines (under GitHub workflows and scripts such as cibuild, update, test) orchestrate the automated build and test steps, linking the developer’s commits and testing with the deployments.
- External services like municipal data sources (invoked by scripts such as fetch-data) and possibly external authentication services (implied by the mailing templates) should be depicted along with API interactions where relevant.

##### Architectural Patterns & Design Principles
- Separation of Concerns: The project is clearly divided into a Frontend (React) and a Backend (Django) which communicate over a RESTful interface.
- Containerization & Infrastructure as Code: Emphasize the use of Docker for containerization, along with Vagrant for VM-based development and Ansible/Terraform for provisioning and infrastructure management.
- Modular Design: The Django portion exhibits an MVC-like pattern (models, views, serializers, templates) while the frontend has a modular structure with separate folders for components, pages, and state management.
- Testing & CI/CD: The project includes dedicated scripts for linting, testing, and CI build pipelines, reinforcing these best practices in the architecture.

##### Relevant Technologies & Frameworks
- Backend: Django, Gunicorn, and the Django REST framework aspects (serializers, views).
- Deployment/Automation: Docker, Vagrant, Ansible, Terraform, GitHub Actions.
- Additional Tools: Pre-commit hooks, linting/formatting scripts, and various utility scripts under ./scripts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Layer
    subgraph "Application Layer"
        F("Frontend (React App)"):::application
        B("Backend (Django App & API)"):::backend
        DB("Database"):::database
    end

    F -->|"REST_API"| B
    B <-->|"Data_Access"| DB

    %% Infrastructure & Deployment
    subgraph "Infrastructure & Deployment"
        DO("Docker Containerization"):::infra
        VA("Virtual Machine Setup (Vagrant)"):::infra
        AN("Deployment Automation - Ansible"):::infra
        TF("Deployment Automation - Terraform"):::infra
    end

    DO -->|"Deploy_Containers"| F
    DO -->|"Deploy_Containers"| B
    VA -->|"Dev_VM"| F
    VA -->|"Dev_VM"| B
    AN -->|"Infra_Provision"| F
    AN -->|"Infra_Provision"| B
    TF -->|"Infra_Provision"| F
    TF -->|"Infra_Provision"| B

    %% CI/CD & Testing
    subgraph "CI/CD & Testing"
        CI("CI/CD Pipelines"):::cicd
        DI("Data Ingestion"):::testing
        AT("Automated Tests"):::testing
        TS("Test Scripts"):::testing
    end

    CI -->|"Build&Deploy"| DO
    CI -->|"Trigger_Deployment"| VA
    CI -->|"Infra_Automation"| AN
    CI -->|"Infra_Automation"| TF
    CI -->|"Run_Tests"| AT
    CI -->|"Run_Tests"| TS
    CI -->|"Manage_Data"| DI

    %% Styles
    classDef application fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef backend fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
    classDef database fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef infra fill:#F5B7B1,stroke:#943126,stroke-width:2px;
    classDef cicd fill:#D2B4DE,stroke:#4A235A,stroke-width:2px;
    classDef testing fill:#FAD7A0,stroke:#9C640C,stroke-width:2px;

    %% Click Events
    click F "https://github.com/azavea/iow-boundary-tool/tree/develop/src/app"
    click B "https://github.com/azavea/iow-boundary-tool/tree/develop/src/django"
    click DO "https://github.com/azavea/iow-boundary-tool/blob/develop/docker-compose.yml"
    click VA "https://github.com/azavea/iow-boundary-tool/tree/develop/Vagrantfile"
    click AN "https://github.com/azavea/iow-boundary-tool/tree/develop/deployment/ansible"
    click TF "https://github.com/azavea/iow-boundary-tool/tree/develop/deployment/terraform"
    click CI "https://github.com/azavea/iow-boundary-tool/tree/develop/.github/workflows"
    click DI "https://github.com/azavea/iow-boundary-tool/tree/develop/data"
    click AT "https://github.com/azavea/iow-boundary-tool/tree/develop/src/django/api/tests"
    click TS "https://github.com/azavea/iow-boundary-tool/tree/develop/scripts/test"
```
