# codepedia-top/codepedia-website architecture

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

- Interactive diagram: https://gitdiagram.com/codepedia-top/codepedia-website
- Repository: https://github.com/codepedia-top/codepedia-website

## Overview

1. This is a Next.js App Router project organized as a static content blog. The repository is centered around page routes, reusable React components, and filesystem-backed MDX posts rather than a separate API or database.

2. Routing is split into a global app shell and a blog route group. `app/layout.tsx` defines the shared document structure, while `app/(blog)/page.tsx` and `app/(blog)/blog/[slug]/page.tsx` handle the blog index and individual post pages. The matching `layout.tsx` under `[slug]` likely provides per-post framing or metadata for article pages.

3. Blog content lives in `content/posts/*.mdx`, which is the main source of application data. Files such as `about-git-2.55.mdx` and `make-quicksort-faster.mdx` indicate each post is authored as MDX, so content and presentation are mixed at the document level but still stored outside the route layer.

4. `lib/get-posts.ts` is the key data-access boundary. It likely reads the MDX files from disk, extracts frontmatter or headings, and returns a normalized post list for the blog index and slug-based routes. This means the content flow is build-time or server-side filesystem parsing, not runtime fetching.

5. MDX rendering is centralized through `mdx-components.tsx` plus the small blog-specific component set under `app/(blog)/_components`. Those components—`blog-image`, `blog-section`, `hero`, and `cards`—shape how content and landing pages are presented without duplicating markup inside individual posts.

6. Shared UI lives in `components/` and is reused across the blog. `header.tsx`, `footer.tsx`, `logo.tsx`, and `shiny-text.tsx` provide the site chrome and branding, while `components/ui/*` contains low-level primitives such as buttons, badges, and aspect-ratio helpers.

7. Theme and visual behavior are handled as a client-side shell around the mostly static content. `components/theme-provider.tsx` suggests light/dark theme state, and `app/globals.css` plus `app/highlightjs.css` control global styling and code-block presentation for MDX posts.

8. There is a small interaction layer in `hooks/use-scroll.tsx`, which likely drives scroll-aware UI such as header behavior or section highlighting. This is a client boundary in an otherwise content-driven site.

9. The architecture is intentionally simple: content files feed the post loader, the loader feeds route pages, and the route pages compose shared UI and MDX components. There are no obvious external services, databases, or background jobs in the repository tree.

10. Tooling and framework boundaries are standard for a modern Next.js codebase: TypeScript, App Router, MDX content handling, and project-level config files for ESLint, PostCSS, and Next.js. `components.json` suggests a component-generation workflow consistent with shadcn-style UI primitives.

