# team-tecktrek/tecktrek architecture

> Architecture diagram of the GitHub repository team-tecktrek/tecktrek, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/team-tecktrek/tecktrek
- Repository: https://github.com/team-tecktrek/tecktrek

## Overview

##### Project Type & Purpose
- This is a frontend-centric, Next.js web application (no separate backend repository).

##### File Structure Insights
Top-level directories/files:
– src/app → Next.js “app router” pages (dev, top, play).
– mocks → MSW handlers for test/dev HTTP stubbing.
– .storybook → Storybook config for component development.
– vitest.config.ts, vitest.shims.d.ts → Test runner config.

Architectural patterns:
– Next.js SSR/CSR with “app router”
– Component-based UI (React + TypeScript)
– MSW for local API simulation & tests
– Storybook for isolated component development

##### Main Components & Relationships
a. Next.js Server Layer (Node.js/Vercel)
- Hosts SSR/Static pages from src/app
- Serves static assets from public/
b. React Frontend Layer
- Pages:
– /top → UserCreateModal + NoticeList
– /play → DrawingBoard + CanvasToolbar + Timer + ColorPalette + CardCounter
c. State Management & Hooks
- useNotifyTimeUp, local React state for drawing, timer
d. Mocks & Testing Layer
- MSW browser/server (mocks/*) intercepts fetch/XHR in dev/tests
- Vitest for unit tests & Storybook for visual tests
e. Static Assets
f. Build & Tooling
- ESLint (.eslintrc), Prettier, Stylelint, Husky pre-commit
- PostCSS, next/font, next.config.ts

##### Architectural Patterns & Principles
– Separation of concerns: Pages vs. shared components
– Component reusability & isolation (Storybook)
– Client-side API abstraction (MSW)
– Zero-trust state: hooks encapsulate logic
– SSR vs CSR balance via Next.js app router

##### Must-Include
– Component boundaries (server vs. client vs. dev)
– Tech stack labels (Next.js, React, MSW, Storybook, Vitest)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Next.js Server Layer
    subgraph "Next.js Server Layer" 
        direction TB
        NextServer["Next.js Server (App Router)"]:::server
        LAYOUT["layout.tsx"] 
        GLOBALS["globals.css"]
        PAGE_ROOT["page.tsx"]
        PAGE_TOP["top/page.tsx"]
        PAGE_PLAY["play/page.tsx"]
        PAGE_DEV["dev/color-palette/page.tsx"]
    end

    %% Browser / React App
    subgraph "Browser / React Application"
        direction TB
        Browser["User Browser"]:::browser
        subgraph "Pages"
            direction TB
            TopPage["/top"]:::browser
            PlayPage["/play"]:::browser
            DevPage["/dev/color-palette"]:::browser
        end
        subgraph "UI Component Library"
            direction TB
            UIButton["UI Primitives"]:::browser
            Icons["Icon Set"]:::browser
            Helpers["Shared Helpers"]:::browser
        end
        subgraph "Domain Components"
            direction TB
            UserModal["UserCreateModal"]:::browser
            Notices["NoticeList/Dialog"]:::browser
            MusicToggle["MusicToggleButton"]:::browser
            DrawingBoard["DrawingBoard/Canvas"]:::browser
            Toolbar["Canvas Toolbar & Palettes"]:::browser
            TimerCounter["Timer & CardCounter"]:::browser
        end
        Hook["useNotifyTimeUp"]:::browser
    end

    %% Static Assets
    subgraph "Static Assets" 
        direction TB
        IconsDir["public/icons"]:::storage
        ImagesDir["public/image"]:::storage
        SoundsDir["public/sounds"]:::storage
        MSWWorker["mockServiceWorker.js"]:::storage
    end

    %% Dev & Testing Tooling
    subgraph "Development & Testing" 
        direction TB
        MSW["MSW Handlers"]:::toolbox
        Vitest["Vitest Config"]:::toolbox
        Storybook["Storybook"]:::toolbox
        Linting["Lint/Format/Hooks"]:::gear
        BuildTool["Next.js/PostCSS/TSConfig"]:::gear
    end

    %% Connections
    Browser <-->|"SSR/CSR requests"| NextServer
    Browser -->|"fetch assets"| IconsDir
    Browser -->|"fetch assets"| ImagesDir
    Browser -->|"fetch assets"| SoundsDir
    Browser -->|"loads worker"| MSWWorker
    Browser <-->|"intercepts API"| MSW
    Storybook -->|"renders"| UIButton
    Storybook -->|"renders"| Icons
    Vitest -->|"tests"| UIButton
    Vitest -->|"tests"| Helpers
    Linting -->|"pre-commit"| NextServer
    Linting -->|"pre-commit"| UIButton
    BuildTool -->|"builds"| NextServer
    BuildTool -->|"builds"| Browser

    %% Click Events - Next.js Server Layer
    click LAYOUT "https://github.com/team-tecktrek/tecktrek/blob/develop/src/app/layout.tsx"
    click GLOBALS "https://github.com/team-tecktrek/tecktrek/blob/develop/src/app/globals.css"
    click PAGE_ROOT "https://github.com/team-tecktrek/tecktrek/blob/develop/src/app/page.tsx"
    click PAGE_TOP "https://github.com/team-tecktrek/tecktrek/blob/develop/src/app/top/page.tsx"
    click PAGE_PLAY "https://github.com/team-tecktrek/tecktrek/blob/develop/src/app/play/page.tsx"
    click PAGE_DEV "https://github.com/team-tecktrek/tecktrek/blob/develop/src/app/dev/color-palette/page.tsx"

    %% Click Events - Pages
    click TopPage "https://github.com/team-tecktrek/tecktrek/blob/develop/src/app/top/page.tsx"
    click PlayPage "https://github.com/team-tecktrek/tecktrek/blob/develop/src/app/play/page.tsx"
    click DevPage "https://github.com/team-tecktrek/tecktrek/blob/develop/src/app/dev/color-palette/page.tsx"

    %% Click Events - UI Library
    click UIButton "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/ui/button.tsx"
    click UIButton "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/ui/dialog.tsx"
    click UIButton "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/ui/input.tsx"
    click UIButton "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/ui/label.tsx"
    click Icons "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/icons/EraserIcon.tsx"
    click Icons "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/icons/PencilIcon.tsx"
    click Icons "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/icons/RedoIcon.tsx"
    click Icons "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/icons/TrashIcon.tsx"
    click Icons "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/icons/UndoIcon.tsx"
    click Helpers "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/common/helper/index.ts"

    %% Click Events - Domain Components
    click UserModal "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/top/UserCreateModal.tsx"
    click Notices "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/notification/NoticeList.tsx"
    click Notices "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/notification/NoticeDialog.tsx"
    click Notices "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/notification/NoticeItem.tsx"
    click Notices "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/notification/button.tsx"
    click Notices "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/notification/types.ts"
    click MusicToggle "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/music-button/MusicToggleButton.tsx"
    click DrawingBoard "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/play/DrawingBoard.tsx"
    click DrawingBoard "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/play/DrawingCanvas.tsx"
    click Toolbar "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/play/CanvasToolbar.tsx"
    click Toolbar "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/play/ToolPalettePanel.tsx"
    click Toolbar "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/play/ColorPalette.tsx"
    click Toolbar "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/play/StrokeWidthSlider.tsx"
    click TimerCounter "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/play/Timer.tsx"
    click TimerCounter "https://github.com/team-tecktrek/tecktrek/blob/develop/src/components/play/CardCounter.tsx"

    %% Click Events - Hooks
    click Hook "https://github.com/team-tecktrek/tecktrek/blob/develop/src/hooks/useNotifyTimeUp.tsx"

    %% Click Events - Mocks & Testing
    click MSW "https://github.com/team-tecktrek/tecktrek/blob/develop/mocks/handler.ts"
    click MSW "https://github.com/team-tecktrek/tecktrek/blob/develop/mocks/browser.ts"
    click MSW "https://github.com/team-tecktrek/tecktrek/blob/develop/mocks/server.ts"
    click MSW "https://github.com/team-tecktrek/tecktrek/blob/develop/mocks/utils.ts"
    click MSW "https://github.com/team-tecktrek/tecktrek/blob/develop/mocks/test/index.ts"
    click Vitest "https://github.com/team-tecktrek/tecktrek/blob/develop/vitest.config.ts"
    click Vitest "https://github.com/team-tecktrek/tecktrek/blob/develop/vitest.shims.d.ts"
    click Storybook "https://github.com/team-tecktrek/tecktrek/blob/develop/.storybook/main.ts"
    click Storybook "https://github.com/team-tecktrek/tecktrek/blob/develop/.storybook/preview.ts"
    click Storybook "https://github.com/team-tecktrek/tecktrek/blob/develop/vitest.setup.ts"

    %% Click Events - Static Assets
    click IconsDir "https://github.com/team-tecktrek/tecktrek/tree/develop/public/icons"
    click ImagesDir "https://github.com/team-tecktrek/tecktrek/tree/develop/public/image"
    click SoundsDir "https://github.com/team-tecktrek/tecktrek/blob/develop/public/sounds/bo-tto_hidamari.mp3"
    click MSWWorker "https://github.com/team-tecktrek/tecktrek/blob/develop/public/mockServiceWorker.js"

    %% Click Events - Build & Tooling
    click BuildTool "https://github.com/team-tecktrek/tecktrek/blob/develop/next.config.ts"
    click Linting "https://github.com/team-tecktrek/tecktrek/blob/develop/eslint.config.mjs"
    click Linting "https://github.com/team-tecktrek/tecktrek/blob/develop/.prettierrc.json"
    click Linting "https://github.com/team-tecktrek/tecktrek/blob/develop/.stylelintrc.json"
    click Linting "https://github.com/team-tecktrek/tecktrek/tree/develop/.husky/pre-commit"
    click BuildTool "https://github.com/team-tecktrek/tecktrek/blob/develop/postcss.config.mjs"
    click BuildTool "https://github.com/team-tecktrek/tecktrek/blob/develop/tsconfig.json"

    %% Styles
    classDef server fill:#cfe2ff,stroke:#333,stroke-width:1px
    classDef browser fill:#d1e7dd,stroke:#333,stroke-width:1px
    classDef storage fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef toolbox fill:#e2e3e5,stroke:#333,stroke-width:1px
    classDef gear fill:#e5d6f7,stroke:#333,stroke-width:1px
```
