# debjitds/trial-client architecture

> Architecture diagram of the GitHub repository debjitds/trial-client, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/debjitds/trial-client
- Repository: https://github.com/debjitds/trial-client

## Overview

tRIAL-CLIENTS is a SaaS practice platform for generating realistic client briefs. The main user journey is account access, choosing a challenge, receiving a brief, and managing it in the workspace and history; credits and XP/rewards support continued use. The tree and README establish these capabilities, but sampled source does not show the brief-generation caller or its persistence path, so those connections are left out. Payment, authentication, and gamification links reflect sampled code; other feature wiring is not inferred.

Main entry points: [`src/App.tsx`](https://github.com/debjitds/trial-client/blob/main/src/App.tsx) (App router), [`src/integrations/supabase/client.ts`](https://github.com/debjitds/trial-client/blob/main/src/integrations/supabase/client.ts) (Supabase services), [`src/hooks/useCreditPurchase.ts`](https://github.com/debjitds/trial-client/blob/main/src/hooks/useCreditPurchase.ts) (Credit purchase), [`src/hooks/useRazorpay.ts`](https://github.com/debjitds/trial-client/blob/main/src/hooks/useRazorpay.ts) (Plan payment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application flow"]
  node_app["App router<br/>[App.tsx]"]
end

subgraph group_practice["Project practice"]
  node_dashboard["Client dashboard"]
  node_workspace["Project workspace"]
  node_history["Project history<br/>[History.tsx]"]
  node_generate["Brief generation<br/>[index.ts]"]
end

subgraph group_account["Account and rewards"]
  node_auth["Auth context<br/>[AuthContext.tsx]"]
  node_supabase[("Supabase services<br/>[client.ts]")]
  node_credit["Credit purchase"]
  node_plan["Plan payment<br/>[useRazorpay.ts]"]
  node_gamification["XP and badges<br/>[useGamification.ts]"]
  node_award["XP award function<br/>[index.ts]"]
  node_rewards["Rewards page<br/>[Rewards.tsx]"]
end

subgraph group_operations["Administration"]
  node_admin["Admin dashboard<br/>[AdminDashboard.tsx]"]
  node_adminsections["Admin management"]
end

node_learner(("Learner"))
node_payment["Razorpay"]

node_learner -->|"opens"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_workspace
node_app -->|"routes"| node_history
node_app -->|"routes"| node_rewards
node_app -->|"routes"| node_admin
node_auth -->|"auth calls"| node_supabase
node_dashboard -.->|"loads data"| node_supabase
node_learner -.->|"requests brief"| node_generate
node_credit -->|"invokes functions"| node_supabase
node_credit -->|"opens checkout"| node_payment
node_plan -->|"invokes functions"| node_supabase
node_plan -->|"opens checkout"| node_payment
node_gamification -->|"loads and awards"| node_supabase
node_supabase -->|"dispatches"| node_award
node_admin -->|"renders"| node_adminsections

click node_app "https://github.com/debjitds/trial-client/blob/main/src/App.tsx"
click node_auth "https://github.com/debjitds/trial-client/blob/main/src/contexts/AuthContext.tsx"
click node_supabase "https://github.com/debjitds/trial-client/blob/main/src/integrations/supabase/client.ts"
click node_dashboard "https://github.com/debjitds/trial-client/blob/main/src/pages/ClientDashboard.tsx"
click node_workspace "https://github.com/debjitds/trial-client/blob/main/src/pages/ProjectWorkspace.tsx"
click node_history "https://github.com/debjitds/trial-client/blob/main/src/pages/History.tsx"
click node_generate "https://github.com/debjitds/trial-client/blob/main/supabase/functions/generate-project/index.ts"
click node_credit "https://github.com/debjitds/trial-client/blob/main/src/hooks/useCreditPurchase.ts"
click node_plan "https://github.com/debjitds/trial-client/blob/main/src/hooks/useRazorpay.ts"
click node_gamification "https://github.com/debjitds/trial-client/blob/main/src/hooks/useGamification.ts"
click node_award "https://github.com/debjitds/trial-client/blob/main/supabase/functions/award-xp/index.ts"
click node_rewards "https://github.com/debjitds/trial-client/blob/main/src/pages/Rewards.tsx"
click node_admin "https://github.com/debjitds/trial-client/blob/main/src/pages/AdminDashboard.tsx"
click node_adminsections "https://github.com/debjitds/trial-client/tree/main/src/components/admin/sections"

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_app toneBlue
class node_dashboard,node_workspace,node_history,node_generate toneAmber
class node_auth,node_supabase,node_credit,node_plan,node_gamification,node_award,node_rewards toneMint
class node_admin,node_adminsections toneRose
class node_learner,node_payment toneIndigo
```

## Components

### Application flow

- [App router](https://github.com/debjitds/trial-client/blob/main/src/App.tsx): `src/App.tsx`

### Project practice

- [Client dashboard](https://github.com/debjitds/trial-client/blob/main/src/pages/ClientDashboard.tsx): `src/pages/ClientDashboard.tsx`
- [Project workspace](https://github.com/debjitds/trial-client/blob/main/src/pages/ProjectWorkspace.tsx): `src/pages/ProjectWorkspace.tsx`
- [Project history](https://github.com/debjitds/trial-client/blob/main/src/pages/History.tsx): `src/pages/History.tsx`
- [Brief generation](https://github.com/debjitds/trial-client/blob/main/supabase/functions/generate-project/index.ts): `supabase/functions/generate-project/index.ts`

### Account and rewards

- [Auth context](https://github.com/debjitds/trial-client/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Supabase services](https://github.com/debjitds/trial-client/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Credit purchase](https://github.com/debjitds/trial-client/blob/main/src/hooks/useCreditPurchase.ts): `src/hooks/useCreditPurchase.ts`
- [Plan payment](https://github.com/debjitds/trial-client/blob/main/src/hooks/useRazorpay.ts): `src/hooks/useRazorpay.ts`
- [XP and badges](https://github.com/debjitds/trial-client/blob/main/src/hooks/useGamification.ts): `src/hooks/useGamification.ts`
- [XP award function](https://github.com/debjitds/trial-client/blob/main/supabase/functions/award-xp/index.ts): `supabase/functions/award-xp/index.ts`
- [Rewards page](https://github.com/debjitds/trial-client/blob/main/src/pages/Rewards.tsx): `src/pages/Rewards.tsx`

### Administration

- [Admin dashboard](https://github.com/debjitds/trial-client/blob/main/src/pages/AdminDashboard.tsx): `src/pages/AdminDashboard.tsx`
- [Admin management](https://github.com/debjitds/trial-client/tree/main/src/components/admin/sections): `src/components/admin/sections`

### Other components

- **Learner**
- **Razorpay**

## Connections

- Learner → App router: opens
- App router → Auth context: provides auth
- App router → Client dashboard: routes
- App router → Project workspace: routes
- App router → Project history: routes
- App router → Rewards page: routes
- App router → Admin dashboard: routes
- Auth context → Supabase services: auth calls
- Client dashboard → Supabase services: loads data
- Learner → Brief generation: requests brief
- Credit purchase → Supabase services: invokes functions
- Credit purchase → Razorpay: opens checkout
- Plan payment → Supabase services: invokes functions
- Plan payment → Razorpay: opens checkout
- XP and badges → Supabase services: loads and awards
- Supabase services → XP award function: dispatches
- Admin dashboard → Admin management: renders
