# devp19/resdex architecture

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

- Interactive diagram: https://gitdiagram.com/devp19/resdex
- Repository: https://github.com/devp19/resdex

## Overview

##### Project Type & Purpose
- ResDex is a full-stack, student-focused research-sharing platform.
- “resdex”     – a React CRA front end + Express/Node back end (legacy)
- “resdex-v2” – a modern Next.js 13 (App Router, TypeScript) full-stack app

##### File Structure
A. Top-level monorepo
- root/.gitignore, package.json – orchestrates dependencies
- two sibling subfolders: resdex (v1) and resdex-v2 (v2)
B. resdex (v1)
- server/ — Express server (server.js) exposing REST endpoints, hosting static CRA build
- src/ — React app (CRA), pages under src/pages, common UI components, Firebase config, Google Docs service
C. resdex-v2 (v2)
- src/app/ — Next.js 13 App Router (page.tsx under folders for home, auth, profile, etc.)
- src/components/ — UI library (customized cards, magicui animations, base UI primitives)
- src/lib/ — supabaseClient.ts (database), firebaseConfig.ts (auth), utils
- next.config.ts, postcss.config.mjs, tsconfig.json

##### README for Insights
- A student-centric “publishing” platform
- Core features: authentication, paper uploads, peer/expert reviews, user portfolios
- Integrations: Firebase Auth, Supabase database, Google Docs embedding/service

##### Main Components
1. Client (User Browser / Mobile)
2. Front-End Application
- Legacy v1: CRA bundle served by Express
- v2: Next.js server (SSR/SSG) + React components
3. Back-End / API Layer
- v1 Express server endpoints
- v2 Next.js serverless route handlers or API endpoints (if any)
4. Authentication Service
- Firebase Auth (signup/login, password reset)
5. Database Service
- Supabase (PostgreSQL) – user profiles, papers, reviews, metadata
6. Storage / File Service
- Supabase Storage or Firebase Storage (for PDFs, images)
7. Third-Party Integrations
- Google Docs API / service for embedding and publishing docs
- Cloudflare (DNS, CDN) or AWS (if used in legacy config)

##### Inter-Component Relationships & Data Flows
- Browser ←→ Front-End (React or Next.js)
- Front-End ←→ Auth (Firebase Auth SDK)
- Front-End / Server ←→ Database (Supabase client library)
- Server (Express or Next.js) ←→ Google Docs Service (REST calls)
- Static assets (fonts, CSS, JS) served via CDN (Vercel/Cloudflare)

##### Architectural Patterns & Design Principles
- MVC-ish separation in v1: React views, Express controllers, service layer in src/services
- In v2: Container-component separation via Next.js App Router’s Server vs. Client components
- Reusable UI library: “src/components/ui” and “src/components/magicui”
- Hooks abstraction for cross-cutting concerns (use-mobile, use-outside-click, use3dTilt)
- Modular Monorepo: two versions side by side for migration

##### Details to Capture
- Both legacy and v2 to illustrate evolution if this matters for roadmap discussions
- Reusable UI component libraries and hooks as “internal modules”
- Where environment/config files sit (next.config.ts, postcss.config.mjs, awsConfig.js)

## Diagram (Mermaid)

