# anishdubey27/sky-guardian architecture

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

- Interactive diagram: https://gitdiagram.com/anishdubey27/sky-guardian
- Repository: https://github.com/anishdubey27/sky-guardian

## Overview

##### Project Type and Purpose
- Sky-Guardian is a weather detection tool built using Django. It is primarily a full-stack web application that uses Django for its backend logic and renders HTML templates for the frontend.
- Beyond the core Django web app (e.g., the “weather” app and the “weatherdetector” configuration), the project integrates several DevOps and infrastructure management tools. These include Docker (Dockerfile, docker-compose.yml), CI/CD pipelines (Jenkinsfile, .circleci and GitHub workflows), configuration management (Ansible playbooks), container orchestration (Kubernetes manifests), and cloud provisioning (Terraform for AWS).

##### Main Components
a. Client/Frontend:
- Web browsers that load the HTML/CSS/JS content. Note that “templates” (index.html) and static content (under media) represent the frontend part.
b. Backend Application:
- The Django application represented by the “manage.py” entry point, the “weatherdetector” project folder (with settings, asgi.py, wsgi.py, and urls), and the “weather” app (containing models, views, URLs, etc.).
c. Database:
- The project currently uses SQLite (db.sqlite3) as its database.
d. Containerization & Orchestration:
- Docker: Incorporate the Dockerfile and docker-compose.yml. This shows how the application is containerized for development or production deployment.
e. CI/CD & DevOps Pipelines:
- CI/CD pipelines configured in GitHub workflows (.github/workflows/django.yml) and CircleCI (.circleci/config.yml).
- Jenkins pipeline (Jenkinsfile) indicating alternative or additional automation/integration steps.
f. Infrastructure Automation Tools:
- Ansible: Reference the playbooks for configuration management.
- Terraform: Include the AWS provisioning component from the terraform-aws folder.

##### Connections and Interactions
- Backend to the Database (SQLite) indicating data operations (CRUD).
- How CI/CD tools (GitHub Actions, CircleCI, Jenkins) trigger builds and tests, which then push images to the Docker or Kubernetes deployment.
- Configuration management and infrastructure provisioning (Ansible, Terraform) as separate but integrated components that manage the deployment environment.
- Optionally, indicate how Kubernetes deployments interact with external load balancers or cloud provider configurations.

##### Architectural Patterns and Design Principles
- The project uses a modular monolithic architecture (with separate “weather” app and project-level configuration in “weatherdetector”) typical for Django web apps.
- The DevOps integrations highlight a commitment to continuous integration/delivery, containerization, and scalable cloud deployments.
- The separation into frontend (templates and media assets), backend (Django application), and infrastructure management layers (Docker, Kubernetes, CI/CD tools) represents a clear separation of concerns.

##### Technology & Framework Details
- Django: Core framework handling both the web application logic and rendering.
- HTML/CSS and JavaScript: For presenting the frontend (as seen in the templates folder).
- Docker: To containerize the application for consistent environments.
- Kubernetes, Ansible, Terraform: For deployment across scalable and potentially cloud-based environments.
- CI/CD: Managed via CircleCI, GitHub Actions, and Jenkins to enforce continuous integration and delivery.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        A["Web Browser"]:::client
        B["Templates (index.html)"]:::client
        C["Static Files (media)"]:::client
    end

    %% Backend Application
    subgraph "Backend Application"
        D["Django Entry Point (manage.py)"]:::backend
        E["Project Config (weatherdetector)"]:::backend
        F["Weather App (weather)"]:::backend
    end

    %% Database Layer
    subgraph "Database Layer"
        G["SQLite Database (db.sqlite3)"]:::database
    end

    %% Containerization
    subgraph "Containerization"
        H1["Dockerfile"]:::container
        H2["Docker Compose"]:::container
    end

    %% Container Orchestration
    subgraph "Container Orchestration"
        I["Kubernetes Cluster"]:::orchestration
    end

    %% CI/CD & DevOps
    subgraph "CI/CD & DevOps"
        J["GitHub Actions"]:::cicd
        K["CircleCI"]:::cicd
        L["Jenkins Pipeline"]:::cicd
    end

    %% Infrastructure Automation
    subgraph "Infrastructure Automation"
        M["Ansible Playbooks"]:::infra
        N["Terraform AWS Provisioning"]:::infra
    end

    %% Data Flows
    A -->|"HTTP_Request"| D
    A -->|"Loads"| B
    A -->|"Loads"| C
    D -->|"Calls"| E
    E -->|"Utilizes"| F
    F -->|"CRUD_Operations"| G

    %% Containerization Flow
    F -->|"Docker_Build"| H1
    H1 -->|"Compose_Deployment"| H2
    H2 -->|"Deploys_to"| I

    %% CI/CD Triggers
    J -->|"Triggers_Build"| H1
    K -->|"Triggers_Build"| H1
    L -->|"Triggers_Build"| H1

    %% Infrastructure Automation
    M -->|"Configures"| I
    N -->|"Provisions"| I

    %% Click Events
    click B "https://github.com/anishdubey27/sky-guardian/blob/main/templates/index.html"
    click C "https://github.com/anishdubey27/sky-guardian/tree/main/media/"
    click D "https://github.com/anishdubey27/sky-guardian/blob/main/manage.py"
    click E "https://github.com/anishdubey27/sky-guardian/tree/main/weatherdetector/"
    click F "https://github.com/anishdubey27/sky-guardian/tree/main/weather/"
    click G "https://github.com/anishdubey27/sky-guardian/blob/main/db.sqlite3"
    click H1 "https://github.com/anishdubey27/sky-guardian/tree/main/Dockerfile"
    click H2 "https://github.com/anishdubey27/sky-guardian/blob/main/docker-compose.yml"
    click I "https://github.com/anishdubey27/sky-guardian/tree/main/Kubernetes/"
    click J "https://github.com/anishdubey27/sky-guardian/blob/main/.github/workflows/django.yml"
    click K "https://github.com/anishdubey27/sky-guardian/blob/main/.circleci/config.yml"
    click L "https://github.com/anishdubey27/sky-guardian/tree/main/Jenkinsfile"
    click M "https://github.com/anishdubey27/sky-guardian/blob/main/ansible/playbooks/playbook.yml"
    click N "https://github.com/anishdubey27/sky-guardian/blob/main/terraform-aws/main.tf"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:2px;
    classDef backend fill:#ccf,stroke:#333,stroke-width:2px;
    classDef database fill:#cfc,stroke:#333,stroke-width:2px;
    classDef container fill:#fcf,stroke:#333,stroke-width:2px;
    classDef orchestration fill:#cff,stroke:#333,stroke-width:2px;
    classDef cicd fill:#ffc,stroke:#333,stroke-width:2px;
    classDef infra fill:#fdd,stroke:#333,stroke-width:2px;

    class A,B,C client;
    class D,E,F backend;
    class G database;
    class H1,H2 container;
    class I orchestration;
    class J,K,L cicd;
    class M,N infra;
```
