# limjiajun990701/cheerful-webspace-68 architecture

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

- Interactive diagram: https://gitdiagram.com/limjiajun990701/cheerful-webspace-68
- Repository: https://github.com/limjiajun990701/cheerful-webspace-68

## Overview

##### Project Type and Purpose
- This is a full-stack, single-page portfolio application with an integrated admin dashboard.
- Purpose: Showcase professional content (projects, blog, resume, certifications) and provide an authenticated admin panel to manage that content.

##### Main Components
a. Frontend (Client Application)
- Built with React 18 + TypeScript
- UI layer: Tailwind CSS + shadcn/ui
- Routing: React Router
- Data fetching: Tanstack React Query
- Core code lives under `src/` (pages, components, hooks, utils).
b. Backend as a Service (BaaS)
- Supabase provides:
- Authentication (supabase.auth)
- Postgres database for content tables (blogs, projects, certifications, resume metadata, cheat sheets, etc.)
- Storage buckets for file uploads (resume PDF, images)
- Row-level security policies protect admin data
c. Build & Hosting
- Development: Vite dev server (hot reload)
- Production: Vite build → static assets (`dist/`) → deploy to any static host (Netlify, Vercel, S3)
d. Developer Tools & Config
- `package.json`, `bun.lockb`, `vite.config.ts`, `tailwind.config.ts`, ESLint, TypeScript configs
e. External Dependencies
- NPM packages: React, React Router, React Query, Supabase JS client, shadcn/ui, Tailwind, etc.

##### Relationships & Data Flows
- User (Browser) ↔ React App: UI interactions, page navigations
- React App ↔ Supabase API:
- Authentication requests (login, session)
- CRUD calls for content (via supabase.from(…) queries wrapped in `src/utils` & React Query hooks)
- File uploads/downloads to Supabase Storage
- Deployment pipeline: local machine → Vite build → static host

