# luuks1609/raveify architecture

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

- Interactive diagram: https://gitdiagram.com/luuks1609/raveify
- Repository: https://github.com/luuks1609/raveify

## Overview

##### Project type and purpose
- This is a Next.js 13 “app router” full-stack web application.
- The README tells us it was bootstrapped with create-next-app, uses next/font, Tailwind CSS, and provides custom API endpoints under app/api.
- Key features:
- Server- and client-side React components (in app/)
- Custom RESTful API routes for “artist” and “events”
- NextAuth authentication under app/api/auth
- Shared UI primitives in components/ui
- Utilities & types in lib
- Middleware for route guards

##### File structure
Top-level:
- app/ – the Next.js “app router” folder with layout, pages, and API routes
– app/api/artist, app/api/events, app/api/auth (each implemented as serverless route handlers)
– app/event/[eventID]/page.tsx – dynamic event pages
– app/login, app/privacy-policy, app/user-agreement – static pages
- components/ – shared React components & design-system UI primitives
- hooks/ – custom React hooks (e.g., use-debounce)
- lib/ – types.ts and utils.ts for shared logic
- middleware.ts – global HTTP middleware (e.g., auth checks, rewrites)
- next.config.mjs, tsconfig.json, Tailwind/postCSS configs – build & deployment configs

##### README for additional insights
- Page rendering (SSR/SSG)
- API routes as serverless functions
- Third-party integrations via NextAuth

