# richi1213/nat-geo-react-typescript architecture

> Architecture diagram of the GitHub repository richi1213/nat-geo-react-typescript, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/richi1213/nat-geo-react-typescript
- Repository: https://github.com/richi1213/nat-geo-react-typescript

## Overview

This repository is a React-based National Geographic-style content site. The main workflow is a visitor navigating routed content, searching and filtering articles, and opening article pages; authenticated users can also write articles and manage their own articles. The tree additionally shows category, impact, and home experiences, plus shared navigation, authentication, and media components. Edges are limited to relationships visible in excerpts or the source index; several feature-to-data connections remain uncertain because their implementation files were not sampled.

Main entry points: [`src/routes/router.tsx`](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/routes/router.tsx) (Route map), [`src/supabase/supabase-client.ts`](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/supabase/supabase-client.ts) (Supabase client), [`src/App.tsx`](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/App.tsx) (App component), [`src/pages/search/components/search-page.tsx`](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/pages/search/components/search-page.tsx) (Search experience)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app_entry["React entry<br/>[main.tsx]"]
  node_app_component["App component<br/>[App.tsx]"]
  node_router["Route map<br/>[router.tsx]"]
  node_auth_guard["Auth guard"]
  node_site_layout["Site layout<br/>[default-layout.tsx]"]
end

subgraph group_content["Content experiences"]
  node_home["Home experience"]
  node_category["Category experience"]
  node_article["Article experience"]
  node_impact["Impact experience"]
end

subgraph group_engagement["Search and authoring"]
  node_search_page["Search experience<br/>[search-page.tsx]"]
  node_search_state["Search state"]
  node_search_query["Article search query"]
  node_write_article["Article authoring<br/>[article-form.tsx]"]
  node_my_articles["My articles"]
  node_auth_ui["Authentication forms"]
end

subgraph group_services["Data and shared services"]
  node_supabase["Supabase client<br/>[supabase-client.ts]"]
  node_article_services["Article services"]
  node_search_services["Search services"]
  node_storage_services["Media storage"]
  node_profile_services["Profile services"]
  node_shared_hooks["Shared hooks"]
  node_search_utils["Search utilities"]
  node_core_utilities["Core utilities"]
end

node_visitor(("Site visitor"))
node_routes(("Browser user"))

node_visitor -->|"opens site"| node_app_entry
node_app_entry -->|"renders"| node_app_component
node_app_component -->|"uses routes"| node_router
node_router -->|"wraps routes"| node_site_layout
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_category
node_router -->|"routes to"| node_article
node_router -->|"routes to"| node_search_page
node_router -->|"routes to"| node_write_article
node_router -->|"routes to"| node_my_articles
node_router -->|"guards access"| node_auth_guard
node_router -->|"exports page"| node_impact
node_search_page -->|"reads state"| node_search_state
node_search_page -->|"requests results"| node_search_query
node_search_query -.->|"queries data"| node_supabase
node_search_services -->|"queries articles"| node_supabase
node_article_services -->|"accesses data"| node_supabase
node_storage_services -->|"stores media"| node_supabase
node_profile_services -->|"accesses profiles"| node_supabase
node_search_services -->|"builds query"| node_search_utils
node_search_query -->|"uses helpers"| node_core_utilities
node_app_component -.->|"exposes features"| node_shared_hooks

