# pranavkrishnas/firstresponder architecture

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

- Interactive diagram: https://gitdiagram.com/pranavkrishnas/firstresponder
- Repository: https://github.com/pranavkrishnas/firstresponder

## Overview

##### Project type and purpose
- From the README and file tree, FirstResponder is a full-stack, multi-component emergency response application.
- It consists of:
- A Python-based backend (Flask or WSGI)
- A Dart frontend (likely a Flutter mobile or web UI)
- Low-level modules (main.c) and an Arduino sketch (sketch_jul18a.ino) for simulation and hardware integration
- Logging/output artifacts (output.log)

##### File structure
- Top-level files:
- README.md and .gitignore
- main.c / mainRevised.dart — simulation or prototype code in C and Dart
- sketch_jul18a.ino — Arduino firmware for on-site sensors or devices
- output.log — sample log from runs or simulations
- backend/ directory:
- app.py — Flask application entry point
- routes.py — HTTP route definitions, REST API endpoints
- models.py — Data models (ORM) representing users, incidents, messages
- wsgi.py — WSGI gateway for production deployment
- backend/.gitignore
- No explicit “frontend/” folder, but main.dart suggests a Flutter app in the root or prototype stage

##### README for additional insights
- Describes real-time communication, simulation/testing environment, UI demo GIFs.

##### Additional guidance
- Keep labels succinct but precise (e.g., “Flask REST API,” “Flutter Mobile Client”).
- Provide at least one context-level view (all components) and one container-level view (detailed backend internals).

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client Layer"
        Flutter["Flutter UI"]:::frontend
    end

    subgraph "Backend Layer"
        subgraph "REST API Server"
            APIApp["app.py"]:::backend
            APIRoutes["routes.py"]:::backend
            APIWSGI["wsgi.py"]:::backend
        end
        Models["models.py"]:::backend
        Database["Database"]:::infra
    end

    subgraph "Simulation & Hardware"
        Sim["Simulation Engine"]:::simulation
        IoT["IoT Device (Arduino)"]:::simulation
    end

    Monitoring["Logging / Monitoring"]:::infra

    Flutter -->|HTTPS/JSON| APIApp
    APIApp -->|defines endpoints in| APIRoutes
    APIRoutes -->|uses ORM| Models
    Models -->|reads/writes| Database
    APIApp -->|served via| APIWSGI
    APIApp -->|triggers| Sim
    IoT -->|sends sensor data to| APIApp
    APIApp -->|logs events to| Monitoring

    click Flutter "https://github.com/pranavkrishnas/firstresponder/blob/main/main.dart"
    click APIApp "https://github.com/pranavkrishnas/firstresponder/blob/main/backend/app.py"
    click APIRoutes "https://github.com/pranavkrishnas/firstresponder/blob/main/backend/routes.py"
    click APIWSGI "https://github.com/pranavkrishnas/firstresponder/blob/main/backend/wsgi.py"
    click Models "https://github.com/pranavkrishnas/firstresponder/blob/main/backend/models.py"
    click Sim "https://github.com/pranavkrishnas/firstresponder/blob/main/main.c"
    click IoT "https://github.com/pranavkrishnas/firstresponder/blob/main/sketch_jul18a.ino"
    click Monitoring "https://github.com/pranavkrishnas/firstresponder/blob/main/output.log"

    classDef frontend fill:#add8e6,stroke:#000,stroke-width:1px
    classDef backend fill:#90ee90,stroke:#000,stroke-width:1px
    classDef simulation fill:#ffa500,stroke:#000,stroke-width:1px
    classDef infra fill:#d3d3d3,stroke:#000,stroke-width:1px
```
