# rajswarnim2107/rajswarnim-portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/rajswarnim2107/rajswarnim-portfolio
- Repository: https://github.com/rajswarnim2107/rajswarnim-portfolio

## Overview

##### Project type and purpose
- This is a full-stack personal portfolio website built with a React/TypeScript frontend (Vite + Tailwind CSS) and a small Node/TypeScript backend API. Its primary purpose is to showcase AI/ML expertise, projects, and professional information, and to handle any dynamic features such as a contact form or analytics.

##### File structure
- Top-level directories:
- client/ – the React front end
- server/ – the Node/TypeScript back end (API routes, storage)
- shared/ – shared data models/schema (used by both client & server)
- Config files:
- vite.config.ts & vite.config.github.ts – build/dev and GitHub Pages deploy settings
- drizzle.config.ts – database ORM configuration
- tailwind.config.ts, postcss.config.js – styling pipeline
- .github/workflows/deploy.yml – CI/CD workflow to build & deploy to GitHub Pages
- Package manifests (package.json/lock) and TS configs (tsconfig.json) live at the root, confirming a monorepo setup.

##### README insights
- The README confirms automatic GitHub Pages deployment via a GitHub Actions workflow.
- Local development uses `npm run dev` to spin up Vite’s dev server.
- Data (resume, projects, contact info) is driven by `client/src/data/resume-data.ts`.
- The project uses Drizzle ORM for database interactions (implied by drizzle.config.ts & shared/schema.ts).

a. Main components
- Browser (User)
- Frontend (client/ – React + Vite + Tailwind)
- Backend API (server/ – Node + TypeScript)
- Database (via Drizzle ORM, could be SQLite/Postgres)
- Shared Schema Layer (shared/schema.ts)
- CI/CD Pipeline (GitHub Actions)
- Hosting (GitHub Pages for frontend; optionally a server host or serverless for API)
b. Relationships & interactions
1. User ↔️ Browser ↔️ Frontend
– Static assets and SPA served by GitHub Pages (or Vite dev server locally)
2. Frontend ↔️ Backend API
– HTTP(S) calls (e.g., submit contact form, fetch analytics)
3. Backend API ↔️ Database
– Drizzle ORM uses shared/schema.ts for type-safe queries
4. CI/CD Pipeline ↔️ GitHub Pages
– On push to main → GitHub Actions builds client, then deploys to Pages
c. Architectural patterns & principles
- Monorepo with clear separation: client, server, shared code
- Type-safe shared schema ensures consistency between API and UI
- API layer abstracts data storage (single source of truth)
- Component-based UI in React with a theme‐provider, hooks, and reusable UI primitives
- CI/CD as code (deploy.yml), enabling automated, reproducible deployments
d. Key technologies/frameworks
- Frontend: React, TypeScript, Vite, Tailwind CSS, React Query (queryClient.ts)
- Backend: Node.js, TypeScript, Drizzle ORM
- Shared: shared/schema.ts for database models & types
- DevOps: GitHub Actions, GitHub Pages

