How rd-mishra/ailoitte-times works
Project type and purpose
• Ailoitte-Times is a full-stack (frontend-focused) web application built with Next.js. It uses file-based routing and React components to render pages server-side and client-side. The primary purpose is to fetch and display news articles (headlines, categories, search results, detailed view) by integrating with the external NewsAPI.org service.
File structure
• Top-level files: Next.js config files (next.config.mjs), linting/test configs, package.json
• public/: static assets
• src/app/: Next.js “App Router” folder
• page.js – Home page (top headlines)
• layout.js – Global shell (NavBar, global CSS)
• DetailedView/page.jsx – Article details
• category/[category]/page.jsx – Category-filtered list
• search/[query]/page.jsx – Search results
• components/ – Reusable UI (NavBar, NewsCard, SkeletonNewsCard)
• Testing: .test.js/.test.jsx alongside components and pages
• Styling: Tailwind via tailwind.config.js, global CSS in globals.css
README for additional insights
• Confirms Next.js, Tailwind CSS, React Hooks (useState, useEffect, useParams)
• Describes API endpoints: top headlines, category, search
• Mentions mobile-first, responsive UI, skeleton loaders, error handling
Main components and relationships
A. Client (Browser)
• Sends HTTP requests to Next.js server for page HTML (SSR/SSG)
• Runs React hydration on the client for interactivity
B. Next.js Application
• App Router: file-based routes render React components server-side
• Layout: wraps pages, injects NavBar and global styles
• Page Components: call fetch/axios to NewsAPI (server-side or client-side)
• Home (/)
• Category (/category/:category)
• Search (/search/:query)
• DetailedView (/detailed-view/:id or via article URL)
• Reusable UI components (NewsCard, SkeletonNewsCard, NavBar)
• State & hooks manage loading, data, errors
C. External Service
• NewsAPI.org REST endpoints (Top-headlines, Category filter, Everything search)
• Secured by NEXT_PUBLIC_NEWS_API_KEY env var
D. Static Assets & Styling
• Tailwind CSS for utility-first styling
Architectural patterns & design principles
• File-based routing (Next.js App Router)
• Server-side rendering (SSR) or static generation for pages
• Component-based design (React) with separation of concerns (pages vs UI components)
• Data-fetching layer decoupled from UI; error handling centralized in each page
• Responsive, mobile-first design