# dennivalentin/projet_info_2a architecture

> Architecture diagram of the GitHub repository dennivalentin/projet_info_2a, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dennivalentin/projet_info_2a
- Repository: https://github.com/dennivalentin/projet_info_2a

## Overview

NEO-Watch is a Streamlit interface backed by a FastAPI service and PostgreSQL, with NASA NeoWs supplying asteroid and approach data. Users authenticate, explore/search NEOs, and use dashboard, statistics, favourites, alerts, user-declared observations, and NASA’s Picture of the Day. The import service fetches and persists NASA data; API controllers expose domain features through services and DAOs. The README establishes the product capabilities and frontend/backend split; indexed references and sampled excerpts support only some internal call paths, so unsampled feature links are omitted.

Main entry points: [`backend/src/controller`](https://github.com/dennivalentin/projet_info_2a/tree/main/backend/src/controller) (Feature controllers), [`backend/src/dao`](https://github.com/dennivalentin/projet_info_2a/tree/main/backend/src/dao) (Data access), [`backend/src/service/import_service.py`](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/service/import_service.py) (NASA import), [`frontend/src/pages`](https://github.com/dennivalentin/projet_info_2a/tree/main/frontend/src/pages) (Feature pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_frontend["Streamlit app<br/>[app.py]"]
  node_pages["Feature pages"]
  node_authguard["Auth guard<br/>[auth_guard.py]"]
  node_apiclient["API client<br/>[api_client.py]"]
end

subgraph group_api["API and services"]
  node_backend["FastAPI entry<br/>[main.py]"]
  node_controllers["Feature controllers"]
  node_userservice["Account service<br/>[user_service.py]"]
  node_neoservice["NEO service<br/>[neo_service.py]"]
end

subgraph group_domain["NEO domain"]
  node_importservice["NASA import<br/>[import_service.py]"]
  node_alertservice["Alert service<br/>[alert_service.py]"]
  node_favouriteservice["Favourites service"]
  node_featureservices["Other feature services"]
  node_neomodel["NEO model<br/>[neo.py]"]
  node_approachmodel["Approach model<br/>[approach.py]"]
  node_importmodel["Import record<br/>[import_bo.py]"]
  node_alertmodel["Alert model<br/>[alert.py]"]
  node_usermodel["User model<br/>[user.py]"]
end

subgraph group_persistence["Persistence"]
  node_daos["Data access"]
  node_dbconnection["DB connection<br/>[db_connection.py]"]
end

node_user(("User"))
node_postgres[("PostgreSQL")]
node_nasa["NASA NeoWs"]
node_apod["NASA APOD"]

node_user -->|"uses"| node_frontend
node_frontend -->|"shows"| node_pages
node_pages -->|"checks access"| node_authguard
node_pages -->|"sends requests"| node_apiclient
node_apiclient -->|"calls API"| node_backend
node_backend -->|"registers routes"| node_controllers
node_controllers -->|"delegates accounts"| node_userservice
node_controllers -->|"delegates NEOs"| node_neoservice
node_controllers -->|"delegates alerts"| node_alertservice
node_controllers -->|"delegates favourites"| node_favouriteservice
node_controllers -.->|"serves features"| node_featureservices
node_userservice -->|"uses user data"| node_daos
node_neoservice -->|"queries NEO data"| node_daos
node_alertservice -->|"reads and writes"| node_daos
node_favouriteservice -->|"reads favourites"| node_daos
node_importservice -->|"fetches feeds"| node_nasa
node_importservice -->|"saves imports"| node_daos
node_importservice -->|"builds objects"| node_neomodel
node_importservice -->|"builds objects"| node_approachmodel
node_importservice -->|"tracks task"| node_importmodel
node_alertservice -->|"evaluates alerts"| node_alertmodel
node_daos -->|"opens connections"| node_dbconnection
node_dbconnection -->|"connects"| node_postgres
node_userservice -->|"manages accounts"| node_usermodel
node_featureservices -.->|"retrieves picture"| node_apod
node_apod -.->|"requests APOD"| node_nasa

click node_frontend "https://github.com/dennivalentin/projet_info_2a/blob/main/frontend/src/app.py"
click node_pages "https://github.com/dennivalentin/projet_info_2a/tree/main/frontend/src/pages"
click node_authguard "https://github.com/dennivalentin/projet_info_2a/blob/main/frontend/src/utils/auth_guard.py"
click node_apiclient "https://github.com/dennivalentin/projet_info_2a/blob/main/frontend/src/utils/api_client.py"
click node_backend "https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/main.py"
click node_controllers "https://github.com/dennivalentin/projet_info_2a/tree/main/backend/src/controller"
click node_userservice "https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/service/user_service.py"
click node_neoservice "https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/service/neo_service.py"
click node_importservice "https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/service/import_service.py"
click node_alertservice "https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/service/alert_service.py"
click node_favouriteservice "https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/service/favourite_service.py"
click node_featureservices "https://github.com/dennivalentin/projet_info_2a/tree/main/backend/src/service"
click node_neomodel "https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/business_object/neo.py"
click node_approachmodel "https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/business_object/approach.py"
click node_importmodel "https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/business_object/import_bo.py"
click node_alertmodel "https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/business_object/alert.py"
click node_usermodel "https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/business_object/user.py"
click node_daos "https://github.com/dennivalentin/projet_info_2a/tree/main/backend/src/dao"
click node_dbconnection "https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/dao/db_connection.py"

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_pages,node_authguard,node_apiclient,node_user toneBlue
class node_backend,node_controllers,node_userservice,node_neoservice,node_postgres toneAmber
class node_importservice,node_alertservice,node_favouriteservice,node_featureservices,node_neomodel,node_approachmodel,node_importmodel,node_alertmodel,node_usermodel toneMint
class node_daos,node_dbconnection toneRose
class node_nasa,node_apod toneIndigo
```

## Components

### User interface

- [Streamlit app](https://github.com/dennivalentin/projet_info_2a/blob/main/frontend/src/app.py): `frontend/src/app.py`
- [Feature pages](https://github.com/dennivalentin/projet_info_2a/tree/main/frontend/src/pages): `frontend/src/pages`
- [Auth guard](https://github.com/dennivalentin/projet_info_2a/blob/main/frontend/src/utils/auth_guard.py): `frontend/src/utils/auth_guard.py`
- [API client](https://github.com/dennivalentin/projet_info_2a/blob/main/frontend/src/utils/api_client.py): `frontend/src/utils/api_client.py`

### API and services

- [FastAPI entry](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/main.py): `backend/src/main.py`
- [Feature controllers](https://github.com/dennivalentin/projet_info_2a/tree/main/backend/src/controller): `backend/src/controller`
- [Account service](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/service/user_service.py): `backend/src/service/user_service.py`
- [NEO service](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/service/neo_service.py): `backend/src/service/neo_service.py`

### NEO domain

- [NASA import](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/service/import_service.py): `backend/src/service/import_service.py`
- [Alert service](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/service/alert_service.py): `backend/src/service/alert_service.py`
- [Favourites service](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/service/favourite_service.py): `backend/src/service/favourite_service.py`
- [Other feature services](https://github.com/dennivalentin/projet_info_2a/tree/main/backend/src/service): `backend/src/service`
- [NEO model](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/business_object/neo.py): `backend/src/business_object/neo.py`
- [Approach model](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/business_object/approach.py): `backend/src/business_object/approach.py`
- [Import record](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/business_object/import_bo.py): `backend/src/business_object/import_bo.py`
- [Alert model](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/business_object/alert.py): `backend/src/business_object/alert.py`
- [User model](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/business_object/user.py): `backend/src/business_object/user.py`

### Persistence

- [Data access](https://github.com/dennivalentin/projet_info_2a/tree/main/backend/src/dao): `backend/src/dao`
- [DB connection](https://github.com/dennivalentin/projet_info_2a/blob/main/backend/src/dao/db_connection.py): `backend/src/dao/db_connection.py`

### Other components

- **User**
- **PostgreSQL**
- **NASA NeoWs**
- **NASA APOD**

## Connections

- User → Streamlit app: uses (evidence: `README.md`)
- Streamlit app → Feature pages: shows (evidence: `frontend/src/app.py`)
- Feature pages → Auth guard: checks access (evidence: `frontend/src/pages/alert.py`)
- Feature pages → API client: sends requests (evidence: `frontend/src/pages/alert.py`)
- API client → FastAPI entry: calls API (evidence: `README.md`)
- FastAPI entry → Feature controllers: registers routes (evidence: `backend/src/main.py`)
- Feature controllers → Account service: delegates accounts (evidence: `backend/src/controller/login_controller.py`)
- Feature controllers → NEO service: delegates NEOs (evidence: `backend/src/controller/neo_controller.py`)
- Feature controllers → Alert service: delegates alerts (evidence: `backend/src/controller/alert_controller.py`)
- Feature controllers → Favourites service: delegates favourites (evidence: `backend/src/controller/favourite_controller.py`)
- Feature controllers → Other feature services: serves features (evidence: `backend/src/controller/login_controller.py`)
- Account service → Data access: uses user data (evidence: `backend/src/service/user_service.py`)
- NEO service → Data access: queries NEO data (evidence: `backend/src/service/neo_service.py`)
- Alert service → Data access: reads and writes (evidence: `backend/src/service/alert_service.py`)
- Favourites service → Data access: reads favourites (evidence: `backend/src/service/favourite_service.py`)
- NASA import → NASA NeoWs: fetches feeds (evidence: `backend/src/service/import_service.py`)
- NASA import → Data access: saves imports (evidence: `backend/src/service/import_service.py`)
- NASA import → NEO model: builds objects (evidence: `backend/src/service/import_service.py`)
- NASA import → Approach model: builds objects (evidence: `backend/src/service/import_service.py`)
- NASA import → Import record: tracks task (evidence: `backend/src/service/import_service.py`)
- Alert service → Alert model: evaluates alerts (evidence: `backend/src/service/alert_service.py`)
- Data access → DB connection: opens connections (evidence: `backend/src/dao/user_dao.py`)
- DB connection → PostgreSQL: connects (evidence: `backend/src/dao/db_connection.py`)
- Account service → User model: manages accounts (evidence: `backend/src/service/user_service.py`)
- Other feature services → NASA APOD: retrieves picture
- NASA APOD → NASA NeoWs: requests APOD