a. Main components
- Browser (User’s client)
- Next.js Frontend (Server & Client React components in app/)
- Serverless API layer (app/api/* route handlers)
- Authentication service (NextAuth core + OAuth provider)
- Data layer / external services (e.g., your database or third-party APIs)
- Static asset & CDN layer (public/, Tailwind CSS, Vercel hosting)

b. Relationships & interactions
1. User → Browser requests → Next.js pages (SSR or client-side fetch)
2. Frontend → fetch → /api/events or /api/artist →
→ Serverless route handler → lib/utils.ts → (DB or third-party) → response
3. Auth flows: Browser ↔ /api/auth/[...nextauth] ↔ OAuth provider / session store
4. Middleware.ts intercepts requests for auth checks or redirects

c. Architectural patterns & design principles
- Hybrid SSR/Client components (mix server-components in app/layout.tsx with client-components in components/)
- Serverless micro-endpoints for each API resource
- Centralized design system (components/ui) for consistency
- Separation of concerns: pages vs. API vs. UI vs. utils vs. hooks

d. Key technologies & frameworks
- Next.js 13 (App Router)
- React (server and client components)
- NextAuth (authentication)
- Tailwind CSS (styling)
- TypeScript (static types)
- Vercel (hosting & serverless functions)

##### Essential architectural elements
- Don’t just list files—group them into logical services:
- “UI Layer”
- “API Layer”
- “Auth Layer”
- “Data Layer”
- How data and user sessions flow through the system

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Client
    Browser["User’s Browser"]:::frontend
    Browser -->|"HTTP Request"| NextJSFrontend

    %% Frontend Layer
    subgraph "Frontend Tier"
        direction TB
        NextJSFrontend["Next.js Frontend"]:::frontend

        subgraph "Pages (Server & Client Components)"
            direction TB
            NextLayout["layout.tsx"]:::frontend
            NextHome["page.tsx"]:::frontend
            EventPage["event/[eventID]/page.tsx"]:::frontend
            LoginPage["login/page.tsx"]:::frontend
            PrivacyPage["privacy-policy/page.tsx"]:::frontend
            UserAgreement["user-agreement/page.tsx"]:::frontend
        end

        subgraph "Shared UI Primitives"
            direction TB
            UIBadge["badge.tsx"]:::ui
            UIButton["button.tsx"]:::ui
            UICard["card.tsx"]:::ui
            UICheckbox["checkbox.tsx"]:::ui
            UICommand["command.tsx"]:::ui
            UIDialog["dialog.tsx"]:::ui
            UIDropdown["dropdown-menu.tsx"]:::ui
            UILabel["label.tsx"]:::ui
            UIMultiselect["multiselect.tsx"]:::ui
            UIPopover["popover.tsx"]:::ui
            UIProgress["progress.tsx"]:::ui
            UISkeleton["skeleton.tsx"]:::ui
            UISwitch["switch.tsx"]:::ui
        end

        subgraph "Reusable React Components"
            direction TB
            Navbar["Navbar.tsx"]:::ui
            Searchbar["Searchbar.tsx"]:::ui
            CreatePlaylist["CreatePlaylist.tsx"]:::ui
            MaxWidthWrapper["MaxWidthWrapper.tsx"]:::ui
        end

        subgraph "Utilities & Hooks"
            direction TB
            LibUtils["utils.ts"]:::util
            LibTypes["types.ts"]:::util
            UseDebounce["use-debounce.tsx"]:::util
        end

        subgraph "Global Styles & Config"
            direction TB
            GlobalsCSS["globals.css"]:::config
            TailwindConfig["tailwind.config.ts"]:::config
            PostCSSConfig["postcss.config.mjs"]:::config
            NextConfig["next.config.mjs"]:::config
            TSConfig["tsconfig.json"]:::config
        end
    end

    %% Middleware
    Middleware["middleware.ts"]:::backend
    NextJSFrontend -->|"API Call / Routing"| Middleware
    Middleware -->|"Forward to API"| APILayer

    %% Backend API Layer
    subgraph "API Tier"
        direction TB
        APILayer["Serverless API Layer"]:::backend
        ArtistAPI["artist/[url_extension]/route.ts"]:::backend
        EventsAPI["events/route.ts"]:::backend
        EventDetailAPI["events/[url_extension]/route.ts"]:::backend
        AuthAPI["auth/[...nextauth]/route.ts"]:::auth
    end

    APILayer --> ArtistAPI
    APILayer --> EventsAPI
    APILayer --> EventDetailAPI
    APILayer --> AuthAPI

    %% Authentication Service
    subgraph "Auth Service"
        direction TB
        AuthAPI
        AuthProvider["AuthProvider.tsx"]:::auth
    end
    AuthAPI -->|"NextAuth Flow"| AuthProvider

    %% Data Layer
    subgraph "Data & External Services"
        direction TB
        Database["Database"]:::db
        OAuthProvider["OAuth Provider"]:::db
    end

    ArtistAPI -->|"lib call"| LibUtils
    EventsAPI -->|"lib call"| LibUtils
    EventDetailAPI -->|"lib call"| LibUtils
    AuthAPI -->|"OAuth Redirect"| OAuthProvider
    ArtistAPI --> Database
    EventsAPI --> Database
    EventDetailAPI --> Database

    %% Legend and Styles
    classDef frontend fill:#E3F2FD,stroke:#0288D1,color:#000
    classDef ui fill:#F3E5F5,stroke:#8E24AA,color:#000
    classDef util fill:#ECEFF1,stroke:#546E7A,color:#000
    classDef config fill:#FCE4EC,stroke:#C2185B,color:#000
    classDef backend fill:#E8F5E9,stroke:#43A047,color:#000
    classDef auth fill:#FFF3E0,stroke:#FB8C00,color:#000
    classDef db fill:#FFEBEE,stroke:#E53935,color:#000

    %% Click Events
    click NextLayout "https://github.com/luuks1609/raveify/blob/main/app/layout.tsx"
    click NextHome "https://github.com/luuks1609/raveify/blob/main/app/page.tsx"
    click EventPage "https://github.com/luuks1609/raveify/blob/main/app/event/[eventID]/page.tsx"
    click LoginPage "https://github.com/luuks1609/raveify/blob/main/app/login/page.tsx"
    click PrivacyPage "https://github.com/luuks1609/raveify/blob/main/app/privacy-policy/page.tsx"
    click UserAgreement "https://github.com/luuks1609/raveify/blob/main/app/user-agreement/page.tsx"
    click ArtistAPI "https://github.com/luuks1609/raveify/blob/main/app/api/artist/[url_extension]/route.ts"
    click EventsAPI "https://github.com/luuks1609/raveify/blob/main/app/api/events/route.ts"
    click EventDetailAPI "https://github.com/luuks1609/raveify/blob/main/app/api/events/[url_extension]/route.ts"
    click AuthAPI "https://github.com/luuks1609/raveify/blob/main/app/api/auth/[...nextauth]/route.ts"
    click AuthProvider "https://github.com/luuks1609/raveify/blob/main/components/AuthProvider.tsx"
    click UIBadge "https://github.com/luuks1609/raveify/blob/main/components/ui/badge.tsx"
    click UIButton "https://github.com/luuks1609/raveify/blob/main/components/ui/button.tsx"
    click UICard "https://github.com/luuks1609/raveify/blob/main/components/ui/card.tsx"
    click UICheckbox "https://github.com/luuks1609/raveify/blob/main/components/ui/checkbox.tsx"
    click UICommand "https://github.com/luuks1609/raveify/blob/main/components/ui/command.tsx"
    click UIDialog "https://github.com/luuks1609/raveify/blob/main/components/ui/dialog.tsx"
    click UIDropdown "https://github.com/luuks1609/raveify/blob/main/components/ui/dropdown-menu.tsx"
    click UILabel "https://github.com/luuks1609/raveify/blob/main/components/ui/label.tsx"
    click UIMultiselect "https://github.com/luuks1609/raveify/blob/main/components/ui/multiselect.tsx"
    click UIPopover "https://github.com/luuks1609/raveify/blob/main/components/ui/popover.tsx"
    click UIProgress "https://github.com/luuks1609/raveify/blob/main/components/ui/progress.tsx"
    click UISkeleton "https://github.com/luuks1609/raveify/blob/main/components/ui/skeleton.tsx"
    click UISwitch "https://github.com/luuks1609/raveify/blob/main/components/ui/switch.tsx"
    click Navbar "https://github.com/luuks1609/raveify/blob/main/components/Navbar.tsx"
    click Searchbar "https://github.com/luuks1609/raveify/blob/main/components/Searchbar.tsx"
    click CreatePlaylist "https://github.com/luuks1609/raveify/blob/main/components/CreatePlaylist.tsx"
    click MaxWidthWrapper "https://github.com/luuks1609/raveify/blob/main/components/MaxWidthWrapper.tsx"
    click LibUtils "https://github.com/luuks1609/raveify/blob/main/lib/utils.ts"
    click LibTypes "https://github.com/luuks1609/raveify/blob/main/lib/types.ts"
    click UseDebounce "https://github.com/luuks1609/raveify/blob/main/hooks/use-debounce.tsx"
    click Middleware "https://github.com/luuks1609/raveify/blob/main/middleware.ts"
    click GlobalsCSS "https://github.com/luuks1609/raveify/blob/main/app/globals.css"
    click TailwindConfig "https://github.com/luuks1609/raveify/blob/main/tailwind.config.ts"
    click PostCSSConfig "https://github.com/luuks1609/raveify/blob/main/postcss.config.mjs"
    click NextConfig "https://github.com/luuks1609/raveify/blob/main/next.config.mjs"
    click TSConfig "https://github.com/luuks1609/raveify/blob/main/tsconfig.json"
```
