How huynhnguyen1906/yumemi-frontend-test works
Main Components
• Frontend Application (Next.js): Represented by the “src/app” directory. This is where the Next.js layout and routing take place (e.g., layout.tsx and page.tsx).
• UI Components: Found largely in “src/components”. This includes:
‒ Layout components (in components/layout, e.g., AppLayout.tsx)
‒ Domain-specific UI components (in components/prefecture, e.g., PrefectureCheckbox.tsx and PrefectureSelector.tsx)
• API Layer: Located in “src/apis”. For instance, getPrefectures.ts and the corresponding TypeScript types in getPrefectures.ts.
• Utility Libraries: “src/libs” contains helper functions like apiClient.ts which are utilized by API calls.
• Styling: “src/styles” holds global styles (GlobalStyles.scss, _variables.scss) plus component-specific SCSS modules.
• Testing: “src/__tests__” holds tests for both APIs and components, illustrating that the project has a dedicated test suite.
Understand Relationships and Interactions
• The Next.js app (in “src/app”) serves as the entry point. It loads the overall application layout and determines routing.
• The page components (in the “app” directory) then incorporate UI components from “src/components” to build the user interface.
• Within these components, API calls (from “src/apis”) might be made using the client in “src/libs/apiClient.ts” to fetch data, such as prefecture data.
• Styling from the “src/styles” folder is applied within the components, ensuring a consistent look and feel.
• The test suite in “src/__tests__” is used to verify the behavior of both API logic and UI components, adhering to Test-Driven Development principles.
Important Architectural Patterns or Principles
• Component-Based Architecture: Following React’s paradigm, breaking down the UI into reusable, testable components.
• Separation of Concerns: Distinct directories for APIs, libraries, and UI components.
• Modern Next.js Features: The “app” directory structure suggests that the project is leveraging Next.js’s latest routing and layout capabilities.
• Testing Strategy: The presence of Jest configuration files and tests implies a strong emphasis on unit and integration testing.
• Consistent Styling: Use of SCSS modules allows for scoped CSS on a per-component basis.