How paratrip/client works
Project type and purpose
• This is a frontend-only single-page application (SPA) built with React, TypeScript, and Vite.
• It provides a travel/discovery platform with pages for home (locations, popular items, detail views), community (posts, popularity, write), tour courses (list, detail, navigation), authentication flows (login, sign-up, account recovery), and a user “My Page.”
• It uses CSS modules for styling, React Query for data-fetching, a small global store for local state, and integrates third-party services (e.g., Kakao login).
File structure
• Top level:
– public, src, dist, configuration (tsconfig, vite.config.ts, .eslintrc.js, netlify.toml).
– package.json defines dependencies and scripts.
• src/ directory modularized by concern:
– components/: reusable UI pieces (atoms, molecules, organism) and feature-specific groups (auth, home, community, tour-course).
– pages/: route-level views matching URL paths.
– routes/: routing configuration (path definitions + Router setup).
– services/: React Query hooks and adapters to fetch from backend/external APIs.
– store/: small Zustand/Recoil-like stores for session tokens, modal flags, community board state, etc.
– hooks/: custom React hooks for data fetching, mutation, validation, modal control, Kakao loader, etc.
– utils/: helpers, constants, endpoint definitions, validation, reducers.
• dist/: automated build output ready for Netlify deployment.
README
• States this is a minimal React + TypeScript + Vite template with ESLint and HMR configured.
1. Developer & Vite CLI
2. Vite Dev Server / Build Process
3. Browser / Client Runtime
4. React Application
– Router Layer (routes/routes.tsx + path configs)
– Page Components (src/pages/)
– Feature Components (src/components/)
– UI Library (src/components/ui/)
– Styling (CSS Modules)
– State Management (src/store/)
– Data Fetch Layer (src/services/react-query + src/hooks/useFetch, useMutate)
– Utilities & Helpers (src/utils/)
5. External Services
– REST/GraphQL backend API (endpoints in src/utils/endpoint)
– Third-party Auth (Kakao)
6. Hosting / CDN (Netlify serving dist/)
• Development flow:
Developer → Vite CLI → Vite Dev Server → Browser (HMR)
• Build/deploy flow:
Developer → Vite CLI (build) → dist/ → Netlify → CDN → Browser
• Runtime data flow:
Browser → React App → Router → Page → Component → Hook/Service → External API → Service returns data → React Query updates cache → Store updates (if any) → Component re-render → Browser
• State flow:
Component ↔ Store (read/write)
Component → Utils/Reducers → Local state updates
• Auth flow:
Component → Kakao SDK → OAuth redirect → Token → Store → ProtectedRoute wrapper grants access
c. Architectural patterns & principles:
• Component-based (atomic + composite pattern)
• Container (pages) vs Presentational components (ui/*)
• Hooks for side effects and data fetching (custom hooks)
• Centralized data caching and synchronization via React Query
• Small global stores for ephemeral UI state and session tokens
• CSS Modules for scoped styling
• Code-splitting by route (implicit via Vite and dynamic imports if used)
d. Key technologies & frameworks:
• React 18 + TypeScript
• Vite (dev server, build)
• React Router or custom routing (routes/routes.tsx)
• React Query for async data
• Zustand (or similar) for store
• CSS Modules
• Netlify for hosting
• ESLint / Prettier for code quality
• Kakao JS SDK for OAuth login