How thusspokedata/kooben-fe works
Project Type and Purpose
• This is a modern e-commerce platform for a furniture store, built as a full-stack application.
• The frontend is built with Next.js, TypeScript, and Mantine for UI, with external integrations such as Clerk (for authentication), Axios (for HTTP calls), TanStack Query (for state management/fetching), and a custom error handling system.
• The backend is separate and developed using NestJS (see the kooben-be repo).
• The project uses Docker for containerization, with CI/CD and code quality/security pipelines implemented via GitHub Actions, Amazon CodeGuru, and TruffleHog.
Analyzing the File Structure
• The project is primarily organized within the /src directory. The “app” folder is structured into several key subdirectories:
• (auth) for authentication flows (sign-in and sign-up)
• (checkout) for checkout processes including cart and order verification UI components
• (shop) for catalog and product details, indicating a clear separation of concerns for catalog browsing and product detail presentation.
• There are separate directories for reusable components (/components), assets (/assets), styles (/public and /styles), and state management (/store).
• API functions are encapsulated under /src/api as well as a specific segment under /src/app/api for user-related endpoints.
• You also have global layout and utility functionality which reflects a modular and component-based architecture.
a. Main Components:
• Frontend layer: Next.js application including pages, components, hooks, state management, and UI-specific modules (Mantine-based styling).
• Authentication: Integration with Clerk for handling user authentication.
• State Management & Data Fetching: TanStack Query (integrated in API calls using Axios) and custom error handling.
• Backend Interface: A separate backend service built with NestJS (from the related repository) that the Next.js app communicates with via REST APIs.
• External Services: Docker (containerization), GitHub Actions (CI/CD), and Code scanning/security tools like Amazon CodeGuru and TruffleHog.
• Related DevOps & CI/CD: GitHub Actions workflows, Dockerfile, and docker-compose configuration that outline how the application is built, tested, and deployed.
b. Relationships/Interactions:
• The Next.js frontend interacts with the backend API endpoints to fetch product data, user data, and process transactions.
• The application calls external APIs (via Axios), with TanStack Query managing caching and state updates.
• Clerk is used for authentication throughout the frontend, ensuring secure sign-in/signup flows.
• Data flows from the state management layer (/store, hooks) to various components (UI elements in /components, pages in /app).
• CI/CD processes automatically build and containerize the application via Docker and GitHub Actions; these processes then push images to Docker Hub.
• Development and security tools (Amazon CodeGuru, TruffleHog) operate outside the main runtime architecture as part of code quality and security pipelines.
c. Architectural Patterns & Principles:
• Modular design: A clear separation between pages, shared components, API hooks, and reusable utilities.
• Layered architecture: UI layer, business logic layer (state management and services), and the backend API layer.
• Separation of concerns: Authentication, checkout workflows, and catalog browsing are segmentized into different directories.
• Containerization and CI/CD integrate deployment best practices.