How dnd-side-project/dnd-9th-5-frontend works
Main Components
• Client (Browser) & Presentation Layer: Represented by the Next.js front-end running on the client device.
• Next.js App & Routing Structure: The “src/app” directory clearly shows the use of Next13’s App Routing, divided into two major layout groups:
• (Main): Handles the core user-facing features such as Feed (포즈피드), Pick (포즈픽), and Talk (포즈톡).
• (Sub): Handles supportive or additional flows like Auth (login, withdraw), Detail (for individual pose details), and Menu.
• API Layer: The “src/apis” directory encapsulates API configurations and endpoints. There’s a bifurcation between public and private APIs, which shows how the app interacts with backend services.
• Component Library: “src/components” is populated with reusable UI elements (Buttons, Headers, Modals, etc.) which support the presentation logic.
• Global State and Data Fetching: The use of Recoil (for state management) and React Query (for server state, caching and data synchronization) is supported by “src/provider” and “src/hooks” directories.
Relationships and Data Flow
• The Client (Browser) renders the Next.js application and interacts with UI components.
• User requests are routed through the Next.js App “app” folder, where the (Main) and (Sub) directories handle different routing contexts (e.g., feed pages, auth flows, detail views).
• API calls from the Presentation Layer are executed via the API layer (using modules in “src/apis”), where different configurations (publicApi.ts and privateApi.ts) manage external and internal data interactions using Axios.
• Global Providers (RecoilProvider, QueryProvider, and HydrationProvider from “src/provider”) wrap the application to ensure state management and server data fetching across pages.
• All UI components interact with these providers and hooks to manage local and global state, and execute API calls.
Architectural Patterns and Design Principles
• Component-Based Architecture: The project is modular, with reusable components for UI elements, overlays, modals, etc.
• Separation of Concerns: Clear distinction between API logic (src/apis), UI components (src/components), application routes/layouts (src/app), and utilities/constants.
• Modern Next.js Techniques: Implements Next13 app routing, making use of file system-based routing and layouts to segregate major functionalities.
• State and Data Management: Utilizes Recoil for local state and React Query for server state management, ensuring scalable and reactive data fetching strategies.
Specific Technologies & Libraries
• Next.js (+ App Routing)
• TypeScript (Global type checking with “global.d.ts” and “next-env.d.ts”)
• Tailwind CSS (via “tailwind.config.js” and styles in “styles”)
• Recoil (state management)
• React Query (data fetching)
• Axios (for API requests)