# olbboy/dx-rodmap architecture

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

- Interactive diagram: https://gitdiagram.com/olbboy/dx-rodmap
- Repository: https://github.com/olbboy/dx-rodmap

## Overview

##### Main Components
- Frontend Client – Built on Next.js and React:
- Pages & Routing: The app directory contains Next.js pages and routes for authentication, dashboards, and detailed roadmap functionalities (e.g., roadmaps, posts, kanban, timeline).
- UI Components: The components directory is extensive. It includes layout primitives (e.g., app-sidebar, header, sidebar), feature-specific components (e.g., comment forms, feature lists, timelines), and shared UI components (e.g., those under components/ui).
- Hooks & Libraries: The hooks and lib directories contain custom hooks (e.g., media detection, timeline viewport) and integration functions (e.g., Supabase client functions, action handlers such as in lib/actions) that facilitate communication with backend services.

- Backend Services – Powered by Supabase:
- Authentication: Managed via Supabase Auth (as described in the README and integrated via lib/supabase/auth.ts).
- Database and Data Layer: The SQL scripts in the scripts directory (e.g., db-schema.sql) set up tables for users, roadmaps, posts, statuses, and comments. The lib/supabase directory contains helper modules for server- and client-side communication.
- API/Middleware: Files such as middleware.ts and server components in the lib/supabase directory indicate server-side logic for data handling.

- Supporting Components:
- Configuration & Build Tools: Config files (next.config.ts, tailwind.config.ts, postcss.config.mjs, tsconfig.json) indicate how the frontend is compiled and styled.
- Documentation & Design: The docs folder with design system documents and solution design files, as well as the README, inform the intended architecture and help clarify integration points.

##### Relationships and Interactions
- The Auth system integration flows from the Supabase backend to the Next.js authentication pages under app/auth and supporting UI components in components/auth.
- Dynamic routing is used in the application (e.g., the roadmaps/[id] paths) which interact with components for editing, features, kanban, posts, and timeline – indicate how these components interrelate.
- Shared state and styling are handled by libraries/hook functions and theme providers (components/theme-provider.tsx), which propagate UI state.
- The comments system and dependency management are implemented through separate components and actions in lib/actions; illustrate how these interact with posts and roadmaps.

##### Architectural Patterns & Design Principles
- Separation of Concerns: The project follows a modular design by clearly separating the UI (components, pages), data access (lib/supabase, lib/actions), and configuration.
- Next.js App Directory & Routing: Dynamic folders (like roadmaps/[id]) for page routing; use of layout.tsx for consistent view structure.
- Extensibility and Responsiveness: Numerous components and hooks suggest an emphasis on reusability (e.g., timeline, kanban board components) and responsiveness (e.g., use-mobile hook).

##### Incorporate Relevant Technologies & Frameworks
- Next.js & React: Mark the Next.js Folder structure (app, pages) as the primary presentation layer.
- Tailwind CSS & Shadcn UI: Indicate that UI components are styled using these technologies.
- Supabase: Clearly denote how authentication, database, and storage are integrated via lib/supabase modules and the SQL scripts in the scripts folder.
- TypeScript: Emphasize use of strong typing in the project and interaction between components and backend actions.

