# devlm/cloud_campus_countries_search architecture

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

- Interactive diagram: https://gitdiagram.com/devlm/cloud_campus_countries_search
- Repository: https://github.com/devlm/cloud_campus_countries_search

## Overview

Countries Search is a client-side country discovery app. Users start at the home page, search or browse REST Countries results, refine by region and country code, open a country’s details, and save or remove favorites; the dashboard provides a separate favorites view. TanStack Router connects the application entry point to these route screens. The search and detail request flows are visible in excerpts; the dashboard implementation was not excerpted, so its favorites relationship is based on the SOURCE INDEX. Other unsampled internals are not inferred.

Main entry points: [`src/routes/search.tsx`](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routes/search.tsx) (Search and filters), [`src/routeTree.gen.ts`](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routeTree.gen.ts) (Route tree), [`src/routes/country.$code.tsx`](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routes/country.%24code.tsx) (Country details), [`src/store/favorites.ts`](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/store/favorites.ts) (Favorites state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App and navigation"]
  node_entry["App entry<br/>[main.tsx]"]
  node_router["Router config<br/>[router.tsx]"]
  node_route_tree["Route tree<br/>[routeTree.gen.ts]"]
  node_home["Home page<br/>[index.tsx]"]
  node_root["Root route<br/>[__root.tsx]"]
end

subgraph group_discovery["Country discovery"]
  node_search["Search and filters<br/>[search.tsx]"]
  node_select["Region selector<br/>[select.tsx]"]
  node_rest_api{{"REST Countries API"}}
end

subgraph group_country["Country information"]
  node_country_type["Country data model<br/>[country.ts]"]
  node_details["Country details<br/>[country.$code.tsx]"]
end

subgraph group_favorites["Favorites"]
  node_dashboard["Favorites dashboard<br/>[dashboard.tsx]"]
  node_favorites_store["Favorites state<br/>[favorites.ts]"]
  node_browser_storage[("Browser local storage")]
end

node_visitor(("Visitor"))

node_visitor -->|"opens app"| node_entry
node_entry -->|"renders router"| node_router
node_router -->|"uses route tree"| node_route_tree
node_route_tree -->|"registers root"| node_root
node_route_tree -->|"registers route"| node_home
node_route_tree -->|"registers route"| node_search
node_route_tree -->|"registers route"| node_details
node_route_tree -->|"registers route"| node_dashboard
node_home -->|"links to"| node_search
node_search -->|"fetches countries"| node_rest_api
node_search -->|"renders selector"| node_select
node_search -->|"uses country type"| node_country_type
node_search -->|"links to details"| node_details
node_search -->|"updates favorites"| node_favorites_store
node_details -->|"fetches country"| node_rest_api
node_details -->|"uses country type"| node_country_type
node_details -->|"updates favorites"| node_favorites_store
node_dashboard -->|"reads favorites"| node_favorites_store
node_favorites_store -->|"reads and writes"| node_browser_storage

click node_entry "https://github.com/devlm/cloud_campus_countries_search/blob/master/src/main.tsx"
click node_router "https://github.com/devlm/cloud_campus_countries_search/blob/master/src/router.tsx"
click node_route_tree "https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routeTree.gen.ts"
click node_home "https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routes/index.tsx"
click node_root "https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routes/__root.tsx"
click node_search "https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routes/search.tsx"
click node_select "https://github.com/devlm/cloud_campus_countries_search/blob/master/src/components/ui/select.tsx"
click node_country_type "https://github.com/devlm/cloud_campus_countries_search/blob/master/src/types/country.ts"
click node_details "https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routes/country.%24code.tsx"
click node_dashboard "https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routes/dashboard.tsx"
click node_favorites_store "https://github.com/devlm/cloud_campus_countries_search/blob/master/src/store/favorites.ts"

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_entry,node_router,node_route_tree,node_home,node_root toneBlue
class node_search,node_select,node_rest_api toneAmber
class node_country_type,node_details toneMint
class node_dashboard,node_favorites_store,node_browser_storage toneRose
class node_visitor toneIndigo
```

## Components

### App and navigation

- [App entry](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/main.tsx): `src/main.tsx`
- [Router config](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/router.tsx): `src/router.tsx`
- [Route tree](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routeTree.gen.ts): `src/routeTree.gen.ts`
- [Home page](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routes/index.tsx): `src/routes/index.tsx`
- [Root route](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routes/__root.tsx): `src/routes/__root.tsx`

### Country discovery

- [Search and filters](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routes/search.tsx): `src/routes/search.tsx`
- [Region selector](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/components/ui/select.tsx): `src/components/ui/select.tsx`
- **REST Countries API**

### Country information

- [Country data model](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/types/country.ts): `src/types/country.ts`
- [Country details](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routes/country.%24code.tsx): `src/routes/country.$code.tsx`

### Favorites

- [Favorites dashboard](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/routes/dashboard.tsx): `src/routes/dashboard.tsx`
- [Favorites state](https://github.com/devlm/cloud_campus_countries_search/blob/master/src/store/favorites.ts): `src/store/favorites.ts`
- **Browser local storage**

### Other components

- **Visitor**

## Connections

- Visitor → App entry: opens app
- App entry → Router config: renders router (evidence: `src/main.tsx`)
- Router config → Route tree: uses route tree (evidence: `src/router.tsx`)
- Route tree → Root route: registers root (evidence: `src/routeTree.gen.ts`)
- Route tree → Home page: registers route (evidence: `src/routeTree.gen.ts`)
- Route tree → Search and filters: registers route (evidence: `src/routeTree.gen.ts`)
- Route tree → Country details: registers route (evidence: `src/routeTree.gen.ts`)
- Route tree → Favorites dashboard: registers route (evidence: `src/routeTree.gen.ts`)
- Home page → Search and filters: links to (evidence: `src/routes/index.tsx`)
- Search and filters → REST Countries API: fetches countries (evidence: `src/routes/search.tsx`)
- Search and filters → Region selector: renders selector (evidence: `src/routes/search.tsx`)
- Search and filters → Country data model: uses country type (evidence: `src/routes/search.tsx`)
- Search and filters → Country details: links to details (evidence: `src/routes/search.tsx`)
- Search and filters → Favorites state: updates favorites (evidence: `src/routes/search.tsx`)
- Country details → REST Countries API: fetches country (evidence: `src/routes/country.$code.tsx`)
- Country details → Country data model: uses country type (evidence: `src/routes/country.$code.tsx`)
- Country details → Favorites state: updates favorites (evidence: `src/routes/country.$code.tsx`)
- Favorites dashboard → Favorites state: reads favorites (evidence: `src/routes/dashboard.tsx`)
- Favorites state → Browser local storage: reads and writes (evidence: `src/store/favorites.ts`)
