How rajafawady/pak-financials works
Project Type and Purpose
• This is a full-stack (mostly frontend-centric) React application built with Next.js (App Router).
• It provides multiple static/SSR pages (home, about, contact, tutorials, “halal-investments,” etc.), localized via JSON message bundles and an i18n service.
• Assets (video tutorials, fonts) and UI components are organized under public/ and src/components/.
File Structure
• src/app/: Next.js App-router pages and layout (SSR/SSG).
• src/components/: Reusable UI building blocks (FeatureSection, Navbar, Footer, etc.) and a subfolder ui/ for primitives (button, dropdown, navigation).
• src/i18n/ & messages/: Locale configuration, request wrapper, and translation JSON files (en.json, nl.json, ur.json).
• src/services/locale.ts: Runtime locale detection or switching logic.
• src/lib/utils.ts: Shared utility functions.
• Config/build files: next.config.js, postcss.config.mjs, tailwind.config.ts, tsconfig.json.
• public/: Static assets served directly (tutorial videos, etc.).
README Insights
• Project bootstrapped with Create-Next-App.
• Uses built-in Next.js features: automatic code splitting, SSR/SSG, next/font optimization.
• Deployable to Vercel; no external backend beyond Next.js server.
Main Components
a. Client Browser
b. Next.js Server
– App-Router (pages in src/app/)
– Layout (layout.tsx)
– React Components (src/components/)
– i18n Service/Config (src/i18n/, src/services/locale.ts, messages/)
– Utility Layer (src/lib/utils.ts)
c. Static Asset Store (public/)
d. Build System
– Tailwind CSS / PostCSS
– Next.js Bundler (Webpack/Turbopack)
e. Package Manager & Runtime (Node.js + npm/yarn/pnpm)
Relationships & Data Flow
1. Browser → HTTP request → Next.js Server
2. Server reads the route handler in src/app/[route]/page.tsx
3. Server invokes React components, applies layouts, pulls in translations via i18n service
4. Server compiles/SSG or SSR pages, outputting HTML + hydration JS
5. Browser receives HTML, loads JS bundle + CSS (Tailwind-generated)
6. Browser requests static assets (videos, fonts) from public/ on demand
7. Locale switching: user interacts with LocaleSwitcher component → calls services/locale.ts → updates UI strings
Architectural Patterns & Design Principles
• Component-based UI (React).
• Page/Layout pattern (Next.js App Router).
• Static Generation (SSG) + Server-Side Rendering (SSR) hybrid strategy.
• Separation of concerns: UI components vs. services vs. utilities.
• i18n integration via JSON resources and runtime locale service.
• Utility-first styling with Tailwind CSS.