How codepedia-top/codepedia-website works
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: layout.tsx Root layout · page.tsx Blog index · ui UI primitives · header.tsx Header
Components 22
Routing
App Router shells and blog pages
- Root layout · Global document shell for the app
app/layout.tsx - Blog index · Lists posts for the blog landing page
app/(blog)/page.tsx - Post page · Renders an individual blog post
app/(blog)/blog/[slug]/page.tsx - Post layout · Per-post framing and metadata boundary
app/(blog)/blog/[slug]/layout.tsx - Blog image · Image presentation for posts and pages
app/(blog)/_components/blog-image.tsx - Blog section · Section framing for MDX content
app/(blog)/_components/blog-section.tsx - Hero · Landing-page hero block
app/(blog)/_components/hero.tsx - Cards · Card grid or teaser presentation
app/(blog)/_components/cards.tsx
Content
Filesystem-backed MDX posts
- MDX posts · Filesystem-backed article documents
content/posts - Post loader · Reads and normalizes MDX post data
lib/get-posts.ts - MDX components · Maps MDX tags to React components
mdx-components.tsx
Shared UI
Reusable site chrome and primitives
- Header · Top navigation and branding area
components/header.tsx - Footer · Bottom site chrome
components/footer.tsx - Logo · Site mark used in chrome
components/logo.tsx - Theme provider · Light/dark theme state boundary
components/theme-provider.tsx - Shiny text · Brand styling text effect
components/shiny-text.tsx - UI primitives · Shared low-level UI building blocks
components/ui - Scroll hook · Scroll-aware UI behavior
hooks/use-scroll.tsx
Styling
Global CSS and theme behavior
- Global styles · Base application styling
app/globals.css - Code styles · Syntax highlighting styles for posts
app/highlightjs.css
Tooling
Framework and project config
- Components config · Component-generation settings
components.json - Next config · Next.js build/runtime configuration
next.config.ts
Connections 25
- 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