How davidskdevgithub/challenge-fravegatech works
Project type and purpose
• This is a full-stack React application built on Next.js.
• It implements a GitHub user search and detail viewer with client-side fetching (CSR) for the home/search page and server-side rendering (SSR) for user detail pages.
• It uses feature-based modules under src/modules, React Query for data fetching, Zustand for client state (favorites), Tailwind CSS for styling, and is deployed via Vercel with GitHub Actions CI/CD.
Main components
a. Browser (Client)
• Next.js front-end in the user’s browser
• UI components: SearchBar, UserList, UserCard, UserDetail, FavoriteIcon
• React Query layer (caching, loading/error states)
• Zustand store (favorites state)
b. Next.js Server (Serverless)
• SSR pages (e.g., /users/[username])
• API Routes (e.g., /api/hello)
• Next.js build & static hosting (public assets, optimized fonts)
c. External Services
• GitHub REST API endpoints:
• GET /users
• GET /search/users?q={term}
• GET /users/{username}
d. CI/CD Pipeline & Hosting
• GitHub Actions workflows (ci.yml, cd.yml)
• Vercel deployment
e. Developer Tooling & Config
• ESLint, Tailwind config, Vitest (tests)
Relationships and data flow
1. Browser → Next.js SSR
• User navigates to /users/[username] → Next.js server pre-renders page
2. Browser → Next.js CSR
• Home page loads React app; SearchBar hook (useDebounce) invokes React Query
3. React Query → GitHub API
• Direct fetch calls from the client to GitHub’s endpoints for search/users and users/{username}
4. Zustand Store
• Favorite toggles update local state; persisted in-memory or localStorage
5. Browser ↔ Next.js API Routes
• (Optional) Could proxy through /api/*
6. CI/CD → Vercel
• Commits trigger GitHub Actions → build/test → deploy to Vercel
Architectural patterns and design principles
• Feature-based module structure (src/modules/{search,users}) grouping components, hooks, services, tests
• Clear separation of concerns:
• UI (components)
• Logic (hooks)
• Data access (services)
• State (Zustand store)
• Hybrid rendering: CSR for dynamic search, SSR for SEO-critical detail pages
• Serverless functions for lightweight APIs and edge optimizations
• Automated testing with Vitest and ESLint for code quality
Must-include elements
• Component labels (e.g., “SearchInput.tsx,” “useGitHubUsers()”)