# st1llwater/otakunote-revamp architecture

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

- Interactive diagram: https://gitdiagram.com/st1llwater/otakunote-revamp
- Repository: https://github.com/st1llwater/otakunote-revamp

## Overview

##### Project type and purpose
- OtakuNote is a full-stack, server-rendered & client-hydrated web application built on Next.js (v14).
- Its purpose is to let users browse, search, and manage an anime watchlist via a rich, interactive UI. It fetches data from an external GraphQL anime API, persists user session/status client-side, and is deployed as a serverless app (e.g. Vercel).

##### File structure
- Top-level files: next.config.mjs, tailwind.config.ts, codegen.yml, package.json – define build, styling, GraphQL codegen.
- src/app/ → Next.js App Router pages (home/trending, search, watchlist, calendar).
- src/app/components/ → React UI components (cards, carousels, modals, reusable UI primitives under ui/).
- src/app/lib/graphql/ → GraphQL client setup + generated queries/types, plus REST API wrapper (animeApi.ts).
- src/app/providers/ → Context providers: React Query, Session (next-auth?), Theme.
- src/app/store/ → Jotai atoms for managing local UI & user data.
- public/ → static assets (fonts).

##### README for technical stack & patterns
- Next.js + React 18 with SSR/SSG + client hydration
- Tailwind CSS for styling, Framer Motion for animations
- Jotai for client state
- GraphQL (code-generated) as primary data layer
- Radix UI & Sonner for UI primitives

##### Elements
- Blue rectangles for compute nodes (Browser, Next.js Server)
- Yellow circles or rectangles for state layers (Jotai, React Query)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Browser
    subgraph "Frontend (Browser)" 
        direction TB
        ReactClient["React 18 Client"]:::compute
        subgraph "UI Components"
            direction TB
            AnimeCard["Anime Card Variants"]:::compute
            Carousel["Carousels & Items"]:::compute
            DetailModal["Detail Modal"]:::compute
            Draggable["Draggable Wrapper"]:::compute
            FeatureTab["Feature Tabs & Season Headers"]:::compute
            HeaderSplash["Header & Splash"]:::compute
            WatchlistButtons["Watchlist & Remove Buttons"]:::compute
            StatTestimonial["Stat & Testimonial Cards"]:::compute
            TruncateText["Truncate Text"]:::compute
        end
        subgraph "UI Primitives (Radix UI & Sonner)" 
            direction TB
            UIPackage["UI Primitives"]:::compute
        end
        subgraph "State Management"
            direction TB
            ReactQuery["React Query Cache"]:::state
            JotaiStore["Jotai Atoms"]:::state
        end
        subgraph "GraphQL Client"
            direction TB
            GQLClient["GraphQL Client Setup"]:::compute
            GQLGenerated["Generated Types & Schema"]:::compute
        end
    end

    %% Server
    subgraph "Next.js Server (SSR/SSG)" 
        direction TB
        HomePage["Home/Trending Page"]:::compute
        CalendarPage["Calendar Page"]:::compute
        SearchPage["Search Page"]:::compute
        WatchlistPage["Watchlist Page"]:::compute
    end

    %% External Services
    subgraph "External Services"
        direction TB
        ExtGraphQL["External GraphQL Anime API"]:::service
        CDN["Static Asset CDN"]:::storage
        Vercel["Vercel Deployment"]:::service
    end

    %% Connections
    ReactClient -->|renders UI| AnimeCard
    ReactClient -->|renders UI| Carousel
    ReactClient -->|renders UI| DetailModal
    ReactClient -->|renders UI| Draggable
    ReactClient -->|renders UI| FeatureTab
    ReactClient -->|renders UI| HeaderSplash
    ReactClient -->|renders UI| WatchlistButtons
    ReactClient -->|renders UI| StatTestimonial
    ReactClient -->|renders UI| TruncateText

    AnimeCard --> ReactQuery
    Carousel --> ReactQuery
    DetailModal --> ReactQuery
    WatchlistButtons --> ReactQuery

    ReactQuery --> JotaiStore
    JotaiStore --> ReactQuery

    ReactClient -->|uses| GQLClient
    GQLClient -->|reads types| GQLGenerated

    ReactClient -->|client-side fetch| ExtGraphQL
    HomePage -->|SSR fetch| ExtGraphQL
    CalendarPage -->|SSR fetch| ExtGraphQL
    SearchPage -->|SSR fetch| ExtGraphQL
    WatchlistPage -->|SSR fetch| ExtGraphQL

    ReactClient -->|page request| HomePage
    ReactClient -->|page request| CalendarPage
    ReactClient -->|page request| SearchPage
    ReactClient -->|page request| WatchlistPage

    ReactClient -->|requests assets| CDN
    HomePage -->|serves from| CDN

    Next.jsServerClick[Invisible]:::compute

    %% Click Events
    click HomePage "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/page.tsx"
    click CalendarPage "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/calendar/page.tsx"
    click SearchPage "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/search/page.tsx"
    click WatchlistPage "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/watchlist/page.tsx"
    click AnimeCard "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/anime-card.tsx"
    click AnimeCard "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/anime-card-v2.tsx"
    click Carousel "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/anime-carousel.tsx"
    click Carousel "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/carousel-item.tsx"
    click Carousel "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/horizontal-carousel.tsx"
    click Carousel "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/horizontal-carousel-v2.tsx"
    click DetailModal "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/detail-modal.tsx"
    click Draggable "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/draggable.tsx"
    click FeatureTab "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/feature-tab.tsx"
    click FeatureTab "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/season-header.tsx"
    click HeaderSplash "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/header.tsx"
    click HeaderSplash "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/splash.tsx"
    click WatchlistButtons "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/watchlist-button.tsx"
    click WatchlistButtons "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/remove-button.tsx"
    click StatTestimonial "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/stat-card.tsx"
    click StatTestimonial "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/testimonial-card.tsx"
    click TruncateText "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/components/truncate-text.tsx"
    click UIPackage "https://github.com/st1llwater/otakunote-revamp/tree/main/src/app/components/ui/"
    click GQLClient "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/lib/graphql/client.ts"
    click GQLGenerated "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/lib/graphql/generated/graphql.ts"
    click ReactQuery "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/providers/ReactQueryProvider.tsx"
    click JotaiStore "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/store/index.ts"
    click ExtGraphQL "https://github.com/st1llwater/otakunote-revamp/blob/main/src/app/lib/api/animeApi.ts"
    click CDN "https://github.com/st1llwater/otakunote-revamp/tree/main/public/"

    %% Styles
    classDef compute fill:#D0E8FF,stroke:#0366d6
    classDef service fill:#DFFFE0,stroke:#228B22
    classDef state fill:#FFF5B1,stroke:#DAA520,stroke-dasharray:5 5
    classDef storage fill:#E8E8E8,stroke:#808080

    %% Legend
    subgraph Legend
        direction TB
        L1["Blue = Compute Nodes"]:::compute
        L2["Green = External Services"]:::service
        L3["Yellow = State Layers"]:::state
        L4["Gray = Static Assets"]:::storage
    end
```
