Skip to content

toye-codes/content-explorer

Repository files navigation

Content Explorer

📘 Overview

Content Explorer is a responsive web application for browsing, searching, and filtering a collection of products. The focus of this project is not just feature delivery, but demonstrating strong frontend architecture, performance awareness, and thoughtful trade-offs.


⚙️ Setup

git clone <your-repo-url>
cd <your-project-folder>
npm install
npm run dev

App runs at: http://localhost:3000


🛠 Tech Stack

  • Next.js (App Router)
  • TypeScript (strict mode)
  • React
  • Tailwind CSS
  • TanStack Query

🧱 Architecture

The codebase follows a feature-based structure to ensure scalability and separation of concerns.

Structure

  • app/ → Routing, layouts, and server components
  • features/products/ → Product domain logic and UI
  • components/ → Reusable UI primitives
  • lib/ → API and helper utilities
  • types/ → Shared TypeScript types

Design Principles

  • Server-first data fetching for performance and SEO
  • Presentational components with no embedded business logic
  • Clear separation between data, UI, and domain logic

🚀 Core Features

Product Listing (SSR)

Products are fetched on the server using the App Router. This ensures:

  • Faster initial page load
  • SEO-friendly rendering
  • Reduced client-side complexity

Product Detail Page

  • Dynamic route: /product/[id]
  • Server-side fetching per request
  • Dynamic metadata generation (title, Open Graph)
  • Breadcrumb navigation

Search & Filtering

  • URL-driven state (search, category, price, rating)
  • Debounced search input (300ms)
  • Filters are shareable and persist across reloads

Pagination

  • Controlled via URL (page)
  • Prevents over-fetching large datasets
  • Keeps navigation predictable and testable

UI States

  • Skeleton loaders for loading states
  • Graceful error handling via error.tsx
  • Empty state when no results are found

⚠️ Key Engineering Decisions

Server vs Client Data Fetching

Data fetching is handled on the server to optimize for:

  • Performance (reduced client work)
  • SEO (fully rendered HTML)
  • Simpler state management

TanStack Query is used only for client-side synchronization, not as the primary data source.


URL as Source of Truth

All filters and pagination state are stored in the URL.

This enables:

  • Shareable application state
  • Predictable behavior
  • Elimination of unnecessary global state

Pagination over Infinite Scroll

Pagination was chosen for its simplicity and predictability.

  • Easier to test
  • More controlled data usage
  • Better suited for structured browsing

📈 Performance Strategy

Image Optimization (LCP Focus)

Special attention was given to Largest Contentful Paint (LCP), especially on mobile:

  • Only the first visible product image is marked as high priority
  • Responsive sizes attribute ensures correct image selection per viewport
  • fill layout with fixed container height prevents layout shifts

This avoids common pitfalls such as over-prioritizing images or downloading oversized assets.


Layout Optimization

Initial layout caused the primary content to be pushed below the fold on mobile.

Fixes included:

  • Reducing excessive vertical spacing on mobile (py-10 → py-4)
  • Slimming down sticky header height
  • Ensuring the first product is visible immediately

These changes significantly improved perceived load performance.


Font Optimization

  • Implemented next/font with Geist
  • Removed unused font imports
  • Properly mapped font variables into Tailwind
  • Used display: swap to avoid render blocking

Rendering & Data

  • Server-side rendering (SSR)
  • Cached fetch requests (revalidate: 60)
  • Minimal client-side state
  • Debounced input to reduce unnecessary network calls

⚖️ Trade-offs

  • Some filters (price, rating) are applied client-side

    • Simpler implementation
    • Not ideal for extremely large datasets
  • TanStack Query is used conservatively

    • Avoids unnecessary abstraction for a relatively simple use case

🧪 Testing

  • Jest + React Testing Library

Covered:

  • Pagination behavior
  • Filtering helper logic

🚀 Deployment

Deployed on: (add your link here)

Vercel was chosen for seamless integration with Next.js and fast deployment.


➕ Future Improvements

  • Move all filtering to the backend/API layer
  • Introduce smarter caching strategies per page
  • Improve accessibility (ARIA roles, keyboard navigation)
  • Explore Suspense streaming for partial rendering

🧠 Final Notes

This project prioritizes:

  • Clear architectural decisions
  • Performance-aware implementation
  • Maintainable and scalable code

The goal was not just to meet requirements, but to demonstrate how a production-ready frontend system is structured and optimized.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors