# gallant-giri/civicscan architecture

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

- Interactive diagram: https://gitdiagram.com/gallant-giri/civicscan
- Repository: https://github.com/gallant-giri/civicscan

## Overview

##### Project type and purpose
- This is a monolithic full-stack web application built with Django (Python).
- Purpose (inferred from name “CivicScan” and the apps): it lets users sign up, submit and view civic reports (with photos), and browse a landing “homepage.”

##### File structure
- Top-level “manage.py”, “db.sqlite3”, “.env”, “render.yaml” → classic Django project with a local SQLite DB and deployment configured (likely on Render).
- The “BrillianBengaluru” directory holds the Django project settings (settings.py, urls.py, wsgi.py, asgi.py).
- Three Django apps:
- homepage/ → landing pages, static index, anonymous report entry
- reports/ → core report submission, map view, management commands (e.g., update_addresses.py)
- users/ → custom user models, signup, dashboard
- Static assets: “static/” is the development assets; “staticfiles/” contains collected admin and Cloudinary-related JS/CSS (indicating Cloudinary used for media uploads).
- media/ → local storage for uploads (under “media/uploads” and “media/reports_photos”).
- Templates are organized per app under “templates/…/[app_name]/”.
- render.yaml → deployment spec (likely container, services, environment variables).

##### README
- Minimal content (“# CivicScan”) but the name plus file tree shows it’s a civic reporting platform.

##### Detail
- Django app as its own component.
- Both local media folder and Cloudinary to reflect actual config.
- Management command pipeline (e.g., background address updates).
- If desired, annotate the deployment block with render.yaml settings (service, environment).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Client["User Browser"]:::client
    Client -->|"HTTP(S) request/response"| CDN["CDN / Load Balancer"]:::network

    %% Network Layer
    CDN -->|"forwards requests"| WebServer["Nginx / Gunicorn"]:::network

    %% Application Entry
    WebServer -->|"launches"| Manage["manage.py"]:::config
    WebServer -->|"routes to"| ASGI["asgi.py"]:::config
    WebServer -->|"routes to"| WSGI["wsgi.py"]:::config

    subgraph "Django Configuration" 
        Settings["settings.py"]:::config
        Urls["urls.py"]:::config
    end
    Manage --> Settings
    Manage --> Urls
    ASGI --> Settings
    WSGI --> Settings
    Urls --> HomepageApp
    Urls --> UsersApp
    Urls --> ReportsApp
    Urls --> AdminInterface

    subgraph "Django Application" 
        direction TB
        HomepageApp["Homepage App"]:::app
        UsersApp["Users App"]:::app
        ReportsApp["Reports App"]:::app
        AdminInterface["Django Admin"]:::app
        ManagementCmd["Address Update Cmd"]:::app
    end

    %% Data Layer
    ReportsApp -->|"ORM queries"| DB["SQLite / RDBMS"]:::database
    UsersApp -->|"ORM queries"| DB
    HomepageApp -->|"ORM queries"| DB
    AdminInterface -->|"ORM queries"| DB

    ReportsApp -->|"upload/download"| Cloudinary["Cloudinary"]:::external
    UsersApp -->|"profile photo media"| LocalMedia["Local Media Storage"]:::storage

    %% Static Assets
    Client -->|"static asset fetch"| StaticService["Static File Service / CDN"]:::static
    StaticService -->|"serves"| WebServer

    %% Background Task
    ManagementCmd -->|"runs periodically"| ReportsApp

    %% Click Events
    click Settings "https://github.com/gallant-giri/civicscan/blob/main/BrillianBengaluru/settings.py"
    click Urls "https://github.com/gallant-giri/civicscan/blob/main/BrillianBengaluru/urls.py"
    click ASGI "https://github.com/gallant-giri/civicscan/blob/main/BrillianBengaluru/asgi.py"
    click WSGI "https://github.com/gallant-giri/civicscan/blob/main/BrillianBengaluru/wsgi.py"
    click Manage "https://github.com/gallant-giri/civicscan/blob/main/manage.py"
    click HomepageApp "https://github.com/gallant-giri/civicscan/tree/main/homepage/"
    click UsersApp "https://github.com/gallant-giri/civicscan/tree/main/users/"
    click ReportsApp "https://github.com/gallant-giri/civicscan/tree/main/reports/"
    click AdminInterface "https://github.com/gallant-giri/civicscan/blob/main/reports/admin.py"
    click StaticService "https://github.com/gallant-giri/civicscan/tree/main/staticfiles/"
    click LocalMedia "https://github.com/gallant-giri/civicscan/tree/main/media/"
    click ManagementCmd "https://github.com/gallant-giri/civicscan/blob/main/reports/management/commands/update_addresses.py"

    %% Styles
    classDef client fill:#b3e6b3,stroke:#2d8f2d,color:#000
    classDef network fill:#cce0ff,stroke:#3366cc,color:#000
    classDef config fill:#ffebcc,stroke:#ff9900,color:#000
    classDef app fill:#ffd9b3,stroke:#cc6600,color:#000
    classDef database fill:#e5ccff,stroke:#9933cc,color:#000
    classDef external fill:#d9d9d9,stroke:#666666,color:#000
    classDef storage fill:#f2f2f2,stroke:#999999,color:#000
    classDef static fill:#e6ffe6,stroke:#33cc33,color:#000
```
