How numulix/booklookup works
Project Type & Purpose
• This is a single‐page web application (SPA) built with React and Vite.
• Its purpose is to let users search for books via the Open Library API, display results, view details, and keep track of viewed books.
Key Architectural Components
a. Browser / Client
• Renders index.html and runs the React bundle delivered by Vite.
b. Build & Deployment (Vite)
• Vite compiles TSX, CSS, assets into a static bundle, served from /public.
c. Routing Layer
• routes.ts + React Router v7 defines URL→Page mapping (LandingPage, BookDetailsPage).
d. Presentation Layer (Pages & UI Components)
• Pages (src/pages) compose Layout + feature components.
• UI components (src/components/ui) render lists, loading/error states, search bar.
• Layout component (src/components/layout/Layout.tsx) provides common header/footer.
e. State Management
• Redux Toolkit (src/store/index.ts) with RTK Query (src/store/api/bookApi.ts) for remote data fetch, caching, invalidation.
• ViewedBooksContext tracks books the user has seen locally (Context API).
f. Business Logic & Hooks
• Custom hook useBookSearch abstracts search logic, calls RTK Query endpoints.
• Feature‐level components (src/features) wire UI → hooks → store.
g. Utility & Types
• Shared utils (src/utils/bookUtils.ts) for data transformations.
• Type definitions in src/types enforce consistency.
External Dependencies
• Open Library API (external REST service): search and retrieve book metadata.
• Tailwind v4 for styling.
• Prettier & ESLint for code quality.