Main entry points: [`app/layout.tsx`](https://github.com/codepedia-top/codepedia-website/blob/main/app/layout.tsx) (Root layout), [`app/(blog)/page.tsx`](https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/page.tsx) (Blog index), [`components/ui`](https://github.com/codepedia-top/codepedia-website/tree/main/components/ui) (UI primitives), [`components/header.tsx`](https://github.com/codepedia-top/codepedia-website/blob/main/components/header.tsx) (Header)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["Routing"]
  node_app_layout["Root layout<br/>next layout<br/>[layout.tsx]"]
  node_blog_index["Blog index<br/>route page<br/>[page.tsx]"]
  node_post_page["Post page<br/>route page<br/>[page.tsx]"]
  node_post_layout["Post layout<br/>route layout<br/>[layout.tsx]"]
  node_blog_image["Blog image<br/>blog component<br/>[blog-image.tsx]"]
  node_blog_section["Blog section<br/>blog component<br/>[blog-section.tsx]"]
  node_hero["Hero<br/>blog component<br/>[hero.tsx]"]
  node_cards["Cards<br/>blog component<br/>[cards.tsx]"]
end

subgraph group_content["Content"]
  node_posts[("MDX posts<br/>content source")]
  node_get_posts["Post loader<br/>data access<br/>[get-posts.ts]"]
  node_mdx_components["MDX components<br/>render bridge<br/>[mdx-components.tsx]"]
end

subgraph group_ui["Shared UI"]
  node_header["Header<br/>site chrome<br/>[header.tsx]"]
  node_footer["Footer<br/>site chrome<br/>[footer.tsx]"]
  node_logo["Logo<br/>branding<br/>[logo.tsx]"]
  node_theme_provider["Theme provider<br/>client shell<br/>[theme-provider.tsx]"]
  node_shiny_text["Shiny text<br/>visual effect<br/>[shiny-text.tsx]"]
  node_ui_primitives["UI primitives<br/>component library"]
  node_scroll_hook["Scroll hook<br/>client hook<br/>[use-scroll.tsx]"]
end

subgraph group_styling["Styling"]
  node_global_css["Global styles<br/>stylesheet<br/>[globals.css]"]
  node_highlight_css["Code styles<br/>stylesheet<br/>[highlightjs.css]"]
end

subgraph group_tooling["Tooling"]
  node_components_json["Components config<br/>tooling config<br/>[components.json]"]
  node_next_config["Next config<br/>tooling config<br/>[next.config.ts]"]
end

node_app_layout -->|"composes"| node_header
node_app_layout -->|"composes"| node_footer
node_app_layout -->|"wraps"| node_theme_provider
node_app_layout -->|"loads"| node_global_css
node_app_layout -->|"loads"| node_highlight_css
node_app_layout -->|"hosts"| node_blog_index
node_app_layout -->|"hosts"| node_post_page
node_blog_index -->|"reads"| node_get_posts
node_post_page -->|"reads"| node_get_posts
node_get_posts -->|"parses"| node_posts
node_post_page -->|"renders with"| node_mdx_components
node_mdx_components -->|"maps to"| node_blog_image
node_mdx_components -->|"maps to"| node_blog_section
node_blog_index -->|"uses"| node_hero
node_blog_index -->|"uses"| node_cards
node_blog_index -->|"uses"| node_shiny_text
node_header -->|"uses"| node_logo
node_header -->|"uses"| node_scroll_hook
node_header -->|"uses"| node_ui_primitives
node_footer -->|"uses"| node_ui_primitives
node_hero -->|"uses"| node_ui_primitives
node_cards -->|"uses"| node_ui_primitives
node_components_json -.->|"supports"| node_ui_primitives
node_next_config -.->|"enables"| node_mdx_components
node_post_layout -->|"frames"| node_post_page

click node_app_layout "https://github.com/codepedia-top/codepedia-website/blob/main/app/layout.tsx"
click node_blog_index "https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/page.tsx"
click node_post_page "https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/blog/[slug]/page.tsx"
click node_post_layout "https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/blog/[slug]/layout.tsx"
click node_blog_image "https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/_components/blog-image.tsx"
click node_blog_section "https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/_components/blog-section.tsx"
click node_hero "https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/_components/hero.tsx"
click node_cards "https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/_components/cards.tsx"
click node_posts "https://github.com/codepedia-top/codepedia-website/tree/main/content/posts"
click node_get_posts "https://github.com/codepedia-top/codepedia-website/blob/main/lib/get-posts.ts"
click node_mdx_components "https://github.com/codepedia-top/codepedia-website/blob/main/mdx-components.tsx"
click node_header "https://github.com/codepedia-top/codepedia-website/blob/main/components/header.tsx"
click node_footer "https://github.com/codepedia-top/codepedia-website/blob/main/components/footer.tsx"
click node_logo "https://github.com/codepedia-top/codepedia-website/blob/main/components/logo.tsx"
click node_theme_provider "https://github.com/codepedia-top/codepedia-website/blob/main/components/theme-provider.tsx"
click node_shiny_text "https://github.com/codepedia-top/codepedia-website/blob/main/components/shiny-text.tsx"
click node_ui_primitives "https://github.com/codepedia-top/codepedia-website/tree/main/components/ui"
click node_global_css "https://github.com/codepedia-top/codepedia-website/blob/main/app/globals.css"
click node_highlight_css "https://github.com/codepedia-top/codepedia-website/blob/main/app/highlightjs.css"
click node_scroll_hook "https://github.com/codepedia-top/codepedia-website/blob/main/hooks/use-scroll.tsx"
click node_components_json "https://github.com/codepedia-top/codepedia-website/blob/main/components.json"
click node_next_config "https://github.com/codepedia-top/codepedia-website/blob/main/next.config.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_app_layout,node_blog_index,node_post_page,node_post_layout,node_blog_image,node_blog_section,node_hero,node_cards toneBlue
class node_posts,node_get_posts,node_mdx_components toneAmber
class node_header,node_footer,node_logo,node_theme_provider,node_shiny_text,node_ui_primitives,node_scroll_hook toneMint
class node_global_css,node_highlight_css toneRose
class node_components_json,node_next_config toneIndigo
```

## Components

### Routing

App Router shells and blog pages

- [Root layout](https://github.com/codepedia-top/codepedia-website/blob/main/app/layout.tsx): next layout · Global document shell for the app · `app/layout.tsx`
- [Blog index](https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/page.tsx): route page · Lists posts for the blog landing page · `app/(blog)/page.tsx`
- [Post page](https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/blog/[slug]/page.tsx): route page · Renders an individual blog post · `app/(blog)/blog/[slug]/page.tsx`
- [Post layout](https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/blog/[slug]/layout.tsx): route layout · Per-post framing and metadata boundary · `app/(blog)/blog/[slug]/layout.tsx`
- [Blog image](https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/_components/blog-image.tsx): blog component · Image presentation for posts and pages · `app/(blog)/_components/blog-image.tsx`
- [Blog section](https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/_components/blog-section.tsx): blog component · Section framing for MDX content · `app/(blog)/_components/blog-section.tsx`
- [Hero](https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/_components/hero.tsx): blog component · Landing-page hero block · `app/(blog)/_components/hero.tsx`
- [Cards](https://github.com/codepedia-top/codepedia-website/blob/main/app/(blog)/_components/cards.tsx): blog component · Card grid or teaser presentation · `app/(blog)/_components/cards.tsx`

### Content

Filesystem-backed MDX posts

- [MDX posts](https://github.com/codepedia-top/codepedia-website/tree/main/content/posts): content source · Filesystem-backed article documents · `content/posts`
- [Post loader](https://github.com/codepedia-top/codepedia-website/blob/main/lib/get-posts.ts): data access · Reads and normalizes MDX post data · `lib/get-posts.ts`
- [MDX components](https://github.com/codepedia-top/codepedia-website/blob/main/mdx-components.tsx): render bridge · Maps MDX tags to React components · `mdx-components.tsx`

### Shared UI

Reusable site chrome and primitives

- [Header](https://github.com/codepedia-top/codepedia-website/blob/main/components/header.tsx): site chrome · Top navigation and branding area · `components/header.tsx`
- [Footer](https://github.com/codepedia-top/codepedia-website/blob/main/components/footer.tsx): site chrome · Bottom site chrome · `components/footer.tsx`
- [Logo](https://github.com/codepedia-top/codepedia-website/blob/main/components/logo.tsx): branding · Site mark used in chrome · `components/logo.tsx`
- [Theme provider](https://github.com/codepedia-top/codepedia-website/blob/main/components/theme-provider.tsx): client shell · Light/dark theme state boundary · `components/theme-provider.tsx`
- [Shiny text](https://github.com/codepedia-top/codepedia-website/blob/main/components/shiny-text.tsx): visual effect · Brand styling text effect · `components/shiny-text.tsx`
- [UI primitives](https://github.com/codepedia-top/codepedia-website/tree/main/components/ui): component library · Shared low-level UI building blocks · `components/ui`
- [Scroll hook](https://github.com/codepedia-top/codepedia-website/blob/main/hooks/use-scroll.tsx): client hook · Scroll-aware UI behavior · `hooks/use-scroll.tsx`

### Styling

Global CSS and theme behavior

- [Global styles](https://github.com/codepedia-top/codepedia-website/blob/main/app/globals.css): stylesheet · Base application styling · `app/globals.css`
- [Code styles](https://github.com/codepedia-top/codepedia-website/blob/main/app/highlightjs.css): stylesheet · Syntax highlighting styles for posts · `app/highlightjs.css`

### Tooling

Framework and project config

- [Components config](https://github.com/codepedia-top/codepedia-website/blob/main/components.json): tooling config · Component-generation settings · `components.json`
- [Next config](https://github.com/codepedia-top/codepedia-website/blob/main/next.config.ts): tooling config · Next.js build/runtime configuration · `next.config.ts`

## Connections

- Root layout → Header: composes · Root shell includes shared chrome
- Root layout → Footer: composes · Root shell includes shared chrome
- Root layout → Theme provider: wraps · Provides client-side theme state
- Root layout → Global styles: loads · Applies global styling
- Root layout → Code styles: loads · Adds code-block presentation styles
- Root layout → Blog index: hosts · App shell hosts route content
- Root layout → Post page: hosts · App shell hosts route content
- Blog index → Post loader: reads · Index page builds its list from post data
- Post page → Post loader: reads · Slug page resolves a single post
- Post loader → MDX posts: parses · Loader scans MDX files on disk
- Post page → MDX components: renders with · MDX content is mapped to React components
- MDX components → Blog image: maps to · Custom MDX image rendering
- MDX components → Blog section: maps to · Custom MDX section rendering
- Blog index → Hero: uses · Landing page hero block
- Blog index → Cards: uses · Landing page card presentation
- Blog index → Shiny text: uses · Branded text treatment
- Header → Logo: uses · Header includes the site mark
- Header → Scroll hook: uses · Header may react to scroll position
- Header → UI primitives: uses · Header is built from shared primitives
- Footer → UI primitives: uses · Footer is built from shared primitives
- Hero → UI primitives: uses · Hero composes shared primitives
- Cards → UI primitives: uses · Cards compose shared primitives
- Components config → UI primitives: supports · Config supports the shared component workflow
- Next config → MDX components: enables · Build config supports MDX rendering pipeline
- Post layout → Post page: frames · Per-post layout wraps slug content
