How ahmedbm98/anasco works
Project type and purpose
• This is a full-stack web application built with Next.js (React framework) and Tailwind CSS.
• It serves server-rendered and statically generated pages, pulling in local JSON data (public/Data/programs.json) and rendering a dashboard with reusable UI components.
File structure
• Top-level config files: next.config.ts, tsconfig.json, ESLint and PostCSS configs, package.json.
• public/: static assets (images in img/ and data JSON in Data/).
• src/app/: Next.js App Router directory (file-based routing).
• page.tsx, dashboard/page.tsx → route entrypoints.
• _components/ → shared React UI components (Header, Sidebar, KPISection, ProgramsTable, etc.).
• layout.tsx → root layout for all pages.
• globals.css → base CSS imports.
• No separate backend or api folder—Next.js handles server side as part of the same codebase.
Key insights from README
• Next.js app created via create-next-app using the App Router.
• Runs on Node.js server (SSR) or as a static export on Vercel.
• Uses next/font for optimized font loading.
Main components
a. Client (Browser)
b. Next.js Application Server
• App Router
• React Server Components & Client Components
• layout.tsx (global shell)
• Page routes (/, /dashboard)
• Data loader reading programs.json from public/Data/
c. Static Assets Server (public folder)
• Images (public/img/)
• JSON data (programs.json)
• CSS (globals.css, Tailwind styles)
d. Build & Deployment Platform (e.g., Vercel)
Relationships & Data Flow
• Browser → HTTP GET → Next.js server → Renders page (SSR or SSG)
• During rendering, Next.js imports data from public/Data/programs.json and passes it to components (ProgramsTable, KPISection, etc.)
• Next.js serves static assets directly from public/ (images, JSON, CSS)
• User interactions (e.g., protected routes) handled client-side in React (ProtectedRoute component)
Architectural Patterns & Principles
• File-based routing with Next.js App Router
• Separation of concerns:
• Layout vs. page content vs. UI components
• Server Components vs. Client Components (React 18 paradigm)
• Static data serving for performance (SSG where applicable)
• Utility-first styling (Tailwind CSS)
• layout.tsx (global shell)
• Route handlers (page.tsx, dashboard/page.tsx)
• Data loader function reading programs.json
5. Browser → Next.js Router (HTTP GET) → Data loader → UI Components → Browser
6. Build: Node.js + Next.js build process → Output optimized JS/CSS.