- Clear Labels: Each main component or module should be clearly labeled (e.g., Frontend (Next.js), UI Component Library, Supabase Auth, Database, Middleware, etc.).
- UI Components → lib/actions (for events, CRUD operations)
- lib/supabase (client and server modules) → Supabase (backend services)
- Pages → Dynamic Routes → Layout Components
- Another for backend services (Supabase Auth, Database, Storage)
- Integration Points: Clearly mark areas where the application integrates with external systems (Supabase, Vercel for deployment).

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Frontend Layer
    subgraph "Frontend (Next.js)"
        %% Pages & Routing
        subgraph "Pages & Routing"
            AuthPages["Auth Pages"] 
            DashboardPages["Dashboard Pages"]
            RoadmapPages["Roadmap Pages"]
            DynamicRoadmap["Dynamic Roadmap Route"]
        end

        %% UI Components
        subgraph "UI Components"
            UI_Base["Base UI (components/ui)"]
            UI_Auth["Auth UI (components/auth)"]
            UI_Roadmap["Roadmap UI (components/roadmap)"]
            UI_Kanban["Kanban UI (components/kanban)"]
        end

        %% Hooks & Libraries
        subgraph "Hooks & Libraries"
            MobileHook["Mobile Hook (hooks/use-mobile.ts)"]
            TimelineHook["Timeline Hook (lib/hooks/use-timeline-viewport.ts)"]
        end
    end

    %% Backend Layer
    subgraph "Backend (Supabase)"
        %% Authentication
        subgraph "Authentication"
            SupabaseAuthAPI["Supabase Auth API (lib/supabase/auth.ts)"]
            AuthHelper["Supabase Auth Helper (lib/auth.ts)"]
        end

        %% Supabase Client & Middleware
        subgraph "Supabase Client/Middleware"
            SupabaseClient["Supabase Client (lib/supabase/client.ts)"]
            SupabaseMiddleware["Supabase Middleware (lib/supabase/middleware.ts)"]
            SupabaseServer["Supabase Server (lib/supabase/server.ts)"]
        end

        %% API / Actions
        subgraph "API Actions"
            CommentActions["Comment Actions (lib/actions/comment.ts)"]
            FeatureActions["Feature Actions (lib/actions/feature.ts)"]
        end

        %% Database & Data Layer
        subgraph "Database"
            DBSchema["DB Schema (scripts/db-schema.sql)"]
            FeatureToPost["Feature-to-Post (scripts/feature-to-post-migration.sql)"]
            MigratePosts["Migrate Posts (scripts/migrate-to-posts.sql)"]
        end
    end

    %% Support Layer
    subgraph "Support"
        %% Configuration & Build Tools
        subgraph "Configuration & Build Tools"
            NextConfig["next.config.ts"]
            TailwindConfig["tailwind.config.ts"]
            PostcssConfig["postcss.config.mjs"]
            TSConfig["tsconfig.json"]
        end

        %% Documentation & Design
        subgraph "Documentation & Design"
            Docs["Docs (docs)"]
            Readme["README (README.md)"]
        end
    end

    %% Connections between Frontend components
    AuthPages -->|"triggers auth"| SupabaseAuthAPI
    AuthPages -->|"triggers auth"| AuthHelper

    DashboardPages -->|"renders view"| UI_Base
    RoadmapPages -->|"renders view"| UI_Roadmap
    DynamicRoadmap -->|"renders dynamic view"| UI_Roadmap

    MobileHook -->|"enhances UI"| UI_Base
    TimelineHook -->|"enhances UI"| UI_Roadmap

    UI_Auth -->|"interacts with"| SupabaseAuthAPI
    UI_Auth -->|"interacts with"| AuthHelper

    %% UI Components communicating with API Actions
    UI_Base ---|"user actions"| CommentActions
    UI_Base ---|"user actions"| FeatureActions
    UI_Roadmap ---|"user actions"| CommentActions
    UI_Roadmap ---|"user actions"| FeatureActions
    UI_Kanban ---|"user actions"| FeatureActions

    %% UI Components calling Supabase client
    UI_Base -->|"fetches data"| SupabaseClient
    UI_Roadmap -->|"fetches data"| SupabaseClient

    %% API Actions and Supabase Client interacting with Database
    CommentActions -->|"updates"| DBSchema
    FeatureActions -->|"updates"| FeatureToPost
    SupabaseClient -->|"queries"| DBSchema
    SupabaseMiddleware -->|"queries"| MigratePosts
    SupabaseServer -->|"queries"| DBSchema

    %% Pages & Hooks interaction
    DashboardPages -->|"uses"| MobileHook
    RoadmapPages -->|"uses"| TimelineHook

    %% Click Events for Frontend Pages & Routing
    click AuthPages "https://github.com/olbboy/dx-rodmap/tree/main/app/auth"
    click DashboardPages "https://github.com/olbboy/dx-rodmap/tree/main/app/dashboard"
    click RoadmapPages "https://github.com/olbboy/dx-rodmap/tree/main/app/roadmaps"
    click DynamicRoadmap "https://github.com/olbboy/dx-rodmap/tree/main/app/roadmaps/[id]"

    %% Click Events for UI Components
    click UI_Base "https://github.com/olbboy/dx-rodmap/tree/main/components/ui"
    click UI_Auth "https://github.com/olbboy/dx-rodmap/tree/main/components/auth"
    click UI_Roadmap "https://github.com/olbboy/dx-rodmap/tree/main/components/roadmap"
    click UI_Kanban "https://github.com/olbboy/dx-rodmap/tree/main/components/kanban"

    %% Click Events for Hooks & Libraries
    click MobileHook "https://github.com/olbboy/dx-rodmap/blob/main/hooks/use-mobile.ts"
    click TimelineHook "https://github.com/olbboy/dx-rodmap/blob/main/lib/hooks/use-timeline-viewport.ts"

    %% Click Events for Backend Authentication
    click SupabaseAuthAPI "https://github.com/olbboy/dx-rodmap/blob/main/lib/supabase/auth.ts"
    click AuthHelper "https://github.com/olbboy/dx-rodmap/blob/main/lib/auth.ts"

    %% Click Events for Supabase Client & Middleware
    click SupabaseClient "https://github.com/olbboy/dx-rodmap/blob/main/lib/supabase/client.ts"
    click SupabaseMiddleware "https://github.com/olbboy/dx-rodmap/blob/main/lib/supabase/middleware.ts"
    click SupabaseServer "https://github.com/olbboy/dx-rodmap/blob/main/lib/supabase/server.ts"

    %% Click Events for API Actions
    click CommentActions "https://github.com/olbboy/dx-rodmap/blob/main/lib/actions/comment.ts"
    click FeatureActions "https://github.com/olbboy/dx-rodmap/blob/main/lib/actions/feature.ts"

    %% Click Events for Database & Data Layer
    click DBSchema "https://github.com/olbboy/dx-rodmap/blob/main/scripts/db-schema.sql"
    click FeatureToPost "https://github.com/olbboy/dx-rodmap/blob/main/scripts/feature-to-post-migration.sql"
    click MigratePosts "https://github.com/olbboy/dx-rodmap/blob/main/scripts/migrate-to-posts.sql"

    %% Click Events for Configuration & Build Tools
    click NextConfig "https://github.com/olbboy/dx-rodmap/blob/main/next.config.ts"
    click TailwindConfig "https://github.com/olbboy/dx-rodmap/blob/main/tailwind.config.ts"
    click PostcssConfig "https://github.com/olbboy/dx-rodmap/blob/main/postcss.config.mjs"
    click TSConfig "https://github.com/olbboy/dx-rodmap/blob/main/tsconfig.json"

    %% Click Events for Documentation & Design
    click Docs "https://github.com/olbboy/dx-rodmap/tree/main/docs"
    click Readme "https://github.com/olbboy/dx-rodmap/blob/main/README.md"

    %% Styles
    classDef frontend fill:#bbf,stroke:#000,stroke-width:2px;
    classDef backend fill:#f88,stroke:#000,stroke-width:2px;
    classDef support fill:#afa,stroke:#000,stroke-width:2px;
    classDef database fill:#fcc,stroke:#f00,stroke-dasharray: 5 5,stroke-width:2px;

    class AuthPages,DashboardPages,RoadmapPages,DynamicRoadmap,UI_Base,UI_Auth,UI_Roadmap,UI_Kanban,MobileHook,TimelineHook frontend;
    class SupabaseAuthAPI,AuthHelper,SupabaseClient,SupabaseMiddleware,SupabaseServer,CommentActions,FeatureActions backend;
    class DBSchema,FeatureToPost,MigratePosts database;
    class NextConfig,TailwindConfig,PostcssConfig,TSConfig,Docs,Readme support
```
