How devwonny/bookmarker works
Project type and purpose
• This is a full-stack Next.js web application (“Bookmarker”) that lets users search books (via the Aladin Open API), view details, find nearby bookstores, and maintain a local “wishlist.” It uses Next.js 13’s App Router, custom API routes under app/api/aladin, server & client components, and Zustand for client state.
File structure
• Top-level “app” directory: Next.js App Router pages and layouts, plus built-in API routes under app/api/aladin/bookList and bookSearch.
• “components”: React UI components (common, modals, bookstoreLocation).
• “services/book.ts”: abstraction over Aladin API calls, used by app/api routes.
• “utils/removeText.ts”: helper for text processing.
• “styles” & “public”: SCSS and static assets.
• “types”: shared TypeScript types.
• No external database: wishlist likely stored client-side (Zustand or localStorage).
README for additional insights
• Pages: Main, Search Results, Book Detail, Bookstore Location, Wishlist.
a. Main components:
• Client (Browser) – renders React pages + components, holds local state (Zustand)
• Next.js Server – hosts App Router pages + server components + API Routes
• API Routes (app/api/aladin/*) – serverless functions that proxy/fetch from the external Aladin API
• External Service – Aladin Open API endpoint(s)
• Assets & Styles – SCSS/Tailwind, public/static assets
b. Relationships & Data Flows:
1. Browser → Next.js Page (SSR or CSR)
2. Page invokes fetch()/useEffect or built-in Server Component fetch to Next.js API Route (or directly to Aladin if SSR)
3. API Route → Service Layer (services/book.ts) → External Aladin API → back to API Route → Next.js Page → Browser
4. Client State (Zustand) manages user interactions (wishlist additions/removals) purely in-browser
c. Architectural patterns & principles:
• Monolithic web app with built-in serverless API routes
• Separation of concerns: UI components vs data-fetching services vs route wiring
• Next.js App Router: clear division between server and client components (layout.tsx vs layoutClient.tsx)
• Unidirectional data flow: external API → service → route → page → UI
• Client state isolation (Zustand) for ephemeral/persistent UI state
d. Key technologies & libraries:
• Next.js 13 (App Router, Server Components, API Routes)
• TypeScript (types/ folder)
• Zustand (client state)
• SCSS + Tailwind (styles/)
• react-toastify, swiper, mui (UI extras)