How pungrumpy/v2-website works
Project Type & Purpose
• This is a monolithic full-stack Next.js 14 personal website with an App Router structure.
• It serves as a portfolio/blog site, styled with TailwindCSS + shadcn/ui, animated via Framer Motion, and content-driven by a Sanity headless CMS.
• It also exposes a small serverless API (/api/github) and uses Redis for caching via lib/redis.ts.
File-Structure Analysis
• app/ – Next.js App Router entry points (page.tsx, layout.tsx), nested routes under (app) for about, projects, takes, plus /api/github/route.ts.
• components/ – Reusable UI pieces (buttons, cards, layout, animations, sanity blocks, providers).
• hooks/ – Custom React hooks (toast, filtered takes).
• lib/ – Shared utilities (EXIF support, favicon generator, Redis client, generic utils).
• sanity/ – Sanity Studio config, client, image helper, and content schemas.
• public/ – Static assets (images, gallery).
• config/, next.config.mjs, tailwind.config.ts, postcss.config.mjs, eslint.config.mjs, tsconfig.json, and bun.lockb for build, lint, and package management.
Key Architecture Components
a. Client (Browser)
• Loads React pages and components from Next.js
• Executes client-side animations (Framer Motion)
• Switches themes (light/dark) via theme provider.
b. Next.js Server
• Renders pages SSR/SSG via the App Router.
• Serves static assets from /public.
• Hosts serverless function at /api/github that proxies GitHub API calls.
c. Sanity CMS
• Headless CMS for dynamic content (projects, takes, profile).
• Accessed via sanity/lib/client.ts and GROQ queries.
• Sanity Studio served under /studio/[...tool].
d. Redis Cache
• Caches external data or computed values (via lib/redis.ts).
e. External Services
• GitHub API (via /api/github).
• Optional 3D service (Spline embedding).
Relationships & Data Flow
• Browser → Next.js Server (page request)
• Next.js Server → Sanity CMS (GROQ queries)
• Next.js Server → Redis (get/set cached values)
• Next.js Server (API route) → GitHub API
• Browser → Spline (client-side embed)
• Static assets served directly from /public
Architectural Patterns & Principles
• App Router & Server Components – separation of server/client code.
• Headless CMS – decoupled content management.
• Serverless Functions – lightweight backend for third-party API integration.
• Caching – Redis for performance.
• Component-Driven UI – atomic React components under components/.
• Utility Layer – generic helpers in lib/.
• Custom Hooks – encapsulate stateful logic.
Technologies & Frameworks
• Next.js 14 (App Router)
• TypeScript
• Tailwind CSS, shadcn/ui
• Framer Motion, Spline
• Sanity.io (headless CMS + Studio)
• Redis
• Bun (package manager)