```mermaid
graph TB
  Browser["Browser / Mobile"]:::external

  subgraph "Legacy (resdex v1)"
    direction TB
    LegacyFE["CRA Front-End"]:::frontend
    LegacyFE_src["resdex/src"]:::frontend
    LegacyFE_public["resdex/public"]:::storage
    LegacyAPI["Express Server (REST API + static hosting)"]:::backend
  end

  subgraph "Modern (resdex-v2)"
    direction TB
    V2FE["Next.js 13 Front-End & Server"]:::frontend
    V2App["resdex-v2/src/app"]:::frontend
    V2Layout["layout.tsx"]:::frontend
    V2Page["page.tsx"]:::frontend
    V2API["Serverless Route Handlers"]:::backend
    V2NextConfig["next.config.ts"]:::backend
    PostCSS["postcss.config.mjs"]:::backend
    TSConfig["tsconfig.json"]:::backend
    PkgV2["package.json"]:::backend
    V2Public["resdex-v2/public"]:::storage
    UIBase["src/components/ui"]:::frontend
    MagicUI["src/components/magicui"]:::frontend
    CustomizedUI["src/components/customized"]:::frontend
    HooksV2["resdex-v2/src/hooks"]:::frontend
    FireInitV2["resdex-v2/src/app/firebaseConfig.ts"]:::external
    Supabase["resdex-v2/src/lib/supabaseClient.ts"]:::database
    UtilsV2["resdex-v2/src/lib/utils.ts"]:::backend
  end

  subgraph Services
    direction TB
    Auth["Firebase Auth"]:::external
    DB["Supabase (PostgreSQL + Storage)"]:::database
    GoogleDocs["Google Docs API / Service"]:::external
    CDN["CDN / Vercel / Cloudflare"]:::storage
  end

  Browser -->|uses| LegacyFE
  Browser -->|uses| V2FE
  LegacyFE -->|API calls| LegacyAPI
  V2FE -->|routes| V2API
  LegacyFE -->|auth| Auth
  V2FE -->|auth| Auth
  LegacyAPI -->|embed/docs| GoogleDocs
  V2API -->|CRUD| DB
  V2FE -->|direct client| DB
  CDN -->|serves assets| Browser

  click LegacyFE_src "https://github.com/devp19/resdex/tree/main/resdex/src/"
  click LegacyFE_public "https://github.com/devp19/resdex/tree/main/resdex/public/"
  click LegacyAPI "https://github.com/devp19/resdex/blob/main/resdex/server/server.js"
  click V2App "https://github.com/devp19/resdex/tree/main/resdex-v2/src/app/"
  click V2Layout "https://github.com/devp19/resdex/blob/main/resdex-v2/src/app/layout.tsx"
  click V2Page "https://github.com/devp19/resdex/blob/main/resdex-v2/src/app/page.tsx"
  click V2NextConfig "https://github.com/devp19/resdex/blob/main/resdex-v2/next.config.ts"
  click UIBase "https://github.com/devp19/resdex/tree/main/resdex-v2/src/components/ui/"
  click MagicUI "https://github.com/devp19/resdex/tree/main/resdex-v2/src/components/magicui/"
  click CustomizedUI "https://github.com/devp19/resdex/tree/main/resdex-v2/src/components/customized/"
  click HooksV2 "https://github.com/devp19/resdex/tree/main/resdex-v2/src/hooks/"
  click FireInitV2 "https://github.com/devp19/resdex/blob/main/resdex-v2/src/app/firebaseConfig.ts"
  click Supabase "https://github.com/devp19/resdex/blob/main/resdex-v2/src/lib/supabaseClient.ts"
  click UtilsV2 "https://github.com/devp19/resdex/blob/main/resdex-v2/src/lib/utils.ts"
  click GDoc "https://github.com/devp19/resdex/blob/main/resdex/src/services/googleDocsService.js"
  click CF "https://github.com/devp19/resdex/blob/main/resdex/src/cloudflareConfig.js"
  click AWS "https://github.com/devp19/resdex/blob/main/resdex/src/awsConfig.js"
  click PostCSS "https://github.com/devp19/resdex/blob/main/resdex-v2/postcss.config.mjs"
  click TSConfig "https://github.com/devp19/resdex/blob/main/resdex-v2/tsconfig.json"
  click PkgV2 "https://github.com/devp19/resdex/blob/main/resdex-v2/package.json"
  click PkgV1 "https://github.com/devp19/resdex/blob/main/resdex/package.json"
  click RootPkg "https://github.com/devp19/resdex/blob/main/root/package.json"
  click V2Public "https://github.com/devp19/resdex/tree/main/resdex-v2/public/"

  classDef frontend fill:#add8e6,stroke:#000,stroke-width:1px
  classDef backend fill:#90ee90,stroke:#000,stroke-width:1px
  classDef database fill:#32CD32,stroke:#000,stroke-width:1px
  classDef external fill:#dda0dd,stroke:#000,stroke-width:1px
  classDef storage fill:#ffa500,stroke:#000,stroke-width:1px
```
