# that-veejay/jotdb architecture

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

- Interactive diagram: https://gitdiagram.com/that-veejay/jotdb
- Repository: https://github.com/that-veejay/jotdb

## Overview

##### Project type and purpose
- From the README (“JOTDB – A lightweight, distraction-free web app for capturing and organizing your ideas”) and the file tree (a Next.js project under src/app, plus Supabase client/server utilities), we can see this is a full-stack, server-rendered React application using Next.js 13’s App Router. It provides user authentication (via Supabase Auth) and storage of “notes” or “jots” in a Supabase (PostgreSQL) backend.

##### File structure
- Top-level:
- next.config.ts, postcss.config.mjs, eslint.config.mjs → build & lint configuration.
- public/ → static assets.
- src/app/ → Next.js App Router pages & layouts, split into (auth) and (main) areas.
- src/context/ → React context for posts.
- src/hooks/ → custom hooks (mobile detection, Tiptap editor).
- src/lib/ → theme provider and generic utilities.
- src/utils/supabase/ → supabase client/server wrappers and middleware.
- Architectural hints:
- Monolithic Next.js app – no microservices.
- App Router organizes routing into “auth” and “main” segments.
- Uses Supabase both client-side and server-side for data and auth.

##### Key points from README
- Confirms minimalist UI, quick capture.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        Browser["Browser Client"]:::frontend
        UI["UI Components"]:::frontend
        Pages["Next.js Pages & Layouts"]:::frontend
    end

    %% Domain Logic
    subgraph "Domain Logic"
        Context["PostContext"]:::frontend
        Hook1["useMobile Hook"]:::frontend
        Hook2["useTiptapEditor Hook"]:::frontend
    end

    %% Application Server
    subgraph "Application Server"
        Server["Next.js Server (SSR & API)"]:::server
        AuthRoutes["Auth Routes"]:::server
        MainRoutes["Main Routes"]:::server
        SharedLayout["Shared Layouts & Globals"]:::server
        Theme["Theme Provider & Utils"]:::server
        Middleware["Auth Middleware"]:::server
        BuildConfig["Build & Lint Configuration"]:::server
        PublicAssets["Public Static Assets"]:::infra
    end

    %% Data & Auth Service
    subgraph "Data & Auth Service"
        SupabaseClient["Supabase Client SDK"]:::server
        SupabaseServer["Supabase Server SDK"]:::server
        SupabaseAuth["Supabase Auth Service"]:::external
        Postgres["PostgreSQL Database"]:::infra
        OAuth["OAuth Providers (Google/GitHub)"]:::external
    end

    %% Relationships
    Browser --> UI
    UI --> Pages
    Pages --> Server
    Context --> Pages
    Hook1 --> Pages
    Hook2 --> Pages

    Pages --> SupabaseClient
    SupabaseClient --> SupabaseAuth
    SupabaseClient --> Postgres
    Server --> SupabaseServer
    SupabaseServer --> Postgres

    Browser -.-> SupabaseAuth
    SupabaseAuth -.-> OAuth
    OAuth -.-> SupabaseAuth
    SupabaseAuth -.-> Server

    Server --> AuthRoutes
    Server --> MainRoutes
    Server --> SharedLayout
    Server --> Theme
    Server --> Middleware
    Server --> BuildConfig
    Server --> PublicAssets

    %% Click Events
    click UI "https://github.com/that-veejay/jotdb/tree/main/src/components/ui/"
    click Context "https://github.com/that-veejay/jotdb/blob/main/src/context/PostContext.tsx"
    click Hook1 "https://github.com/that-veejay/jotdb/blob/main/src/hooks/use-mobile.ts"
    click Hook2 "https://github.com/that-veejay/jotdb/blob/main/src/hooks/useTiptapEditor.ts"
    click SupabaseClient "https://github.com/that-veejay/jotdb/blob/main/src/utils/supabase/client.ts"
    click SupabaseServer "https://github.com/that-veejay/jotdb/blob/main/src/utils/supabase/server.ts"
    click Middleware "https://github.com/that-veejay/jotdb/blob/main/src/utils/supabase/middleware.ts"
    click AuthRoutes "https://github.com/that-veejay/jotdb/blob/main/src/app/(auth)/login/page.tsx"
    click MainRoutes "https://github.com/that-veejay/jotdb/blob/main/src/app/(main)/page.tsx"
    click SharedLayout "https://github.com/that-veejay/jotdb/blob/main/src/app/layout.tsx"
    click Theme "https://github.com/that-veejay/jotdb/blob/main/src/lib/theme-provider.tsx"
    click Theme "https://github.com/that-veejay/jotdb/blob/main/src/lib/utils.ts"
    click BuildConfig "https://github.com/that-veejay/jotdb/blob/main/next.config.ts"
    click PublicAssets "https://github.com/that-veejay/jotdb/tree/main/public/"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#0366d6,stroke-width:1px
    classDef server fill:#d4edda,stroke:#28a745,stroke-width:1px
    classDef external fill:#ffe5b4,stroke:#e69500,stroke-width:1px
    classDef infra fill:#f8d7da,stroke:#dc3545,stroke-width:1px
```