##### Architectural Patterns & Principles
- SPA with clear separation: Presentation (components/UI) vs. Data Layer (hooks, utils)
- “Feature folder” structure (components grouped by domain: admin, ui, cheatsheets, etc.)
- BaaS microservices model—delegates auth, DB, storage to Supabase
- Secure client-side routing with protected admin routes

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Client
    User["User (Browser)"]:::front
    subgraph "Frontend (React + TypeScript)" 
        direction TB
        Main["src/main.tsx"]:::front
        App["src/App.tsx"]:::front
        subgraph "UI Layer"
            TailwindConfig["tailwind.config.ts"]:::front
            UIComponents["src/components/ui/"]:::front
        end
        subgraph "Routing"
            PagesDir["src/pages/"]:::front
        end
        subgraph "Data Layer"
            Hooks["src/hooks/"]:::front
            Utils["src/utils/"]:::front
        end
        subgraph "Admin Dashboard"
            AdminPage["src/pages/Admin.tsx"]:::front
            AdminComponents["src/components/admin/"]:::front
        end
        subgraph "Content Domains"
            BlogPage["src/pages/Blog.tsx"]:::front
            BlogCard["src/components/BlogCard.tsx"]:::front
            BlogData["src/utils/blogData.ts"]:::front

            ProjectsPage["src/pages/Projects.tsx"]:::front
            ProjectCard["src/components/ProjectCard.tsx"]:::front
            ProjectData["src/utils/projectData.ts"]:::front

            CertPage["src/pages/Certifications.tsx"]:::front
            CertCard["src/components/CertificationCard.tsx"]:::front
            CertData["src/utils/certificationData.ts"]:::front

            CheatSheetsPage["src/pages/CheatSheets.tsx"]:::front
            CheatsheetsComponents["src/components/cheatsheets/"]:::front
            CheatsheetTypes["src/types/cheatsheet.ts"]:::front

            ResumeViewer["src/components/resume/ResumeViewer.tsx"]:::front
            ResumeUploader["src/components/resume/ResumeUploader.tsx"]:::front
            ResumeData["src/utils/resumeData.ts"]:::front
            ResumeTypes["src/types/resume.ts"]:::front
        end
    end

    %% BaaS - Supabase
    subgraph "Supabase Service" 
        direction TB
        Auth["Authentication (supabase.auth)"]:::backend
        DB["Postgres Database"]:::db
        Storage["Storage Buckets"]:::db
    end

    %% Build & Hosting
    subgraph "Build & Deployment" 
        direction TB
        ViteConfig["vite.config.ts"]:::tool
        Package["package.json"]:::tool
        BunLock["bun.lockb"]:::tool
        ViteDev["Vite Dev Server"]:::tool
        StaticHost["Static Hosting (Netlify/Vercel/S3)"]:::tool
    end

    %% Developer Config
    subgraph "Developer Config & Linting"
        direction TB
        ESLint["eslint.config.js"]:::tool
        TsConfig["tsconfig.json"]:::tool
        PostCSS["postcss.config.js"]:::tool
    end

    %% Connections
    User -->|"interacts with"| App
    App -->|"uses UI Layer"| TailwindConfig
    App -->|"renders UI Components"| UIComponents
    App -->|"handles routes"| PagesDir
    App -->|"calls hooks"| Hooks
    App -->|"uses utils"| Utils

    App -->|"protected routes"| AdminPage
    AdminPage --> AdminComponents

    App -->|"GET /blog"| BlogData
    App -->|"renders BlogCard"| BlogCard

    App -->|"GET /projects"| ProjectData
    App -->|"renders ProjectCard"| ProjectCard

    App -->|"GET /certifications"| CertData
    App -->|"renders CertCard"| CertCard

    App -->|"GET /cheatsheets"| CheatsheetTypes
    App -->|"renders Cheatsheets"| CheatsheetsComponents

    App -->|"GET /resume"| ResumeData
    App -->|"renders ResumeViewer"| ResumeViewer
    App -->|"uploads Resume"| ResumeUploader

    App -->|"signIn(), signUp()"| Auth
    App -->|"CRUD queries"| DB
    App -->|"upload/download files"| Storage

    ViteDev -->|"build assets"| StaticHost
    ViteDev -->|"uses configs"| ViteConfig
    ViteDev -->|"reads deps"| Package
    ViteDev -->|"reads lock"| BunLock
    StaticHost -->|"serves App"| User

    %% Environment Variables
    StaticHost -.->|"VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY"| Auth
    StaticHost -.->|"… to DB & Storage"| DB
    StaticHost -.->|"… to Storage"| Storage

    Developer["Developer Local"]:::tool
    Developer --> ViteDev
    Developer --> ESLint
    Developer --> TsConfig
    Developer --> PostCSS

    %% Styling
    classDef front fill:#DCEEFB,stroke:#0366d6,color:#0366d6
    classDef backend fill:#E6FFFA,stroke:#00A67E,color:#006644
    classDef db fill:#FFF5E6,stroke:#E65A00,color:#CC3300,stroke-dasharray: 5 5
    classDef tool fill:#F0F0F0,stroke:#666666,color:#333333

    %% Click Events
    click Main "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/main.tsx"
    click App "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/App.tsx"
    click TailwindConfig "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/tailwind.config.ts"
    click UIComponents "https://github.com/limjiajun990701/cheerful-webspace-68/tree/main/src/components/ui/"
    click PagesDir "https://github.com/limjiajun990701/cheerful-webspace-68/tree/main/src/pages/"
    click Hooks "https://github.com/limjiajun990701/cheerful-webspace-68/tree/main/src/hooks/"
    click Utils "https://github.com/limjiajun990701/cheerful-webspace-68/tree/main/src/utils/"
    click AdminPage "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/pages/Admin.tsx"
    click AdminComponents "https://github.com/limjiajun990701/cheerful-webspace-68/tree/main/src/components/admin/"
    click BlogPage "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/pages/Blog.tsx"
    click BlogCard "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/components/BlogCard.tsx"
    click BlogData "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/utils/blogData.ts"
    click ProjectsPage "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/pages/Projects.tsx"
    click ProjectCard "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/components/ProjectCard.tsx"
    click ProjectData "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/utils/projectData.ts"
    click CertPage "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/pages/Certifications.tsx"
    click CertCard "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/components/CertificationCard.tsx"
    click CertData "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/utils/certificationData.ts"
    click CheatSheetsPage "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/pages/CheatSheets.tsx"
    click CheatsheetsComponents "https://github.com/limjiajun990701/cheerful-webspace-68/tree/main/src/components/cheatsheets/"
    click CheatsheetTypes "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/types/cheatsheet.ts"
    click ResumeViewer "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/components/resume/ResumeViewer.tsx"
    click ResumeUploader "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/components/resume/ResumeUploader.tsx"
    click ResumeData "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/utils/resumeData.ts"
    click ResumeTypes "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/src/types/resume.ts"
    click ViteConfig "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/vite.config.ts"
    click Package "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/package.json"
    click BunLock "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/bun.lockb"
    click ESLint "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/eslint.config.js"
    click TsConfig "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/tsconfig.json"
    click PostCSS "https://github.com/limjiajun990701/cheerful-webspace-68/blob/main/postcss.config.js"
```
