How pedrojose06/portifolio works
Project type and purpose
• This is a Next.js “App Router” web application that serves a multi-language static/SSR website (no custom backend or database).
• It uses React components, the Next.js middleware for locale detection, Tailwind CSS, and a simple i18n layer.
File structure
• Top-level artifacts:
– next.config.ts, middleware.ts → Next.js config & middleware
– postcss.config.mjs, tailwind.config.ts → CSS build pipeline
– public/ → static assets (images)
– src/app/ → React pages and layouts (App Router)
– src/i18n/ → internationalization utilities
• src/app/[locale]/… → dynamic locale-based routing
• src/app/components/… → reusable UI components
• src/app/hooks/useDevice.ts → custom React hook
Key README insights
• Bootstrapped with create-next-app
• Uses next/font, auto-optimized by Next.js
• Deployed via Vercel (CDN + SSR edge functions)
Main components
a. Users & Browsers
b. CDN / Vercel Edge Network
c. Next.js Server (Edge Functions)
– Middleware (locale detection)
– App Router (page.tsx, layout.tsx)
d. React Client (hydration, client components)
e. Static Assets (public/images, fonts)
f. i18n Service (src/i18n/request.ts, routing.ts)
g. Build Tools (Tailwind/PostCSS pipeline)
Relationships & data flow
1. Browser request → CDN / Edge → middleware.ts
2. Middleware extracts locale from URL → forwards to App Router
3. App Router loads layout.tsx + [locale] pages + components → Next.js SSR at edge
4. SSR HTML + CSS + JS blobs returned to client
5. Browser hydrates React client components (e.g., Button, NavBar)
6. Client may call i18n/request.ts for translation data (en.json, pt.json)
7. Static assets (images, fonts) served from public/ or next/font CDN
Architectural patterns & design principles
• File-system routing (Next.js App Router)
• Separation of concerns: layout vs pages vs components
• Edge rendering (middleware + SSR at edge)
• i18n abstraction layer decoupled from UI
• Tailwind utility-first CSS build pipeline