# 912-burca-olivia/devoops architecture

> Architecture diagram of the GitHub repository 912-burca-olivia/devoops, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/912-burca-olivia/devoops
- Repository: https://github.com/912-burca-olivia/devoops

## Overview

##### Project type and purpose
- This is a full-stack, containerized “MiniTwit” application (a Twitter clone) with a Go-based frontend (“itu-minitwit”), a Go-based REST API (“itu-minitwit-api”), a SQLite database, plus a full logging & monitoring stack (ELK + Prometheus/Grafana). The project uses Docker Compose for local development and testing, Terraform/Ansible for provisioning, and GitHub Actions for CI/CD.

##### Main components and their roles
a. Frontend Web App (“itu-minitwit”)
- Serves HTML templates, CSS, user registration/login, timeline views.
- Listens on port 8080.
b. Backend API (“itu-minitwit-api”)
- Exposes endpoints for posting tweets, following users, retrieving timelines.
- Manages database schema (schema.sql), and builds metrics (metrics.go) for Prometheus.
- Listens on port 7070.
c. Database (SQLite)
- A file-based DB (minitwit.db in each service) for storing users, follows, messages.
d. Logging pipeline (ELK)
- Filebeat collects logs from the app/API containers.
- Logstash ingests and transforms logs.
- Elasticsearch stores and indexes logs.
- Kibana provides log dashboards.
e. Monitoring stack
- The API exposes Prometheus metrics.
- Prometheus scrapes those metrics.
- Grafana visualizes application and system metrics.
f. Infrastructure & Provisioning
- Terraform (do-terraform) for cloud infra.
- Ansible roles (setup/roles) for installing Beats and Logstash.
- Vagrantfile for local VM setup.
g. CI/CD & Testing
- GitHub Actions workflows automate build, test (unit, e2e, API simulation), Docker image publishing, and releases.
- Docker Compose test configs spin up dependent services for integration tests.

##### Relationships and data flows
- User’s browser → HTTP requests → Frontend (8080)
- Frontend → REST calls → API (7070)
- API → SQL queries → SQLite DB
- App/API → stdout logs → Filebeat → Logstash → Elasticsearch → Kibana
- API → /metrics endpoint → Prometheus → Grafana
- CI triggers → build & push Docker images → (optional) Terraform deploy
- Docker Compose wires up all containers via an isolated network

