How kleva-j/portfolio_v4 works
Project type and purpose
• This is a content-driven portfolio website built with Next.js 15.1 and Tailwind CSS.
• It uses Next.js’s App Router (app/ folder), MDX files in the content/ folder as its “CMS,” and generates Open Graph images via a server route (app/og/route.tsx).
• Its main goal is to serve a blog/portfolio using SSG/SSR and dynamic route rendering.
File structure
• Top-level folders:
• app/ → Next.js App Router for pages, layouts, error UI, dynamic routes (posts, snippets, OG routes)
• content/ → MDX files organized by topic and type; acts as your content source
• lib/ → Utility functions and site config for data fetching, font loading, constant definitions
• public/ → Static assets (fonts, images organized by content)
• layout/ → Global header component
• Config files:
• next.config.ts, tsconfig.json, postcss.config.mjs, tailwind.config.js (implicit)
• Scripts & dependencies:
• package.json (pnpm), .env.example → environment variables for SITE_URL and OG metadata.
README for additional insights
• Confirms use of Next.js and Tailwind, environment variable setup, local dev commands, and that it’s a work-in-progress portfolio.
Main components
a. Browser / Client
b. Next.js Server (for SSR/SSG):
• App Router
• Dynamic route handler (app/og/route.tsx)
• Static page generator (build-time MDX → HTML)
c. Content Source:
• .mdx files under content/
• lib/post.ts and mdx-components.tsx for transforming MDX → React
d. Component Library:
• components/ui (Tailwind-styled primitives)
e. Styling Pipeline:
• tailwind.css + postcss → global.css
f. Assets:
• public/fonts, public/images
g. Configuration & Env:
• next.config.ts, tailwind.config.js, .env
h. Deployment (e.g., Vercel / static hosting)
Relationships & interactions
• Browser requests a URL
→ Next.js App Router picks page/component in app/
→ If static, it serves pre-generated HTML from content/ (SSG)
→ If dynamic (e.g., post/[slug]), it runs getStaticPaths/Props logic in lib/post.ts
→ React tree is composed of layout.tsx → page.tsx → UI components → MDX content
→ CSS is injected from global.css and Tailwind classes
→ OG route: request to /og triggers app/og/route.tsx to render an image on the fly
• Build pipeline:
• MDX content + mdx-components.tsx → React component AST → static HTML
• tailwind CLI via postcss builds CSS
Architectural patterns & design principles
• File-based routing (Next.js App Router)
• Content as data pattern (treat MDX files as headless CMS)
• Component-driven UI (atomic Tailwind UI primitives)
• SSG/ISR for performance and SEO
• Single code repo: “monorepo” style flat structure (no separate backend)