# faizm10/dressforsuccess architecture

> Architecture diagram of the GitHub repository faizm10/dressforsuccess, 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/faizm10/dressforsuccess
- Repository: https://github.com/faizm10/dressforsuccess

## Overview

##### Project type and purpose
- DressForSuccess is a full-stack web platform (Next.js 13 App Router) for managing and renting professional attire.
- It uses Next.js for the UI + serverless API routes, Supabase for database, auth, and storage, and Apollo/GraphQL for data fetching.

##### File structure
- Top-level “frontend” directory contains an App Router (`app/`), API routes (`app/api/…`), global layout, middleware, and static/public assets.
- `components/` holds all React UI pieces (forms, tables, modals, theme providers, RadixUI wrappers).
- `hooks/` contains custom React hooks for attires, mobile layouts, and Supabase uploads.
- `lib/` provides providers and clients:
- `apollo-provider.tsx` sets up the GraphQL client
- `graphql/schema.ts` defines your GraphQL schema
- `supabase/client.ts`, `supabase/server.ts`, and `supabase/middleware.ts` glue Next.js to Supabase
- Configuration and build files: `next.config.ts`, `tsconfig.json`, `package.json`, PostCSS, ESLint, Tailwind.

##### README
- Confirms tech stack: Next.js, TypeScript, Tailwind CSS, GraphQL, Supabase, RadixUI.
- Summarizes feature set: user authentication flows, calendar, dashboards, emails, student/attire management.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend" 
        direction TB
        Browser["Browser"]:::frontend
        UI_Server["Next.js UI Server (App Router)"]:::frontend
        ClientComp["Client Components"]:::frontend
        Hooks["Custom React Hooks"]:::frontend
        Layout["Global Layout & Middleware"]:::frontend
        ApolloProvider["Apollo GraphQL Client Provider"]:::frontend
    end

    %% API & GraphQL Layer
    subgraph "API & GraphQL" 
        direction TB
        API_Routes["Next.js API Routes"]:::api
        GraphQLServer["Apollo GraphQL Layer"]:::api
        EmailRoute["Email Service API Route"]:::api
    end

    %% Supabase Utilities
    subgraph "Supabase Utilities"
        direction TB
        ClientSDK["Supabase Client SDK"]:::data
        ServerSDK["Supabase Server Utilities"]:::data
        MiddlewareNode["Supabase Middleware"]:::data
    end

    %% Data Services
    subgraph "Supabase Services"
        direction TB
        SupabaseAuth["Supabase Auth"]:::data
        SupabaseDB["Supabase Database"]:::data
        SupabaseStorage["Supabase Storage"]:::data
    end

    %% External Services
    subgraph "External Services"
        direction TB
        CDN["CDN / Public Assets"]:::external
        EmailProvider["External Email Service"]:::external
    end

    %% Connections
    Browser -->|"SSR/CSR Requests"| UI_Server
    UI_Server -->|"renders pages"| Browser
    Browser -->|"@apollo/client → GraphQL"| GraphQLServer
    UI_Server -->|"@apollo/client → GraphQL"| GraphQLServer
    ClientComp --> UI_Server
    Hooks --> ClientComp
    Layout --> UI_Server
    ApolloProvider --> ClientComp

    GraphQLServer -->|"supabase-js SDK"| ClientSDK
    API_Routes -->|"supabase-js SDK"| ClientSDK
    ClientSDK --> SupabaseAuth
    ClientSDK --> SupabaseDB
    ClientSDK --> SupabaseStorage
    ServerSDK --> SupabaseAuth
    ServerSDK --> SupabaseDB
    ServerSDK --> SupabaseStorage
    MiddlewareNode -->|"Auth Guard"| ServerSDK

    API_Routes -->|"fetch('/api/send')"| EmailRoute
    EmailRoute -->|"SMTP API"| EmailProvider

    UI_Server -->|"serve static"| CDN
    Browser -->|"fetch static assets"| CDN

    %% Click Events
    click ClientComp "https://github.com/faizm10/dressforsuccess/tree/main/frontend/components"
    click Hooks "https://github.com/faizm10/dressforsuccess/tree/main/frontend/hooks"
    click Layout "https://github.com/faizm10/dressforsuccess/blob/main/frontend/app/layout.tsx"
    click Layout "https://github.com/faizm10/dressforsuccess/blob/main/frontend/app/middleware.ts"
    click ApolloProvider "https://github.com/faizm10/dressforsuccess/blob/main/frontend/lib/apollo-provider.tsx"
    click GraphQLServer "https://github.com/faizm10/dressforsuccess/blob/main/frontend/lib/graphql/schema.ts"
    click ClientSDK "https://github.com/faizm10/dressforsuccess/blob/main/frontend/lib/supabase/client.ts"
    click ServerSDK "https://github.com/faizm10/dressforsuccess/blob/main/frontend/lib/supabase/server.ts"
    click MiddlewareNode "https://github.com/faizm10/dressforsuccess/blob/main/frontend/lib/supabase/middleware.ts"
    click API_Routes "https://github.com/faizm10/dressforsuccess/tree/main/frontend/app/api"
    click EmailRoute "https://github.com/faizm10/dressforsuccess/blob/main/frontend/app/api/send/route.tsx"
    click CDN "https://github.com/faizm10/dressforsuccess/tree/main/frontend/public"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef api fill:#FFD580,stroke:#000,stroke-width:1px
    classDef data fill:#90EE90,stroke:#000,stroke-width:1px
    classDef external fill:#FFA500,stroke:#000,stroke-width:1px
```
