# hmu332233/q-link architecture

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

- Interactive diagram: https://gitdiagram.com/hmu332233/q-link
- Repository: https://github.com/hmu332233/q-link

## Overview

##### Main Components

a. Frontend Layer:
- Next.js Application (React)
- Components Structure
- Internationalization System
- Client-side Routing

b. Backend Layer:
- API Routes
- Database Controller
- Link Management System

c. External Services:
- Database (implied by db client)
- Analytics (Google Tag Manager integration)

**Client Layer (Top)**

**API Layer (Middle)**

**Data Layer (Bottom)**

##### Specific Component Details

- Main UI components (Layout, Header, StepForm, etc.)
- Internationalization system with locales
- Routing structure (/links/[id], /links/new, etc.)

- Next.js API routes
- Server controllers
- Link management system

- Database client
- Data models for links and quizzes

##### Key Interactions to Highlight

- User interaction flow for creating new quiz-protected links
- Quiz verification process
- Link retrieval and validation flow
- Internationalization content delivery

##### Technical Stack Indicators

Technology labels for:
- Next.js
- TypeScript
- Tailwind CSS
- Database system

##### Additional Elements

Include:
- Version information
- External service integrations
- Security flow indicators

Remember to:
- Clear separation between client and server components
- Internationalization system as it's a key feature
- Error handling and validation flows

This will provide a comprehensive view of how Q.Link protects shared links behind quiz challenges while maintaining a clean, modern web architecture.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        UI[UI Layer]
        Layout[Layout]
        Header[Header]
        StepForm[StepForm]
        QLinkContents[Quiz Content]
        LangSelector[Language Selector]
        ShareBtn[Share Button]
        FeedbackMsg[Feedback Message]
        Forms[Form Components]
    end

    subgraph Routes
        ClientRoutes[Client Routes]
        LinkRoutes["/links"]
        NewLink["/links/new"]
        ViewLink["[id]"]
        Complete["/complete"]
    end

    subgraph I18N
        Locales[Localization System]
        EN[English]
        KO[Korean]
        MS[Malaysian]
        TR[Turkish]
    end

    subgraph API
        APIRoutes[API Routes]
        LinkAPI[Link Management API]
        Controllers[Backend Controllers]
    end

    subgraph Data
        DB[(Database)]
        DBClient[Database Client]
        Analytics[Google Analytics]
    end

    UI --> Layout
    Layout --> Header
    Layout --> StepForm
    Layout --> QLinkContents
    Layout --> LangSelector
    Layout --> ShareBtn
    Layout --> FeedbackMsg
    Layout --> Forms

    ClientRoutes --> LinkRoutes
    ClientRoutes --> NewLink
    ClientRoutes --> ViewLink
    ClientRoutes --> Complete

    Locales --> EN
    Locales --> KO
    Locales --> MS
    Locales --> TR

    UI --> ClientRoutes
    UI --> Locales

    APIRoutes --> LinkAPI
    LinkAPI --> Controllers
    Controllers --> DBClient
    DBClient --> DB
    UI --> Analytics

    classDef frontend fill:#dae8fc,stroke:#6c8ebf
    classDef api fill:#d5e8d4,stroke:#82b366
    classDef data fill:#fff2cc,stroke:#d6b656
    classDef i18n fill:#e1d5e7,stroke:#9673a6

    class UI,Layout,Header,StepForm,QLinkContents,LangSelector,ShareBtn,FeedbackMsg,Forms frontend
    class APIRoutes,LinkAPI,Controllers api
    class DB,DBClient,Analytics data
    class Locales,EN,KO,MS,TR i18n

    click Layout "https://github.com/hmu332233/q-link/blob/main/components/Layout.tsx"
    click Header "https://github.com/hmu332233/q-link/blob/main/components/Header.tsx"
    click StepForm "https://github.com/hmu332233/q-link/blob/main/components/StepForm.tsx"
    click QLinkContents "https://github.com/hmu332233/q-link/blob/main/components/QLinkContents.tsx"
    click LangSelector "https://github.com/hmu332233/q-link/blob/main/components/LanguageSelector.tsx"
    click ShareBtn "https://github.com/hmu332233/q-link/blob/main/components/ShareButton.tsx"
    click FeedbackMsg "https://github.com/hmu332233/q-link/blob/main/components/FeedbackMessage.tsx"
    click Forms "https://github.com/hmu332233/q-link/tree/main/components"
    click NewLink "https://github.com/hmu332233/q-link/blob/main/pages/links/new.tsx"
    click ViewLink "https://github.com/hmu332233/q-link/blob/main/pages/links/[id].tsx"
    click Complete "https://github.com/hmu332233/q-link/blob/main/pages/links/complete.tsx"
    click LinkRoutes "https://github.com/hmu332233/q-link/tree/main/pages/links"
    click EN "https://github.com/hmu332233/q-link/tree/main/public/locales/en"
    click KO "https://github.com/hmu332233/q-link/tree/main/public/locales/ko"
    click MS "https://github.com/hmu332233/q-link/tree/main/public/locales/ms"
    click TR "https://github.com/hmu332233/q-link/tree/main/public/locales/tr"
    click LinkAPI "https://github.com/hmu332233/q-link/blob/main/pages/api/links/index.ts"
    click Controllers "https://github.com/hmu332233/q-link/blob/main/server/controller/links/index.ts"
    click DBClient "https://github.com/hmu332233/q-link/blob/main/server/libs/db/client.ts"
    click Analytics "https://github.com/hmu332233/q-link/blob/main/libs/gtag/index.ts"
```
