How klhong124/builtbypixel-code-test works
Project Type and Purpose
• A frontend-centric, full-stack-style application built on Next.js 15 (App Router).
• Purpose: A responsive Task Management UI that fetches and mutates data via a remote GraphQL service, with server-side rendering (SSR), client hydration, theme support, and analytics.
Main Architectural Components
• Browser / Client: Renders React UI, handles user events, client-side routing.
• Next.js Server (App Router):
– Handles SSR/SSG of pages (app/layout.tsx, app/page.tsx, tasks pages).
– Exposes static assets (public/, styles/) and generates HTML on-the-fly.
• React Components:
– Feature modules under app/tasks (layout, page, dynamic [status] routes, subcomponents).
– Shared UI modules under components/ui.
– Global providers (components/theme-provider.tsx).
• Data Layer:
– Apollo Client (utils/apolloClient.ts) for GraphQL operations.
– Generated GraphQL types (types/graphql.d.ts via codegen.ts).
– GraphQL query documents (app/tasks/graphql/*.gql).
• External Services:
– Remote GraphQL API endpoint (environment variable).
– Vercel Analytics for performance tracking.
– Static asset CDN (Vercel/public).
Interactions and Data Flow
• User opens browser → requests a route (e.g., /tasks/new).
• Next.js server performs SSR: imports page component, runs getServerSideProps or React server components, executes Apollo Client query against GraphQL API, renders HTML.
• HTML + serialized Apollo cache → sent to browser; React hydrates.
• Client-side interactions (filter toggles, sorting) trigger Apollo Client queries to GraphQL, update in-memory cache, re-render TaskList.
• Analytics events sent to Vercel during navigation and interactions.
Architectural Patterns and Principles
• Feature-based directories (app/tasks) for encapsulation.
• Server components vs. client components separation using Next.js App Router.
• Atomic UI design via shadcn/ui in components/ui.
• Type-safe GraphQL workflow: codegen → TypeScript types.
• Responsive/mobile-first + dark/light theme orchestration.