# malaysiasurfer/petproj architecture

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

- Interactive diagram: https://gitdiagram.com/malaysiasurfer/petproj
- Repository: https://github.com/malaysiasurfer/petproj

## Overview

This repository is a minimal FastAPI service with a health endpoint and startup database connectivity check. Its runtime workflow is an HTTP health request handled by FastAPI; separately, application startup opens an async SQLAlchemy session and verifies the configured PostgreSQL connection. The tree and sampled source show no broader domain features. Database model support is limited to a declarative base; migration files are not runtime product components. Database wiring is evidenced in app/main.py, but no migration-to-runtime invocation is shown.

Main entry points: [`app/main.py`](https://github.com/malaysiasurfer/petproj/blob/main/app/main.py) (FastAPI app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["API service"]
  node_fastapi["FastAPI app<br/>[main.py]"]
  node_health["Health check<br/>[main.py]"]
end

subgraph group_database["Database access"]
  node_settings["Database settings<br/>[main.py]"]
  node_session["Async session<br/>[main.py]"]
  node_base["Declarative base<br/>[base.py]"]
end

node_client(("HTTP client"))
node_postgres[("PostgreSQL")]

node_client -->|"sends request"| node_fastapi
node_fastapi -->|"dispatches"| node_health
node_fastapi -->|"loads settings"| node_settings
node_settings -->|"configures"| node_session
node_session -->|"checks connection"| node_postgres

click node_fastapi "https://github.com/malaysiasurfer/petproj/blob/main/app/main.py"
click node_health "https://github.com/malaysiasurfer/petproj/blob/main/app/main.py"
click node_settings "https://github.com/malaysiasurfer/petproj/blob/main/app/main.py"
click node_session "https://github.com/malaysiasurfer/petproj/blob/main/app/main.py"
click node_base "https://github.com/malaysiasurfer/petproj/blob/main/app/db/base.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_fastapi,node_health,node_client toneBlue
class node_settings,node_session,node_base,node_postgres toneAmber
```

## Components

### API service

- [FastAPI app](https://github.com/malaysiasurfer/petproj/blob/main/app/main.py): `app/main.py`
- [Health check](https://github.com/malaysiasurfer/petproj/blob/main/app/main.py): `app/main.py`

### Database access

- [Database settings](https://github.com/malaysiasurfer/petproj/blob/main/app/main.py): `app/main.py`
- [Async session](https://github.com/malaysiasurfer/petproj/blob/main/app/main.py): `app/main.py`
- [Declarative base](https://github.com/malaysiasurfer/petproj/blob/main/app/db/base.py): `app/db/base.py`

### Other components

- **HTTP client**
- **PostgreSQL**

## Connections

- HTTP client → FastAPI app: sends request
- FastAPI app → Health check: dispatches
- FastAPI app → Database settings: loads settings
- Database settings → Async session: configures
- Async session → PostgreSQL: checks connection