click node_app_entry "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/main.tsx"
click node_app_component "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/App.tsx"
click node_router "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/routes/router.tsx"
click node_auth_guard "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/routes/guards/is-unauthorized-guard.tsx"
click node_site_layout "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/components/layouts/default/default-layout.tsx"
click node_home "https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/pages/home"
click node_category "https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/pages/category"
click node_article "https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/pages/single-article"
click node_impact "https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/pages/impact"
click node_search_page "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/pages/search/components/search-page.tsx"
click node_search_state "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/hooks/use-search-state.ts"
click node_search_query "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/hooks/react-query/queries/articles/use-searched-articles.ts"
click node_write_article "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/pages/write-article/components/form/article-form.tsx"
click node_my_articles "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/pages/my-articles/components/my-articles-page.tsx"
click node_auth_ui "https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/components/auth/enter-email"
click node_supabase "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/supabase/supabase-client.ts"
click node_article_services "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/supabase/api/articles/article-services.ts"
click node_search_services "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/supabase/api/articles/search/search-article-services.ts"
click node_storage_services "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/supabase/api/storage/storage-services.ts"
click node_profile_services "https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/supabase/api/profiles/profile-services.ts"
click node_shared_hooks "https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/hooks"
click node_search_utils "https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/utils/search"
click node_core_utilities "https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/utils"

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_component,node_router,node_auth_guard,node_site_layout,node_routes toneBlue
class node_home,node_category,node_article,node_impact toneAmber
class node_search_page,node_search_state,node_search_query,node_write_article,node_my_articles,node_auth_ui toneMint
class node_supabase,node_article_services,node_search_services,node_storage_services,node_profile_services,node_shared_hooks,node_search_utils,node_core_utilities toneRose
class node_visitor toneIndigo
```

## Components

### Application shell

- [React entry](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/main.tsx): `src/main.tsx`
- [App component](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/App.tsx): `src/App.tsx`
- [Route map](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/routes/router.tsx): `src/routes/router.tsx`
- [Auth guard](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/routes/guards/is-unauthorized-guard.tsx): `src/routes/guards/is-unauthorized-guard.tsx`
- [Site layout](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/components/layouts/default/default-layout.tsx): `src/components/layouts/default/default-layout.tsx`

### Content experiences

- [Home experience](https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/pages/home): `src/pages/home`
- [Category experience](https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/pages/category): `src/pages/category`
- [Article experience](https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/pages/single-article): `src/pages/single-article`
- [Impact experience](https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/pages/impact): `src/pages/impact`

### Search and authoring

- [Search experience](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/pages/search/components/search-page.tsx): `src/pages/search/components/search-page.tsx`
- [Search state](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/hooks/use-search-state.ts): `src/hooks/use-search-state.ts`
- [Article search query](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/hooks/react-query/queries/articles/use-searched-articles.ts): `src/hooks/react-query/queries/articles/use-searched-articles.ts`
- [Article authoring](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/pages/write-article/components/form/article-form.tsx): `src/pages/write-article/components/form/article-form.tsx`
- [My articles](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/pages/my-articles/components/my-articles-page.tsx): `src/pages/my-articles/components/my-articles-page.tsx`
- [Authentication forms](https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/components/auth/enter-email): `src/components/auth/enter-email`

### Data and shared services

- [Supabase client](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/supabase/supabase-client.ts): `src/supabase/supabase-client.ts`
- [Article services](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/supabase/api/articles/article-services.ts): `src/supabase/api/articles/article-services.ts`
- [Search services](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/supabase/api/articles/search/search-article-services.ts): `src/supabase/api/articles/search/search-article-services.ts`
- [Media storage](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/supabase/api/storage/storage-services.ts): `src/supabase/api/storage/storage-services.ts`
- [Profile services](https://github.com/richi1213/nat-geo-react-typescript/blob/main/src/supabase/api/profiles/profile-services.ts): `src/supabase/api/profiles/profile-services.ts`
- [Shared hooks](https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/hooks): `src/hooks`
- [Search utilities](https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/utils/search): `src/utils/search`
- [Core utilities](https://github.com/richi1213/nat-geo-react-typescript/tree/main/src/utils): `src/utils`

### Other components

- **Site visitor**
- **Browser user**

## Connections

- Site visitor → React entry: opens site (evidence: `src/main.tsx`)
- React entry → App component: renders (evidence: `src/main.tsx`)
- App component → Route map: uses routes (evidence: `src/App.tsx`)
- Route map → Site layout: wraps routes (evidence: `src/routes/router.tsx`)
- Route map → Home experience: routes to (evidence: `src/routes/router.tsx`)
- Route map → Category experience: routes to (evidence: `src/routes/router.tsx`)
- Route map → Article experience: routes to (evidence: `src/routes/router.tsx`)
- Route map → Search experience: routes to (evidence: `src/routes/router.tsx`)
- Route map → Article authoring: routes to (evidence: `src/routes/router.tsx`)
- Route map → My articles: routes to (evidence: `src/routes/router.tsx`)
- Route map → Auth guard: guards access (evidence: `src/routes/router.tsx`)
- Route map → Impact experience: exports page
- Search experience → Search state: reads state (evidence: `src/pages/search/components/search-page.tsx`)
- Search experience → Article search query: requests results (evidence: `src/pages/search/components/search-page.tsx`)
- Article search query → Supabase client: queries data
- Search services → Supabase client: queries articles (evidence: `src/supabase/api/articles/search/search-article-services.ts`)
- Article services → Supabase client: accesses data (evidence: `src/supabase/api/articles/article-services.ts`)
- Media storage → Supabase client: stores media (evidence: `src/supabase/api/storage/storage-services.ts`)
- Profile services → Supabase client: accesses profiles (evidence: `src/supabase/api/profiles/profile-services.ts`)
- Search services → Search utilities: builds query (evidence: `src/supabase/api/articles/search/search-article-services.ts`)
- Article search query → Core utilities: uses helpers (evidence: `src/hooks/react-query/queries/articles/use-searched-articles.ts`)
- App component → Shared hooks: exposes features
