How srummanf/vetrina works
Project Type & Purpose
• This is a Next.js (v13+) full-stack web application serving a personal portfolio/vitrina.
• It uses the “app” directory (App Router), server and client components, static data modules, and a small API route to fetch “Now Playing” data from Spotify.
• No traditional database—data comes from TS modules under data/ and external APIs.
File Structure
• Top-level directories:
– app/: Next.js App Router (pages, layouts, API routes)
– components/: React UI components
– data/: static content (projects, location, shayari)
– hooks/: custom React hooks
– lib/: shared utilities
– public/: static assets (images, sounds, sitemap, robots.txt)
– font/: custom font assets
– styles/: global CSS
• Config & metadata: next.config.ts, tsconfig.json, package.json, postcss.config.mjs
• API: app/api/np/route.ts (serverless function for Spotify Now Playing)
README
• Minimal decorative README; no extra architecture docs.
Core Components & Interactions
a. Frontend (Next.js React):
– app/layout.tsx: Root layout
– app/page.tsx + nested pages (projects, lets-meet, not-found)
– components/*: Presentational and interactive UI
– hooks/useClick.ts: Client hook for click sounds
b. Backend / Serverless:
– API Route at /api/np: Fetches Spotify Now Playing via external HTTP
– Server Components (default in app/), Client Components (marked with “use client”)
c. Static Data & Assets:
– data/*.ts: Inlined content at build/SSR time
– public/: Static files served via CDN (images, sounds, robots.txt, sitemap)
– font/: Custom fonts loaded via CSS
d. External Service:
– Spotify Web API (for now‐playing information)
Architectural Patterns & Principles
• App Router with nested layouts and server/client boundary
• Static generation & SSR: Data in modules → SSG/SSR
• API Layer for external integration (Spotify)
• Component-based UI, single page application enhanced by server data
Putting It All Together
[ User’s Browser ]
|
v
[ CDN / Vercel Edge ] ── serves ──> Static Assets (images, CSS, fonts)
|
v
[ Next.js App Server ]
├─ Loads data modules (data/) and renders Server Components
├─ Exposes API Route /api/np ──> Spotify Web API
└─ Serves React bundles & hydration for Client Components (components/*, hooks/*)
|
v
[ External Spotify API ]