# pranshuaryal/git-gud architecture

> Architecture diagram of the GitHub repository pranshuaryal/git-gud, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pranshuaryal/git-gud
- Repository: https://github.com/pranshuaryal/git-gud

## Overview

GitGud is a repository-based collaboration app for organizing notes into nested sections, forking and starring repositories, and proposing and reviewing merge requests. Users authenticate, browse or create repositories, edit notes, and submit changes from forks; owners review requests and may approve them, updating the note and its version history. The graph combines sampled backend call paths with documented-by-source-index frontend and product subsystems. Frontend-to-backend links are dashed because the relevant HTTP wiring was not sampled.

Main entry points: [`frontend/src/lib/api.ts`](https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/lib/api.ts) (API client), [`backend/src/prisma/prisma.service.ts`](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/prisma/prisma.service.ts) (Prisma service), [`backend/src/auth/auth.controller.ts`](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/auth/auth.controller.ts) (Auth endpoints), [`backend/src/merge-request/merge-request.service.ts`](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/merge-request/merge-request.service.ts) (Merge request service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web experience"]
  node_web["Web pages"]
  node_authpage["Sign-in page<br/>[page.tsx]"]
  node_clientauth["Auth context<br/>[AuthContext.tsx]"]
  node_apiclient["API client<br/>[api.ts]"]
  node_mrui["Merge request views"]
  node_repoeditor["Repository editor<br/>[page.tsx]"]
  node_repoview["Repository browser<br/>[page.tsx]"]
  node_noteui["Note editor<br/>[NoteEditor.tsx]"]
end

subgraph group_identity["Identity"]
  node_authcontroller["Auth endpoints<br/>[auth.controller.ts]"]
  node_authservice["Auth service<br/>[auth.service.ts]"]
  node_jwtguard["JWT guard<br/>[jwt-auth.guard.ts]"]
  node_jwthelper["JWT utilities<br/>[jwt.utils.ts]"]
end

subgraph group_repos["Repositories and notes"]
  node_repocontroller["Repository endpoints<br/>[repo.controller.ts]"]
  node_reposervice["Repository service<br/>[repo.service.ts]"]
  node_profilecontroller["Profile endpoints"]
end

subgraph group_reviews["Merge requests and persistence"]
  node_mrcontroller["Merge request endpoints"]
  node_mrservice["Merge request service"]
  node_diff["Diff computation<br/>[diff.util.ts]"]
  node_prisma["Prisma service<br/>[prisma.service.ts]"]
  node_database[("PostgreSQL")]
end

node_user(("User"))

node_user -->|"signs in"| node_authpage
node_user -->|"uses"| node_web
node_authpage -.->|"uses"| node_clientauth
node_web -.->|"requests"| node_apiclient
node_mrui -.->|"requests"| node_apiclient
node_repoeditor -.->|"requests"| node_apiclient
node_repoview -.->|"requests"| node_apiclient
node_apiclient -.->|"HTTP calls"| node_authcontroller
node_apiclient -.->|"HTTP calls"| node_repocontroller
node_apiclient -.->|"HTTP calls"| node_mrcontroller
node_authcontroller -->|"calls"| node_authservice
node_authservice -->|"queries"| node_prisma
node_authcontroller -->|"guards routes"| node_jwtguard
node_jwtguard -->|"verifies token"| node_jwthelper
node_repocontroller -->|"calls"| node_reposervice
node_reposervice -->|"queries"| node_prisma
node_profilecontroller -->|"calls"| node_reposervice
node_mrcontroller -->|"calls"| node_mrservice
node_mrservice -->|"queries"| node_prisma
node_mrservice -->|"computes diff"| node_diff
node_prisma -->|"connects"| node_database

click node_web "https://github.com/pranshuaryal/git-gud/tree/main/frontend/src/app/(app)"
click node_authpage "https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/app/auth/page.tsx"
click node_clientauth "https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/app/context/AuthContext.tsx"
click node_apiclient "https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/lib/api.ts"
click node_mrui "https://github.com/pranshuaryal/git-gud/tree/main/frontend/src/app/(app)/merge-requests"
click node_authcontroller "https://github.com/pranshuaryal/git-gud/blob/main/backend/src/auth/auth.controller.ts"
click node_authservice "https://github.com/pranshuaryal/git-gud/blob/main/backend/src/auth/auth.service.ts"
click node_jwtguard "https://github.com/pranshuaryal/git-gud/blob/main/backend/src/common/guards/jwt-auth.guard.ts"
click node_jwthelper "https://github.com/pranshuaryal/git-gud/blob/main/backend/src/common/utils/jwt.utils.ts"
click node_repocontroller "https://github.com/pranshuaryal/git-gud/blob/main/backend/src/repo/repo.controller.ts"
click node_reposervice "https://github.com/pranshuaryal/git-gud/blob/main/backend/src/repo/repo.service.ts"
click node_profilecontroller "https://github.com/pranshuaryal/git-gud/blob/main/backend/src/repo/profiles.controller.ts"
click node_repoeditor "https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/app/(app)/repos/%5Bid%5D/edit/page.tsx"
click node_repoview "https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/app/(app)/repos/%5Bid%5D/page.tsx"
click node_noteui "https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/components/NoteEditor.tsx"
click node_mrcontroller "https://github.com/pranshuaryal/git-gud/blob/main/backend/src/merge-request/merge-request.controller.ts"
click node_mrservice "https://github.com/pranshuaryal/git-gud/blob/main/backend/src/merge-request/merge-request.service.ts"
click node_diff "https://github.com/pranshuaryal/git-gud/blob/main/backend/src/repo/diff.util.ts"
click node_prisma "https://github.com/pranshuaryal/git-gud/blob/main/backend/src/prisma/prisma.service.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_authpage,node_clientauth,node_apiclient,node_mrui,node_repoeditor,node_repoview,node_noteui,node_user toneBlue
class node_authcontroller,node_authservice,node_jwtguard,node_jwthelper toneAmber
class node_repocontroller,node_reposervice,node_profilecontroller toneMint
class node_mrcontroller,node_mrservice,node_diff,node_prisma,node_database toneRose
```

## Components

### Web experience

- [Web pages](https://github.com/pranshuaryal/git-gud/tree/main/frontend/src/app/(app)): `frontend/src/app/(app)`
- [Sign-in page](https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/app/auth/page.tsx): `frontend/src/app/auth/page.tsx`
- [Auth context](https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/app/context/AuthContext.tsx): `frontend/src/app/context/AuthContext.tsx`
- [API client](https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Merge request views](https://github.com/pranshuaryal/git-gud/tree/main/frontend/src/app/(app)/merge-requests): `frontend/src/app/(app)/merge-requests`
- [Repository editor](https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/app/(app)/repos/%5Bid%5D/edit/page.tsx): `frontend/src/app/(app)/repos/[id]/edit/page.tsx`
- [Repository browser](https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/app/(app)/repos/%5Bid%5D/page.tsx): `frontend/src/app/(app)/repos/[id]/page.tsx`
- [Note editor](https://github.com/pranshuaryal/git-gud/blob/main/frontend/src/components/NoteEditor.tsx): `frontend/src/components/NoteEditor.tsx`

### Identity

- [Auth endpoints](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/auth/auth.controller.ts): `backend/src/auth/auth.controller.ts`
- [Auth service](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/auth/auth.service.ts): `backend/src/auth/auth.service.ts`
- [JWT guard](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/common/guards/jwt-auth.guard.ts): `backend/src/common/guards/jwt-auth.guard.ts`
- [JWT utilities](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/common/utils/jwt.utils.ts): `backend/src/common/utils/jwt.utils.ts`

### Repositories and notes

- [Repository endpoints](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/repo/repo.controller.ts): `backend/src/repo/repo.controller.ts`
- [Repository service](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/repo/repo.service.ts): `backend/src/repo/repo.service.ts`
- [Profile endpoints](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/repo/profiles.controller.ts): `backend/src/repo/profiles.controller.ts`

### Merge requests and persistence

- [Merge request endpoints](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/merge-request/merge-request.controller.ts): `backend/src/merge-request/merge-request.controller.ts`
- [Merge request service](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/merge-request/merge-request.service.ts): `backend/src/merge-request/merge-request.service.ts`
- [Diff computation](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/repo/diff.util.ts): `backend/src/repo/diff.util.ts`
- [Prisma service](https://github.com/pranshuaryal/git-gud/blob/main/backend/src/prisma/prisma.service.ts): `backend/src/prisma/prisma.service.ts`
- **PostgreSQL**

### Other components

- **User**

## Connections

- User → Sign-in page: signs in
- User → Web pages: uses
- Sign-in page → Auth context: uses
- Web pages → API client: requests
- Merge request views → API client: requests
- Repository editor → API client: requests
- Repository browser → API client: requests
- API client → Auth endpoints: HTTP calls
- API client → Repository endpoints: HTTP calls
- API client → Merge request endpoints: HTTP calls
- Auth endpoints → Auth service: calls (evidence: `backend/src/auth/auth.controller.ts`)
- Auth service → Prisma service: queries (evidence: `backend/src/auth/auth.service.ts`)
- Auth endpoints → JWT guard: guards routes (evidence: `backend/src/auth/auth.controller.ts`)
- JWT guard → JWT utilities: verifies token (evidence: `backend/src/common/guards/jwt-auth.guard.ts`)
- Repository endpoints → Repository service: calls (evidence: `backend/src/repo/repo.controller.ts`)
- Repository service → Prisma service: queries (evidence: `backend/src/repo/repo.service.ts`)
- Profile endpoints → Repository service: calls (evidence: `backend/src/repo/profiles.controller.ts`)
- Merge request endpoints → Merge request service: calls (evidence: `backend/src/merge-request/merge-request.controller.ts`)
- Merge request service → Prisma service: queries (evidence: `backend/src/merge-request/merge-request.service.ts`)
- Merge request service → Diff computation: computes diff (evidence: `backend/src/merge-request/merge-request.service.ts`)
- Prisma service → PostgreSQL: connects (evidence: `backend/src/prisma/prisma.service.ts`)
