# takeruhukushima/dekoboko architecture

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

- Interactive diagram: https://gitdiagram.com/takeruhukushima/dekoboko
- Repository: https://github.com/takeruhukushima/dekoboko

## Overview

##### Main Components Identification

The system appears to be a modern full-stack application with the following key components:

a) Frontend Layer:
- Next.js Application (React-based)
- UI Components System
- Client-side Hooks
- Type Definitions
- Styling System (Tailwind CSS)

b) Backend Layer:
- Prisma ORM
- Supabase Integration
- AI Integration
- NFT Functionality

c) Database Layer:
- Prisma Database (likely PostgreSQL through Supabase)

**Client Layer (Top)**
**↓**
**Application Layer (Middle)**
**↓**
**Data Layer (Bottom)**

##### Specific Component Breakdown

Frontend Components:
- Pages structure (Profile, Quest)
- Hooks integration (useSupabase)
- Static Assets (public/images)

Middleware/Application Layer:
- Next.js API Routes
- AI Integration (src/lib/ai.ts)
- NFT Integration (src/lib/nft.ts)
- Supabase Client (src/lib/supabaseClient.ts)

Data Layer:
- Prisma Schema
- Database Migrations
- Supabase Backend Services

##### Connection Flows

- User interaction flow
- Data flow between components
- Authentication flow through Supabase
- NFT and AI service interactions

##### Important Architectural Patterns to Highlight

- Next.js App Router architecture
- Component-based UI structure
- Type-safe data flow (TypeScript)
- ORM-based data access
- Serverless architecture (implied by Next.js and Supabase usage)

##### Additional Elements

- Authentication flow
- File storage (if using Supabase storage)
- API endpoints
- External service integrations

##### Notes for Implementation

- Maintain appropriate spacing
- Related components
- Version information
- Brief descriptions for main components

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        UI["UI Components"]:::frontend
        Pages["Pages"]:::frontend
        Hooks["Client Hooks"]:::frontend
        Types["Type Definitions"]:::frontend
        Styles["Styling System"]:::frontend
        Layout["App Layout"]:::frontend
        Assets["Static Assets"]:::frontend
    end

    subgraph Application
        API["API Routes"]:::backend
        Auth["Authentication"]:::backend
        AI["AI Service"]:::external
        NFT["NFT Service"]:::external
        Supabase["Supabase Client"]:::backend
        Utils["Utility Functions"]:::backend
    end

    subgraph Data
        PrismaORM["Prisma ORM"]:::database
        DB["Database"]:::database
        Migrations["DB Migrations"]:::database
    end

    UI --> Layout
    Pages --> Layout
    Hooks --> Pages
    Types --> Pages
    Styles --> UI
    Assets --> UI

    Pages --> API
    API --> Auth
    Auth --> Supabase
    API --> AI
    API --> NFT
    API --> Utils

    Supabase --> DB
    PrismaORM --> DB
    Migrations --> DB

    %% Click events
    click UI "https://github.com/takeruhukushima/dekoboko/tree/main/src/app/components/ui/"
    click Pages "https://github.com/takeruhukushima/dekoboko/blob/main/src/app/profile/page.tsx"
    click Hooks "https://github.com/takeruhukushima/dekoboko/blob/main/src/hooks/useSupabase.ts"
    click Types "https://github.com/takeruhukushima/dekoboko/blob/main/src/types/index.d.ts"
    click Styles "https://github.com/takeruhukushima/dekoboko/tree/main/src/styles/"
    click Layout "https://github.com/takeruhukushima/dekoboko/blob/main/src/app/layout.tsx"
    click Assets "https://github.com/takeruhukushima/dekoboko/tree/main/public/images/"
    click AI "https://github.com/takeruhukushima/dekoboko/blob/main/src/lib/ai.ts"
    click NFT "https://github.com/takeruhukushima/dekoboko/blob/main/src/lib/nft.ts"
    click Supabase "https://github.com/takeruhukushima/dekoboko/blob/main/src/lib/supabaseClient.ts"
    click Utils "https://github.com/takeruhukushima/dekoboko/blob/main/src/app/lib/utils.ts"
    click PrismaORM "https://github.com/takeruhukushima/dekoboko/blob/main/prisma/schema.prisma"
    click Migrations "https://github.com/takeruhukushima/dekoboko/tree/main/prisma/migrations/"

    %% Styling
    classDef frontend fill:#3b82f6,color:white
    classDef backend fill:#22c55e,color:white
    classDef database fill:#eab308,color:black
    classDef external fill:#a855f7,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Service"]:::backend
        Database["Database Component"]:::database
        External["External Service"]:::external
    end
```