##### Architectural patterns and design principles
- Clear separation of concerns: UI layer vs. API layer vs. data layer
- Container-per-service (“one process per container”)
- Infrastructure as code (Terraform + Ansible)
- Automated testing pipeline in containerized test environments
- Observability: logs centralized in ELK; metrics in Prometheus/Grafana

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        Browser["User Browser"]:::user
        Frontend["itu-minitwit (Go Frontend)\nPort 8080"]:::frontend
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        API["itu-minitwit-api (Go API)\nPort 7070"]:::backend
    end

    %% Data Persistence
    subgraph "Data Persistence"
        DB["SQLite DB\n(minitwit.db)"]:::datastore
    end

    %% Logging Pipeline (ELK)
    subgraph "Logging Pipeline"
        Filebeat["Filebeat"]:::observ
        Logstash["Logstash"]:::observ
        Elasticsearch["Elasticsearch"]:::observ
        Kibana["Kibana"]:::observ
    end

    %% Monitoring Stack
    subgraph "Monitoring"
        Prometheus["Prometheus"]:::observ
        Grafana["Grafana"]:::observ
    end

    %% CI/CD & Testing
    subgraph "CI/CD & Testing"
        GitHub["GitHub Actions"]:::infra
        DockerRegistry["Docker Registry"]:::infra
        Tests["Test Harness"]:::infra
        Compose["Docker Compose"]:::infra
    end

    %% Infrastructure & Provisioning
    subgraph "Infrastructure & Provisioning"
        Terraform["Terraform"]:::infra
        Ansible["Ansible Roles"]:::infra
        Vagrant["Vagrant (Local VM)"]:::infra
    end

    %% Data Flows
    Browser -->|HTTP Requests| Frontend
    Frontend -->|REST Calls| API
    API -->|SQL Queries| DB

    Frontend --> Filebeat
    API --> Filebeat
    Filebeat --> Logstash
    Logstash --> Elasticsearch
    Elasticsearch --> Kibana

    API -->|/metrics| Prometheus
    Prometheus --> Grafana

    GitHub -->|build & push| DockerRegistry
    DockerRegistry -->|images| Compose
    Compose --> Frontend
    Compose --> API
    Compose --> Filebeat
    Compose --> Logstash
    Compose --> Elasticsearch
    Compose --> Kibana
    Compose --> Prometheus
    Compose --> Grafana

    GitHub -->|deploy infra| Terraform
    GitHub -->|configure| Ansible

    %% Click Events
    click Frontend "https://github.com/912-burca-olivia/devoops/tree/main/itu-minitwit/"
    click Frontend "https://github.com/912-burca-olivia/devoops/tree/main/itu-minitwit/dockerfile"
    click Frontend "https://github.com/912-burca-olivia/devoops/blob/main/itu-minitwit/minitwit.go"
    click Frontend "https://github.com/912-burca-olivia/devoops/blob/main/itu-minitwit/helpers.go"
    click Frontend "https://github.com/912-burca-olivia/devoops/blob/main/itu-minitwit/types.go"
    click Frontend "https://github.com/912-burca-olivia/devoops/blob/main/itu-minitwit/schema.sql"
    click Frontend "https://github.com/912-burca-olivia/devoops/blob/main/itu-minitwit/static/style.css"
    click Frontend "https://github.com/912-burca-olivia/devoops/tree/main/itu-minitwit/templates/"
    click Frontend "https://github.com/912-burca-olivia/devoops/tree/main/itu-minitwit/local/dockerfile"

    click API "https://github.com/912-burca-olivia/devoops/tree/main/itu-minitwit-api/"
    click API "https://github.com/912-burca-olivia/devoops/tree/main/itu-minitwit-api/dockerfile"
    click API "https://github.com/912-burca-olivia/devoops/blob/main/itu-minitwit-api/minitwit_api.go"
    click API "https://github.com/912-burca-olivia/devoops/blob/main/itu-minitwit-api/helpers.go"
    click API "https://github.com/912-burca-olivia/devoops/blob/main/itu-minitwit-api/types.go"
    click API "https://github.com/912-burca-olivia/devoops/blob/main/itu-minitwit-api/metrics.go"
    click API "https://github.com/912-burca-olivia/devoops/blob/main/itu-minitwit-api/schema.sql"
    click DB "https://github.com/912-burca-olivia/devoops/blob/main/itu-minitwit-api/minitwit.db"
    click Filebeat "https://github.com/912-burca-olivia/devoops/tree/main/filebeat/"
    click Filebeat "https://github.com/912-burca-olivia/devoops/tree/main/filebeat/Dockerfile"
    click Filebeat "https://github.com/912-burca-olivia/devoops/blob/main/filebeat/config/filebeat.yml"
    click Filebeat "https://github.com/912-burca-olivia/devoops/blob/main/filebeat/filebeat-compose.yml"
    click Logstash "https://github.com/912-burca-olivia/devoops/tree/main/logstash/"
    click Logstash "https://github.com/912-burca-olivia/devoops/tree/main/logstash/Dockerfile"
    click Logstash "https://github.com/912-burca-olivia/devoops/blob/main/logstash/config/logstash.yml"
    click Logstash "https://github.com/912-burca-olivia/devoops/blob/main/logstash/pipeline/logstash.conf"
    click Logstash "https://github.com/912-burca-olivia/devoops/blob/main/logstash/pipeline/test.conf"
    click Elasticsearch "https://github.com/912-burca-olivia/devoops/tree/main/elasticsearch/"
    click Elasticsearch "https://github.com/912-burca-olivia/devoops/tree/main/elasticsearch/Dockerfile"
    click Elasticsearch "https://github.com/912-burca-olivia/devoops/blob/main/elasticsearch/config/elasticsearch.yml"
    click Kibana "https://github.com/912-burca-olivia/devoops/tree/main/kibana/"
    click Kibana "https://github.com/912-burca-olivia/devoops/tree/main/kibana/Dockerfile"
    click Kibana "https://github.com/912-burca-olivia/devoops/blob/main/kibana/config/kibana.yml"
    click Prometheus "https://github.com/912-burca-olivia/devoops/blob/main/prometheus.yml"
    click Grafana "https://github.com/912-burca-olivia/devoops/blob/main/Grafana_dashboard.json"
    click Terraform "https://github.com/912-burca-olivia/devoops/tree/main/do-terraform/"
    click Terraform "https://github.com/912-burca-olivia/devoops/blob/main/do-terraform/main.tf"
    click Ansible "https://github.com/912-burca-olivia/devoops/tree/main/setup/roles/"
    click Ansible "https://github.com/912-burca-olivia/devoops/blob/main/setup/roles/filebeat_writer.json"
    click Ansible "https://github.com/912-burca-olivia/devoops/blob/main/setup/roles/logstash_writer.json"
    click Ansible "https://github.com/912-burca-olivia/devoops/blob/main/setup/roles/metricbeat_writer.json"
    click Ansible "https://github.com/912-burca-olivia/devoops/blob/main/setup/roles/heartbeat_writer.json"
    click Ansible "https://github.com/912-burca-olivia/devoops/tree/main/setup/Dockerfile"
    click Ansible "https://github.com/912-burca-olivia/devoops/blob/main/setup/entrypoint.sh"
    click Ansible "https://github.com/912-burca-olivia/devoops/blob/main/setup/lib.sh"
    click Vagrant "https://github.com/912-burca-olivia/devoops/tree/main/Vagrantfile"
    click GitHub "https://github.com/912-burca-olivia/devoops/tree/main/.github/workflows/"
    click GitHub "https://github.com/912-burca-olivia/devoops/blob/main/.github/workflows/Build_and_publish_pdf.yml"
    click GitHub "https://github.com/912-burca-olivia/devoops/blob/main/.github/workflows/continuous-check.yml"
    click GitHub "https://github.com/912-burca-olivia/devoops/blob/main/.github/workflows/continous-deployment.yml"
    click GitHub "https://github.com/912-burca-olivia/devoops/blob/main/.github/workflows/release.yml"
    click Compose "https://github.com/912-burca-olivia/devoops/blob/main/docker-compose.yml"
    click Compose "https://github.com/912-burca-olivia/devoops/blob/main/docker-compose_local.yml"
    click Compose "https://github.com/912-burca-olivia/devoops/blob/main/docker-compose_test.yml"
    click Compose "https://github.com/912-burca-olivia/devoops/blob/main/docker-compose_test_local.yml"
    click Compose "https://github.com/912-burca-olivia/devoops/blob/main/docker-compose-3.yml"
    click Tests "https://github.com/912-burca-olivia/devoops/tree/main/tests/"
    click Tests "https://github.com/912-burca-olivia/devoops/blob/main/tests/api_sim_test.py"
    click Tests "https://github.com/912-burca-olivia/devoops/blob/main/tests/app_unit_test.py"
    click Tests "https://github.com/912-burca-olivia/devoops/blob/main/tests/e2e_test.py"
    click Tests "https://github.com/912-burca-olivia/devoops/blob/main/tests/ui_test.py"
    click Tests "https://github.com/912-burca-olivia/devoops/blob/main/tests/minitwit_test.go"
    click Tests "https://github.com/912-burca-olivia/devoops/blob/main/tests/minitwit_tests.py"
    click Tests "https://github.com/912-burca-olivia/devoops/blob/main/tests/requirements.txt"
    click Tests "https://github.com/912-burca-olivia/devoops/tree/main/tests/dockerfile"
    click Tests "https://github.com/912-burca-olivia/devoops/tree/main/tests/local/dockerfile"
    click Tests "https://github.com/912-burca-olivia/devoops/blob/main/minitwit_simulator.py"
    click Tests "https://github.com/912-burca-olivia/devoops/blob/main/flag_tool/flag_tool.c"
    click Tests "https://github.com/912-burca-olivia/devoops/tree/main/Dockerfile-minitwit-tests"

    %% Styles
    classDef user fill:#cce5ff,stroke:#3399ff,color:#004085;
    classDef frontend fill:#cce5ff,stroke:#3399ff,color:#004085;
    classDef backend fill:#d4edda,stroke:#28a745,color:#155724;
    classDef datastore fill:#fff3cd,stroke:#ffc107,color:#856404;
    classDef observ fill:#e2e3e5,stroke:#6c757d,color:#1b1e21;
    classDef infra fill:#f8f9fa,stroke:#6c757d,color:#383d41;
```
