# daisukebtw/ipty architecture

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

- Interactive diagram: https://gitdiagram.com/daisukebtw/ipty
- Repository: https://github.com/daisukebtw/ipty

## Overview

IPTY is a small public-IP lookup service: a visitor opens the web page, which requests the visitor’s IP from the API and displays it, with copy actions for the IP and a curl command. The API derives the address from forwarding headers or the request connection. Source excerpts show the frontend routing, request, and API logic; the README provides no additional feature detail.

Main entry points: [`app/src/components/IPDisplay.tsx`](https://github.com/daisukebtw/ipty/blob/main/app/src/components/IPDisplay.tsx) (IP display), [`app/src/App.tsx`](https://github.com/daisukebtw/ipty/blob/main/app/src/App.tsx) (App shell), [`app/src/pages/Index.tsx`](https://github.com/daisukebtw/ipty/blob/main/app/src/pages/Index.tsx) (Home page), [`api/api.py`](https://github.com/daisukebtw/ipty/blob/main/api/api.py) (IP endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app_entry["App entry<br/>[main.tsx]"]
  node_app_shell["App shell<br/>[App.tsx]"]
  node_home_page["Home page<br/>[Index.tsx]"]
  node_ip_display["IP display<br/>[IPDisplay.tsx]"]
  node_github_link["GitHub link<br/>[GitHubLink.tsx]"]
end

subgraph group_api["IP API"]
  node_ip_endpoint["IP endpoint<br/>[api.py]"]
  node_ip_resolution["IP resolution<br/>[api.py]"]
end

subgraph group_support["UI support"]
  node_toast_hook["Toast state<br/>[use-toast.ts]"]
  node_button_component["Button component<br/>[button.tsx]"]
  node_ui_primitives["UI primitives"]
end

node_visitor(("Visitor"))

node_visitor -.->|"opens"| node_app_entry
node_app_entry -->|"renders"| node_app_shell
node_app_shell -->|"routes to"| node_home_page
node_home_page -->|"renders"| node_ip_display
node_home_page -->|"renders"| node_github_link
node_ip_display -->|"fetches IP"| node_ip_endpoint
node_ip_endpoint -->|"resolves address"| node_ip_resolution
node_ip_resolution -->|"returns address"| node_ip_endpoint
node_ip_display -->|"reports status"| node_toast_hook
node_ip_display -->|"renders"| node_button_component
node_app_shell -->|"configures providers"| node_ui_primitives

click node_app_entry "https://github.com/daisukebtw/ipty/blob/main/app/src/main.tsx"
click node_app_shell "https://github.com/daisukebtw/ipty/blob/main/app/src/App.tsx"
click node_home_page "https://github.com/daisukebtw/ipty/blob/main/app/src/pages/Index.tsx"
click node_ip_display "https://github.com/daisukebtw/ipty/blob/main/app/src/components/IPDisplay.tsx"
click node_github_link "https://github.com/daisukebtw/ipty/blob/main/app/src/components/GitHubLink.tsx"
click node_ip_endpoint "https://github.com/daisukebtw/ipty/blob/main/api/api.py"
click node_ip_resolution "https://github.com/daisukebtw/ipty/blob/main/api/api.py"
click node_toast_hook "https://github.com/daisukebtw/ipty/blob/main/app/src/hooks/use-toast.ts"
click node_button_component "https://github.com/daisukebtw/ipty/blob/main/app/src/components/ui/button.tsx"
click node_ui_primitives "https://github.com/daisukebtw/ipty/tree/main/app/src/components/ui"

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_app_entry,node_app_shell,node_home_page,node_ip_display,node_github_link toneBlue
class node_ip_endpoint,node_ip_resolution toneAmber
class node_toast_hook,node_button_component,node_ui_primitives toneMint
class node_visitor toneIndigo
```

## Components

### Web experience

- [App entry](https://github.com/daisukebtw/ipty/blob/main/app/src/main.tsx): `app/src/main.tsx`
- [App shell](https://github.com/daisukebtw/ipty/blob/main/app/src/App.tsx): `app/src/App.tsx`
- [Home page](https://github.com/daisukebtw/ipty/blob/main/app/src/pages/Index.tsx): `app/src/pages/Index.tsx`
- [IP display](https://github.com/daisukebtw/ipty/blob/main/app/src/components/IPDisplay.tsx): `app/src/components/IPDisplay.tsx`
- [GitHub link](https://github.com/daisukebtw/ipty/blob/main/app/src/components/GitHubLink.tsx): `app/src/components/GitHubLink.tsx`

### IP API

- [IP endpoint](https://github.com/daisukebtw/ipty/blob/main/api/api.py): `api/api.py`
- [IP resolution](https://github.com/daisukebtw/ipty/blob/main/api/api.py): `api/api.py`

### UI support

- [Toast state](https://github.com/daisukebtw/ipty/blob/main/app/src/hooks/use-toast.ts): `app/src/hooks/use-toast.ts`
- [Button component](https://github.com/daisukebtw/ipty/blob/main/app/src/components/ui/button.tsx): `app/src/components/ui/button.tsx`
- [UI primitives](https://github.com/daisukebtw/ipty/tree/main/app/src/components/ui): `app/src/components/ui`

### Other components

- **Visitor**

## Connections

- Visitor → App entry: opens
- App entry → App shell: renders (evidence: `app/src/main.tsx`)
- App shell → Home page: routes to (evidence: `app/src/App.tsx`)
- Home page → IP display: renders (evidence: `app/src/pages/Index.tsx`)
- Home page → GitHub link: renders (evidence: `app/src/pages/Index.tsx`)
- IP display → IP endpoint: fetches IP (evidence: `app/src/components/IPDisplay.tsx`)
- IP endpoint → IP resolution: resolves address (evidence: `api/api.py`)
- IP resolution → IP endpoint: returns address (evidence: `api/api.py`)
- IP display → Toast state: reports status (evidence: `app/src/components/IPDisplay.tsx`)
- IP display → Button component: renders (evidence: `app/src/components/IPDisplay.tsx`)
- App shell → UI primitives: configures providers (evidence: `app/src/App.tsx`)
