# gemini-feli/climate-safe-ai-homes architecture

> Architecture diagram of the GitHub repository gemini-feli/climate-safe-ai-homes, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gemini-feli/climate-safe-ai-homes
- Repository: https://github.com/gemini-feli/climate-safe-ai-homes

## Overview

ClimateSafe AI Homes is a climate-risk and resilient-housing web platform. The documented user journey is sign-in, location-based risk analysis, personalized advice, and dashboard review; the sampled implementation shows Firebase profiles, weather alerts, and a separate Flask chat/image-analysis service. The README also describes sustainability guidance and interactive home design, but their runtime wiring is not established by the excerpts. Dashed, uncited links mark these unverified connections; unsampled subsystems are represented only where documented.

Main entry points: [`backend/python_service/app.py`](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/python_service/app.py) (Chat and image API), [`frontend/js/index.js`](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/frontend/js/index.js) (Risk dashboard), [`backend/src/main/java/com/climatesafe/backend/controller/WeatherController.java`](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/controller/WeatherController.java) (Weather API), [`frontend`](https://github.com/gemini-feli/climate-safe-ai-homes/tree/main/frontend) (Web pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_frontend["Web pages"]
  node_dashboard["Risk dashboard<br/>[index.js]"]
  node_home_design["Home design"]
  node_sustainability["Sustainability insights"]
end

subgraph group_identity["Identity and alerts"]
  node_firebase_auth["Firebase Auth"]
  node_auth_api["Auth API"]
  node_auth_service["Auth service<br/>[AuthService.java]"]
  node_user_profile["User profile<br/>[User.java]"]
  node_firestore[("Firestore")]
  node_notifications["Push notifications"]
  node_alert_api["Alert API"]
  node_notification_service["Notification service"]
end

subgraph group_climate["Climate analysis"]
  node_weather_api["Weather API"]
  node_weather_service["Weather service"]
  node_weather_config["Weather config<br/>[WeatherConfig.java]"]
  node_weather_provider["OpenWeather"]
  node_earthquake_provider["USGS events"]
  node_risk_rules["Risk alerts"]
end

subgraph group_advice["Advice services"]
  node_chat_ui["Chat interface<br/>[chat.js]"]
  node_flask_service["Chat and image API<br/>[app.py]"]
  node_impact_model["Flood impact model<br/>[app.py]"]
  node_precautions["Precaution rules"]
  node_knowledge_search["Knowledge search"]
  node_ai_provider["AI text service"]
  node_recommendations["Home recommendations"]
end

node_resident(("Homeowner"))

node_resident -->|"uses"| node_frontend
node_frontend -.->|"registers profiles"| node_auth_api
node_frontend -->|"opens"| node_dashboard
node_dashboard -->|"requests alerts"| node_weather_api
node_weather_api -->|"gets weather"| node_weather_service
node_weather_service -->|"reads key"| node_weather_config
node_weather_service -->|"fetches conditions"| node_weather_provider
node_weather_api -->|"fetches events"| node_earthquake_provider
node_weather_api -->|"computes alerts"| node_risk_rules
node_risk_rules -->|"returns weather alerts"| node_dashboard
node_auth_api -->|"creates accounts"| node_firebase_auth
node_auth_api -->|"manages profiles"| node_auth_service
node_auth_service -->|"reads and writes"| node_user_profile
node_auth_service -->|"reads and writes"| node_firestore
node_dashboard -->|"reads and seeds profile"| node_firestore
node_dashboard -->|"initializes"| node_notifications
node_notifications -->|"registers token"| node_alert_api
node_alert_api -->|"sends notifications"| node_notification_service
node_resident -->|"asks for advice"| node_chat_ui
node_chat_ui -.->|"submits query or image"| node_flask_service
node_flask_service -->|"classifies image"| node_impact_model
node_flask_service -->|"selects guidance"| node_precautions
node_flask_service -->|"searches answers"| node_knowledge_search
node_flask_service -.->|"generates response"| node_ai_provider
node_resident -.->|"requests guidance"| node_recommendations
node_recommendations -.->|"informs modifications"| node_home_design
node_recommendations -.->|"informs improvements"| node_sustainability

click node_frontend "https://github.com/gemini-feli/climate-safe-ai-homes/tree/main/frontend"
click node_dashboard "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/frontend/js/index.js"
click node_home_design "https://github.com/gemini-feli/climate-safe-ai-homes/tree/main/frontend"
click node_sustainability "https://github.com/gemini-feli/climate-safe-ai-homes/tree/main/frontend"
click node_auth_api "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/controller/AuthController.java"
click node_auth_service "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/service/AuthService.java"
click node_user_profile "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/model/User.java"
click node_notifications "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/frontend/js/firebase-notifications.js"
click node_alert_api "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/controller/AlertController.java"
click node_notification_service "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/service/NotificationService.java"
click node_weather_api "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/controller/WeatherController.java"
click node_weather_service "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/service/WeatherService.java"
click node_weather_config "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/config/WeatherConfig.java"
click node_risk_rules "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/controller/WeatherController.java"
click node_chat_ui "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/frontend/js/chat.js"
click node_flask_service "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/python_service/app.py"
click node_impact_model "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/python_service/app.py"
click node_precautions "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/python_service/disaster_precautions.py"
click node_knowledge_search "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/python_service/firestore_search.py"
click node_recommendations "https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/controller/AdviceController.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_dashboard,node_home_design,node_sustainability toneBlue
class node_firebase_auth,node_auth_api,node_auth_service,node_user_profile,node_firestore,node_notifications,node_alert_api,node_notification_service toneAmber
class node_weather_api,node_weather_service,node_weather_config,node_weather_provider,node_earthquake_provider,node_risk_rules toneMint
class node_chat_ui,node_flask_service,node_impact_model,node_precautions,node_knowledge_search,node_ai_provider,node_recommendations toneRose
class node_resident toneIndigo
```

## Components

### Web experience

- [Web pages](https://github.com/gemini-feli/climate-safe-ai-homes/tree/main/frontend): `frontend`
- [Risk dashboard](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/frontend/js/index.js): `frontend/js/index.js`
- [Home design](https://github.com/gemini-feli/climate-safe-ai-homes/tree/main/frontend): `frontend`
- [Sustainability insights](https://github.com/gemini-feli/climate-safe-ai-homes/tree/main/frontend): `frontend`

### Identity and alerts

- **Firebase Auth**
- [Auth API](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/controller/AuthController.java): `backend/src/main/java/com/climatesafe/backend/controller/AuthController.java`
- [Auth service](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/service/AuthService.java): `backend/src/main/java/com/climatesafe/backend/service/AuthService.java`
- [User profile](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/model/User.java): `backend/src/main/java/com/climatesafe/backend/model/User.java`
- **Firestore**
- [Push notifications](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/frontend/js/firebase-notifications.js): `frontend/js/firebase-notifications.js`
- [Alert API](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/controller/AlertController.java): `backend/src/main/java/com/climatesafe/backend/controller/AlertController.java`
- [Notification service](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/service/NotificationService.java): `backend/src/main/java/com/climatesafe/backend/service/NotificationService.java`

### Climate analysis

- [Weather API](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/controller/WeatherController.java): `backend/src/main/java/com/climatesafe/backend/controller/WeatherController.java`
- [Weather service](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/service/WeatherService.java): `backend/src/main/java/com/climatesafe/backend/service/WeatherService.java`
- [Weather config](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/config/WeatherConfig.java): `backend/src/main/java/com/climatesafe/backend/config/WeatherConfig.java`
- **OpenWeather**
- **USGS events**
- [Risk alerts](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/controller/WeatherController.java): `backend/src/main/java/com/climatesafe/backend/controller/WeatherController.java`

### Advice services

- [Chat interface](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/frontend/js/chat.js): `frontend/js/chat.js`
- [Chat and image API](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/python_service/app.py): `backend/python_service/app.py`
- [Flood impact model](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/python_service/app.py): `backend/python_service/app.py`
- [Precaution rules](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/python_service/disaster_precautions.py): `backend/python_service/disaster_precautions.py`
- [Knowledge search](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/python_service/firestore_search.py): `backend/python_service/firestore_search.py`
- **AI text service**
- [Home recommendations](https://github.com/gemini-feli/climate-safe-ai-homes/blob/main/backend/src/main/java/com/climatesafe/backend/controller/AdviceController.java): `backend/src/main/java/com/climatesafe/backend/controller/AdviceController.java`

### Other components

- **Homeowner**

## Connections

- Homeowner → Web pages: uses (evidence: `README.md`)
- Web pages → Auth API: registers profiles
- Web pages → Risk dashboard: opens (evidence: `README.md`)
- Risk dashboard → Weather API: requests alerts (evidence: `frontend/js/index.js`)
- Weather API → Weather service: gets weather (evidence: `backend/src/main/java/com/climatesafe/backend/controller/WeatherController.java`)
- Weather service → Weather config: reads key (evidence: `backend/src/main/java/com/climatesafe/backend/service/WeatherService.java`)
- Weather service → OpenWeather: fetches conditions (evidence: `backend/src/main/java/com/climatesafe/backend/service/WeatherService.java`)
- Weather API → USGS events: fetches events (evidence: `backend/src/main/java/com/climatesafe/backend/controller/WeatherController.java`)
- Weather API → Risk alerts: computes alerts (evidence: `backend/src/main/java/com/climatesafe/backend/controller/WeatherController.java`)
- Risk alerts → Risk dashboard: returns weather alerts (evidence: `frontend/js/index.js`)
- Auth API → Firebase Auth: creates accounts (evidence: `backend/src/main/java/com/climatesafe/backend/controller/AuthController.java`)
- Auth API → Auth service: manages profiles (evidence: `backend/src/main/java/com/climatesafe/backend/controller/AuthController.java`)
- Auth service → User profile: reads and writes (evidence: `backend/src/main/java/com/climatesafe/backend/service/AuthService.java`)
- Auth service → Firestore: reads and writes (evidence: `backend/src/main/java/com/climatesafe/backend/service/AuthService.java`)
- Risk dashboard → Firestore: reads and seeds profile (evidence: `frontend/js/index.js`)
- Risk dashboard → Push notifications: initializes (evidence: `frontend/js/index.js`)
- Push notifications → Alert API: registers token (evidence: `frontend/js/firebase-notifications.js`)
- Alert API → Notification service: sends notifications (evidence: `backend/src/main/java/com/climatesafe/backend/controller/AlertController.java`)
- Homeowner → Chat interface: asks for advice (evidence: `README.md`)
- Chat interface → Chat and image API: submits query or image
- Chat and image API → Flood impact model: classifies image (evidence: `backend/python_service/app.py`)
- Chat and image API → Precaution rules: selects guidance (evidence: `backend/python_service/app.py`)
- Chat and image API → Knowledge search: searches answers (evidence: `backend/python_service/app.py`)
- Chat and image API → AI text service: generates response
- Homeowner → Home recommendations: requests guidance
- Home recommendations → Home design: informs modifications
- Home recommendations → Sustainability insights: informs improvements
