# spacejhmoon/myblog architecture

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

- Interactive diagram: https://gitdiagram.com/spacejhmoon/myblog
- Repository: https://github.com/spacejhmoon/myblog

## Overview

This is a React blogging application backed by Supabase. Users can sign up or log in, create posts with tags and visibility settings, and navigate to post details or their profile. App.tsx owns page routing; authentication state is provided globally, while page handlers call Supabase or the post/profile helpers. The README describes only the starter template, so it does not establish additional product capabilities. Unsampled page behavior and database interactions are not inferred beyond the indexed references.

Main entry points: [`src/App.tsx`](https://github.com/spacejhmoon/myblog/blob/master/src/App.tsx) (Route application), [`src/lib/supabase.ts`](https://github.com/spacejhmoon/myblog/blob/master/src/lib/supabase.ts) (Supabase client), [`src/pages/SignupPage.tsx`](https://github.com/spacejhmoon/myblog/blob/master/src/pages/SignupPage.tsx) (Registration), [`src/pages/WritePage.tsx`](https://github.com/spacejhmoon/myblog/blob/master/src/pages/WritePage.tsx) (Post editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application and navigation"]
  node_router["Route application<br/>[App.tsx]"]
  node_layout["Page layout<br/>[Layout.tsx]"]
  node_navbar["Navigation bar<br/>[Navbar.tsx]"]
end

subgraph group_identity["Identity and profiles"]
  node_login["Sign in<br/>[LoginPage.tsx]"]
  node_signup["Registration<br/>[SignupPage.tsx]"]
  node_auth["Auth state<br/>[AuthContext.tsx]"]
  node_profile["User profile<br/>[MePage.tsx]"]
  node_profiledata["Profile helper<br/>[profiles.ts]"]
end

subgraph group_publishing["Post publishing"]
  node_main["Post listing<br/>[MainPage.tsx]"]
  node_detail["Post detail<br/>[DetailPage.tsx]"]
  node_write["Post editor<br/>[WritePage.tsx]"]
  node_postdata["Post helper<br/>[posts.ts]"]
  node_types["Database types<br/>[database.ts]"]
end

subgraph group_shared["Shared interface"]
  node_ui["UI primitives"]
  node_supabase["Supabase client<br/>[supabase.ts]"]
end

node_visitor(("Visitor"))
node_backend[("Supabase service")]

node_visitor -->|"opens routes"| node_router
node_router -->|"provides auth"| node_auth
node_router -->|"routes through"| node_layout
node_router -->|"routes to"| node_main
node_router -->|"routes to"| node_detail
node_router -->|"routes to"| node_login
node_router -->|"routes to"| node_signup
node_router -->|"routes to"| node_profile
node_router -->|"routes to"| node_write
node_layout -->|"renders"| node_navbar
node_navbar -->|"reads auth"| node_auth
node_login -->|"signs in"| node_supabase
node_signup -->|"registers account"| node_supabase
node_signup -->|"upserts profile"| node_profiledata
node_write -->|"reads user"| node_auth
node_write -->|"creates post"| node_postdata
node_auth -->|"tracks session"| node_supabase
node_postdata -->|"uses client"| node_supabase
node_profiledata -->|"uses client"| node_supabase
node_supabase -.->|"connects to"| node_backend
node_login -->|"renders controls"| node_ui
node_signup -->|"renders controls"| node_ui
node_write -->|"renders controls"| node_ui
node_navbar -->|"renders controls"| node_ui

click node_router "https://github.com/spacejhmoon/myblog/blob/master/src/App.tsx"
click node_layout "https://github.com/spacejhmoon/myblog/blob/master/src/components/layout/Layout.tsx"
click node_navbar "https://github.com/spacejhmoon/myblog/blob/master/src/components/layout/Navbar.tsx"
click node_main "https://github.com/spacejhmoon/myblog/blob/master/src/pages/MainPage.tsx"
click node_detail "https://github.com/spacejhmoon/myblog/blob/master/src/pages/DetailPage.tsx"
click node_login "https://github.com/spacejhmoon/myblog/blob/master/src/pages/LoginPage.tsx"
click node_signup "https://github.com/spacejhmoon/myblog/blob/master/src/pages/SignupPage.tsx"
click node_auth "https://github.com/spacejhmoon/myblog/blob/master/src/contexts/AuthContext.tsx"
click node_profile "https://github.com/spacejhmoon/myblog/blob/master/src/pages/MePage.tsx"
click node_profiledata "https://github.com/spacejhmoon/myblog/blob/master/src/lib/profiles.ts"
click node_write "https://github.com/spacejhmoon/myblog/blob/master/src/pages/WritePage.tsx"
click node_postdata "https://github.com/spacejhmoon/myblog/blob/master/src/lib/posts.ts"
click node_types "https://github.com/spacejhmoon/myblog/blob/master/src/types/database.ts"
click node_ui "https://github.com/spacejhmoon/myblog/tree/master/src/components/ui"
click node_supabase "https://github.com/spacejhmoon/myblog/blob/master/src/lib/supabase.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_router,node_layout,node_navbar toneBlue
class node_login,node_signup,node_auth,node_profile,node_profiledata,node_backend toneAmber
class node_main,node_detail,node_write,node_postdata,node_types toneMint
class node_ui,node_supabase toneRose
class node_visitor toneIndigo
```

## Components

### Application and navigation

- [Route application](https://github.com/spacejhmoon/myblog/blob/master/src/App.tsx): `src/App.tsx`
- [Page layout](https://github.com/spacejhmoon/myblog/blob/master/src/components/layout/Layout.tsx): `src/components/layout/Layout.tsx`
- [Navigation bar](https://github.com/spacejhmoon/myblog/blob/master/src/components/layout/Navbar.tsx): `src/components/layout/Navbar.tsx`

### Identity and profiles

- [Sign in](https://github.com/spacejhmoon/myblog/blob/master/src/pages/LoginPage.tsx): `src/pages/LoginPage.tsx`
- [Registration](https://github.com/spacejhmoon/myblog/blob/master/src/pages/SignupPage.tsx): `src/pages/SignupPage.tsx`
- [Auth state](https://github.com/spacejhmoon/myblog/blob/master/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [User profile](https://github.com/spacejhmoon/myblog/blob/master/src/pages/MePage.tsx): `src/pages/MePage.tsx`
- [Profile helper](https://github.com/spacejhmoon/myblog/blob/master/src/lib/profiles.ts): `src/lib/profiles.ts`

### Post publishing

- [Post listing](https://github.com/spacejhmoon/myblog/blob/master/src/pages/MainPage.tsx): `src/pages/MainPage.tsx`
- [Post detail](https://github.com/spacejhmoon/myblog/blob/master/src/pages/DetailPage.tsx): `src/pages/DetailPage.tsx`
- [Post editor](https://github.com/spacejhmoon/myblog/blob/master/src/pages/WritePage.tsx): `src/pages/WritePage.tsx`
- [Post helper](https://github.com/spacejhmoon/myblog/blob/master/src/lib/posts.ts): `src/lib/posts.ts`
- [Database types](https://github.com/spacejhmoon/myblog/blob/master/src/types/database.ts): `src/types/database.ts`

### Shared interface

- [UI primitives](https://github.com/spacejhmoon/myblog/tree/master/src/components/ui): `src/components/ui`
- [Supabase client](https://github.com/spacejhmoon/myblog/blob/master/src/lib/supabase.ts): `src/lib/supabase.ts`

### Other components

- **Visitor**
- **Supabase service**

## Connections

- Visitor → Route application: opens routes (evidence: `src/App.tsx`)
- Route application → Auth state: provides auth (evidence: `src/App.tsx`)
- Route application → Page layout: routes through (evidence: `src/App.tsx`)
- Route application → Post listing: routes to (evidence: `src/App.tsx`)
- Route application → Post detail: routes to (evidence: `src/App.tsx`)
- Route application → Sign in: routes to (evidence: `src/App.tsx`)
- Route application → Registration: routes to (evidence: `src/App.tsx`)
- Route application → User profile: routes to (evidence: `src/App.tsx`)
- Route application → Post editor: routes to (evidence: `src/App.tsx`)
- Page layout → Navigation bar: renders (evidence: `src/components/layout/Layout.tsx`)
- Navigation bar → Auth state: reads auth (evidence: `src/components/layout/Navbar.tsx`)
- Sign in → Supabase client: signs in (evidence: `src/pages/LoginPage.tsx`)
- Registration → Supabase client: registers account (evidence: `src/pages/SignupPage.tsx`)
- Registration → Profile helper: upserts profile (evidence: `src/pages/SignupPage.tsx`)
- Post editor → Auth state: reads user (evidence: `src/pages/WritePage.tsx`)
- Post editor → Post helper: creates post (evidence: `src/pages/WritePage.tsx`)
- Auth state → Supabase client: tracks session (evidence: `src/contexts/AuthContext.tsx`)
- Post helper → Supabase client: uses client (evidence: `src/lib/posts.ts`)
- Profile helper → Supabase client: uses client (evidence: `src/lib/profiles.ts`)
- Supabase client → Supabase service: connects to
- Sign in → UI primitives: renders controls (evidence: `src/pages/LoginPage.tsx`)
- Registration → UI primitives: renders controls (evidence: `src/pages/SignupPage.tsx`)
- Post editor → UI primitives: renders controls (evidence: `src/pages/WritePage.tsx`)
- Navigation bar → UI primitives: renders controls (evidence: `src/components/layout/Navbar.tsx`)
