How codeslator/react-gif-expert-app works
Project type and purpose
• This is a front-end single-page web application (SPA) built with React 18 + Vite + TypeScript.
• Purpose: let users search and display GIFs from the Giphy API in real time, maintain search history, and reset searches.
File structure
• Top‐level config and build scripts: package.json, tsconfig.json, vite.config.ts, jest.config.js.
• public/index.html + src/main.tsx: entry point served by Vite.
• src/router: React Router DOM setup.
• src/views: “page” and “layout” components — UI layer.
• src/views/layouts/AppLayout.tsx: common header/footer.
• src/views/pages: HomePage and GifListPage + their child components (AddCategory, GifGrid, GifItem, skelletons).
• src/components vs. src/views: logical separation of reusable UI pieces vs. page-specific components.
• src/hooks/useGifs.tsx: custom hook for fetching and caching GIF data.
• src/services/gif.service.ts: business-logic/service layer abstracts search history and fetch operations.
• src/api/giphyApi.ts: network adapter/fetch wrapper for Giphy REST endpoints.
• src/global: central environment variables, URL constants, and TypeScript types.
• src/tests: unit and snapshot tests organized by feature (components, hooks, services).
README for additional insights
• Confirms React, Vite, TypeScript, React Router DOM, PrimeReact/PrimeBlocks for UI.
• Fetch to Giphy API using VITE_GIPHY_API_KEY from .env.
• Testing with Jest + React Testing Library.
• Deployment on Vercel.
Key elements to capture
• Entry point: index.html & main.tsx → ReactDOM.render
• Router switch and route definitions
• AppLayout wrapping pages
• Page components invoking child components
• Hook abstraction for data fetching and caching
• Service as business logic wrapper
• API adapter constructing HTTP calls using environment variables
• Giphy API as the external dependency