How alihamzaio/portfolio works
Purpose and entry points
This is a Next.js 16 App Router portfolio with a public, SEO-oriented profile site and a CMS-style admin surface for updating portfolio data without code redeploys. Public routing begins under app/(site)/page.tsx; admin begins at app/admin/page.tsx; HTTP boundaries are implemented in app/api/**/route.ts.
Public site composition
The site route group supplies shared navigation, footer, providers, and page transitions through app/(site)/layout.tsx and app/(site)/template.tsx. The homepage is section-composed from components/home/home-hero.tsx, components/home/home-projects.tsx, and related content components. Dedicated routes render about, contact, experience, technology, blog, project gallery, and slug-addressed project detail, notably app/(site)/projects/page.tsx and app/(site)/projects/[slug]/page.tsx.
Content read model and fallbacks
Editable public content is served via settings, experience, projects, and skills APIs, with local JSON/default data as the baseline. Content/storage abstraction is centered in lib/content.ts, lib/store.ts, and lib/settings.ts. Editable source files include lib/settings.json, lib/experience.json, lib/projects.json, and lib/skill.json; code-owned fallback and curated content lives in lib/site.ts, lib/featured-projects.ts, and lib/skills-data.ts.
Admin and authentication flow
app/admin/page.tsx renders the dashboard or OTP login using components/admin/admin-login.tsx and components/admin/admin-shell.tsx. An administrator requests and verifies an email OTP through app/api/auth/send-otp/route.ts and app/api/auth/verify-otp/route.ts; the client keeps the resulting seven-day bearer session in local storage via lib/auth-client.ts. Server-side authorization/session validation is centralized by lib/auth.ts and lib/admin.ts. Resend delivers production OTP email through lib/email.ts.
Content-management API boundary
Public GET and authenticated mutation endpoints expose REST operations for portfolio data: app/api/settings/route.ts, app/api/experience/route.ts, app/api/projects/route.ts, and app/api/skills/route.ts, with entity operations under their dynamic [id] or [name] routes. Admin writes pass through this API boundary rather than directly coupling UI to files or KV. app/api/resume/route.ts manages PDFs and active selection; app/api/resume/download/route.ts resolves the publicly downloadable active CV from public/resume/active.json.
Persistence and deployment constraints
lib/store.ts selects filesystem/local JSON behavior or remote persistent storage using Vercel KV or Upstash Redis environment credentials. Filesystem-backed auth/session data is ephemeral under serverless deployment, while portfolio JSON should use KV/Upstash in production. Resume assets remain file-based in public/resume/. Deployment targets Vercel (vercel.json); app/api/cron/keepalive/route.ts plus .github/workflows/keepalive.yml support a keepalive path.
Presentation, enhancement, and discoverability
The root shell in app/layout.tsx applies global styling and shared SEO. Client-side visual enhancement is isolated from core content in components/effects/hero-dev-scene.tsx, components/effects/enhancement-runtime.tsx, and cursor/effect modules, using Framer Motion and React Three Fiber/Three.js. SEO is generated through lib/seo.ts, lib/seo-structured.ts, and route artifacts such as app/opengraph-image.tsx, app/sitemap.ts, and app/robots.ts. Google Analytics is deferred through components/google-analytics.tsx.
Main entry points: route.ts Portfolio content API · (site)/layout.tsx Site shell · content.ts Content abstraction · app/layout.tsx Root shell
Components 22
Public site
- Root shell · Global styling and shared SEO.
app/layout.tsx - Site shell · Shared navigation, footer, providers, and transitions.
app/(site)/layout.tsx - Page transitions
app/(site)/template.tsx - Homepage · Section-composed portfolio landing page.
app/(site)/page.tsx - Home sections
components/home/home-projects.tsx - Project gallery & detail · Gallery and slug-addressed project pages.
app/(site)/projects/[slug]/page.tsx - Visual enhancement · Optional Motion and Three.js presentation layer.
components/effects/enhancement-runtime.tsx
Admin & API
- Admin entry · Selects OTP login or dashboard.
app/admin/page.tsx - Admin UI
components/admin/admin-shell.tsx - OTP authentication · Email OTP issuance and verification.
app/api/auth/verify-otp/route.ts - Server authorization · Validates sessions and admin access.
lib/auth.ts - Portfolio content API · Public reads and authenticated portfolio mutations.
app/api/projects/route.ts - Resume API · Manages PDFs and resolves the active download.
app/api/resume/download/route.ts
Content & storage
- Content abstraction · Unifies settings, entities, fallbacks, and storage.
lib/content.ts - Adaptive store · Uses local filesystem or Vercel KV/Upstash Redis.
lib/store.ts - Editable JSON · Baseline settings, experience, projects, and skills.
lib/projects.json - Code fallbacks
lib/site.ts - Resume assets · File-based PDFs and active selection.
public/resume/active.json
Delivery & discoverability
- SEO generation · Metadata and structured data generation.
lib/seo.ts - SEO route artifacts · Open Graph image, sitemap, and robots output.
app/sitemap.ts - Google Analytics
components/google-analytics.tsx - Keepalive endpoint · Supports scheduled deployment keepalive.
app/api/cron/keepalive/route.ts
Connections 21
- Root shell → Site shell: wraps
- Site shell → Page transitions: applies
- Site shell → Homepage: renders
- Homepage → Home sections: composes
- Homepage → Portfolio content API: reads content
- Project gallery & detail → Portfolio content API: reads projects
- Site shell → Visual enhancement: enhances
- Admin entry → Admin UI: renders
- Admin entry → OTP authentication: requests login
- OTP authentication → Server authorization: creates session
- Admin UI → Portfolio content API: manages content
- Portfolio content API → Server authorization: authorizes mutations
- Portfolio content API → Content abstraction: reads and writes
- Content abstraction → Adaptive store: persists through
- Content abstraction → Editable JSON: uses baseline
- Content abstraction → Code fallbacks: falls back to
- Resume API → Server authorization: authorizes management
- Resume API → Resume assets: serves active CV
- Root shell → SEO generation: uses
- SEO generation → SEO route artifacts: feeds
- Root shell → Google Analytics: defers