# domthor/risk-radar architecture

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

- Interactive diagram: https://gitdiagram.com/domthor/risk-radar
- Repository: https://github.com/domthor/risk-radar

## Overview

##### Main Components
- Frontend – The client-side interface built with React using Vite and styled with Tailwind CSS. It’s organized into pages (e.g., About, Alerts, Score, Search, Settings) and multiple reusable components (such as Navbar, Autocomplete, BarCard, PieCard, RecentEventsCard, etc.). The frontend also has hook files for managing state (e.g., useCounties, useData) and configuration files like vite.config.js and ESLint settings.
- Backend – A Flask-based API server that handles API requests. The code is in app.py with additional configuration and dependency files (requirements.txt, vercel.json, and a separate instance folder for the database).
- Database – SQLite stored within the backend’s instance folder, utilized via Flask-SQLAlchemy.

##### Architectural Patterns and Design Principles
- Deployment Considerations – With vercel.json files present in both the backend and frontend, note that deployment may be planned to Vercel, so consider illustrating the deployment space as a cloud environment if desired.

- Use clear labels for each component or module: “React Frontend,” “Flask API Backend,” and “SQLite Database.”
- Annotations briefly specifying frameworks or tools (e.g., “Vite + React”, “Flask + Flask-SQLAlchemy”, “SQLite”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "React Frontend"
        A1["React Frontend (Vite+React)"]:::frontend
        A2["Pages (About,Alerts,Score,Search,Settings)"]:::frontend
        A3["UI Components (Navbar,Autocomplete,BarCard,PieCard,RecentEventsCard,ScoreCard)"]:::frontend
        A4["Hooks (useCounties,useData)"]:::frontend
        A5["Configurations (vite.config.js)"]:::frontend
        A6["ESLint Configuration"]:::frontend
        A1 --> A2
        A1 --> A3
        A1 --> A4
        A1 --> A5
        A5 --> A6
    end

    subgraph "Flask API Backend"
        B1["Flask API Backend (Flask+SQLAlchemy)"]:::backend
        B2["Dependencies (requirements.txt)"]:::backend
        B3["Vercel Configuration"]:::backend
        B1 --> B2
        B1 --> B3
    end

    D["SQLite Database"]:::database

    A1 -->|"sendsAPIrequests"| B1
    B1 -->|"sendsresponses"| A1
    B1 -->|"dataqueries"| D
    D -->|"dataresponses"| B1

    click A1 "https://github.com/domthor/risk-radar/tree/main/frontend/"
    click A2 "https://github.com/domthor/risk-radar/tree/main/frontend/src/pages/"
    click A3 "https://github.com/domthor/risk-radar/tree/main/frontend/src/components/"
    click A4 "https://github.com/domthor/risk-radar/tree/main/frontend/src/hooks/"
    click A5 "https://github.com/domthor/risk-radar/blob/main/frontend/vite.config.js"
    click A6 "https://github.com/domthor/risk-radar/blob/main/frontend/eslint.config.js"
    click B1 "https://github.com/domthor/risk-radar/blob/main/backend/app.py"
    click B2 "https://github.com/domthor/risk-radar/blob/main/backend/requirements.txt"
    click B3 "https://github.com/domthor/risk-radar/blob/main/backend/vercel.json"
    click D "https://github.com/domthor/risk-radar/blob/main/backend/instance/database.db"

    classDef frontend fill:#add8e6,stroke:#000,stroke-width:1px,color:#000;
    classDef backend fill:#90ee90,stroke:#000,stroke-width:1px,color:#000;
    classDef database fill:#f4a460,stroke:#000,stroke-width:1px,color:#000;
```