##### Detail
- External services (e.g., GitHub Pages)
- Build tools (Vite) and dev tools (TypeScript compiler)
- Shared schema file connecting to both the API and the client types to stress consistency

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Monorepo"
    subgraph "Client (Frontend)"
      ReactSPA["React SPA\n(Vite + React + Tailwind)"]:::frontend
      EntryMain["main.tsx"]:::frontend
      AppComp["App.tsx"]:::frontend
      Pages["Pages\n(home.tsx, not-found.tsx)"]:::frontend
      UIComp["UI Components\n(client/src/components/ui/)"]:::frontend
      FeatureComp["Feature Components\n(hero.tsx,\nprojects.tsx,contact.tsx)"]:::frontend
      Theme["Theme Provider & Toggle\n(theme-provider.tsx,\ntheme-toggle.tsx)"]:::frontend
      DataLayer["Data Layer\n(resume-data.ts)"]:::frontend
      QueryClient["React Query Client\n(queryClient.ts)"]:::frontend
      Util["Utils\n(utils.ts)"]:::frontend
      HTML["index.html"]:::frontend
      Static404["404.html"]:::frontend

      ReactSPA --> EntryMain
      EntryMain --> AppComp
      AppComp --> Pages
      AppComp --> UIComp
      AppComp --> FeatureComp
      AppComp --> Theme
      AppComp --> DataLayer
      AppComp --> QueryClient
      AppComp --> Util
      ReactSPA -.-> HTML
      ReactSPA -.-> Static404
    end

    subgraph "Server (Backend)"
      APIServer["API Server\n(Node + TypeScript)"]:::backend
      ServerEntry["index.ts"]:::backend
      Routes["routes.ts"]:::backend
      Storage["storage.ts"]:::backend

      APIServer --> ServerEntry
      APIServer --> Routes
      APIServer --> Storage
    end

    subgraph "Shared"
      Schema["Shared Schema\n(schema.ts)"]:::shared
    end
  end

  Browser["Browser\n(User)"]:::user
  CI["CI/CD Pipeline\n(GitHub Actions)"]:::ci
  GitHubPages["GitHub Pages\n(Hosting SPA)"]:::cloud
  Database["Database\n(SQL via Drizzle)"]:::db
  Drizzle["Drizzle Config\n(drizzle.config.ts)"]:::db

  Browser -->|"loads SPA"| ReactSPA
  ReactSPA -->|"HTTP calls"| APIServer
  APIServer -->|"ORM queries"| Database
  APIServer -->|"uses schema"| Schema
  ReactSPA -->|"uses schema types"| Schema
  CI -->|"on push to main"| ReactSPA
  CI -->|"deploy client"| GitHubPages

  classDef frontend fill:#e0f7fa,stroke:#006064,color:#004d40
  classDef backend fill:#e8f5e9,stroke:#1b5e20,color:#2e7d32
  classDef shared fill:#fff3e0,stroke:#e65100,color:#bf360c
  classDef ci fill:#fffde7,stroke:#f57f17,color:#ef6c00
  classDef db fill:#f3e5f5,stroke:#6a1b9a,color:#4a148c
  classDef cloud fill:#e1f5fe,stroke:#0277bd,color:#01579b
  classDef user fill:#ffebee,stroke:#b71c1c,color:#b71c1c

  click ReactSPA "https://github.com/rajswarnim2107/rajswarnim-portfolio/tree/main/client/"
  click EntryMain "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/src/main.tsx"
  click AppComp "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/src/App.tsx"
  click Pages "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/src/pages/home.tsx"
  click Pages "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/src/pages/not-found.tsx"
  click UIComp "https://github.com/rajswarnim2107/rajswarnim-portfolio/tree/main/client/src/components/ui/"
  click FeatureComp "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/src/components/hero.tsx"
  click FeatureComp "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/src/components/projects.tsx"
  click FeatureComp "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/src/components/contact.tsx"
  click Theme "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/src/components/theme-provider.tsx"
  click Theme "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/src/components/theme-toggle.tsx"
  click DataLayer "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/src/data/resume-data.ts"
  click QueryClient "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/src/lib/queryClient.ts"
  click Util "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/src/lib/utils.ts"
  click HTML "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/index.html"
  click Static404 "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/client/public/404.html"

  click APIServer "https://github.com/rajswarnim2107/rajswarnim-portfolio/tree/main/server/"
  click ServerEntry "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/server/index.ts"
  click Routes "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/server/routes.ts"
  click Storage "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/server/storage.ts"

  click Schema "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/shared/schema.ts"
  click Drizzle "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/drizzle.config.ts"
  click CI "https://github.com/rajswarnim2107/rajswarnim-portfolio/blob/main/.github/workflows/deploy.yml"
```
