# veeranjineyulu1222/credit_calculation_system architecture

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

- Interactive diagram: https://gitdiagram.com/veeranjineyulu1222/credit_calculation_system
- Repository: https://github.com/veeranjineyulu1222/credit_calculation_system

## Overview

CSP is a competency-based credit system for students and faculty. Users authenticate and receive role-scoped access; the application presents academic records and course configuration, while the database calculates auditable competency-based credits from performance, course weights, percentile ranks, and policy bands. Students can optionally ask for AI explanations grounded in their own competency data. The graph reflects the supplied excerpts and README; several service and UI details are supported only by the source index or documentation, so uncertain implementation links are omitted.

Main entry points: [`src/App.jsx`](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/App.jsx) (Role-based workspace), [`src/lib/supabase.js`](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/lib/supabase.js) (Supabase client), [`src/services/analysisService.js`](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/analysisService.js) (Competency analysis), [`server/competencyInsightsHandler.js`](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/server/competencyInsightsHandler.js) (Competency insights handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Role-based workspace<br/>[App.jsx]"]
  node_bootstrap["Application entry<br/>[main.jsx]"]
end

subgraph group_auth["Identity and access"]
  node_auth_context["Session and role state<br/>[AuthContext.jsx]"]
  node_auth_service["Authentication service<br/>[authService.js]"]
end

subgraph group_academic["Academic data"]
  node_supabase_client["Supabase client<br/>[supabase.js]"]
  node_supabase[("Supabase platform")]
  node_student_data["Student records<br/>[studentService.js]"]
  node_course_data["Course catalog<br/>[courseService.js]"]
  node_outcome_data["Course outcomes"]
end

subgraph group_credits["Credit analysis"]
  node_course_policy["Credit policies"]
  node_credit_bands["Allocation bands"]
  node_analysis["Competency analysis<br/>[analysisService.js]"]
  node_credit_rpc[("Dynamic credit RPC")]
end

subgraph group_insights["AI insights"]
  node_ai_client["AI question service<br/>[aiService.js]"]
  node_ai_endpoint["AI API endpoint"]
  node_ai_handler["Competency insights handler"]
end

node_student(("Student or faculty"))
node_openrouter{{"OpenRouter"}}

node_student -->|"uses"| node_app
node_bootstrap -->|"provides session"| node_auth_context
node_bootstrap -->|"mounts"| node_app
node_app -->|"checks role"| node_auth_context
node_auth_context -->|"delegates auth"| node_auth_service
node_auth_service -->|"uses"| node_supabase_client
node_supabase_client -->|"connects"| node_supabase
node_app -->|"requests records"| node_student_data
node_app -->|"requests courses"| node_course_data
node_app -->|"requests policies"| node_course_policy
node_app -->|"requests bands"| node_credit_bands
node_app -->|"requests analysis"| node_analysis
node_student_data -->|"queries"| node_supabase_client
node_course_data -->|"queries"| node_supabase_client
node_outcome_data -->|"queries"| node_supabase_client
node_course_policy -->|"queries"| node_supabase_client
node_credit_bands -->|"queries"| node_supabase_client
node_analysis -->|"reads and invokes"| node_supabase_client
node_analysis -->|"calls RPC"| node_credit_rpc
node_credit_rpc -->|"calculates in"| node_supabase
node_app -->|"asks insight"| node_ai_client
node_ai_client -->|"posts question"| node_ai_endpoint
node_ai_endpoint -->|"mounts handler"| node_ai_handler
node_ai_handler -->|"reads student data"| node_supabase
node_ai_handler -->|"requests explanation"| node_openrouter

click node_app "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/App.jsx"
click node_bootstrap "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/main.jsx"
click node_auth_context "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/context/AuthContext.jsx"
click node_auth_service "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/authService.js"
click node_supabase_client "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/lib/supabase.js"
click node_student_data "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/studentService.js"
click node_course_data "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/courseService.js"
click node_outcome_data "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/courseOutcomeService.js"
click node_course_policy "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/creditPolicyService.js"
click node_credit_bands "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/creditBandService.js"
click node_analysis "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/analysisService.js"
click node_credit_rpc "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/supabase/migrations/004_dynamic_credit_algorithm.sql"
click node_ai_client "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/aiService.js"
click node_ai_endpoint "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/api/ai/competency-insights.js"
click node_ai_handler "https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/server/competencyInsightsHandler.js"

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,node_bootstrap toneBlue
class node_auth_context,node_auth_service toneAmber
class node_supabase_client,node_supabase,node_student_data,node_course_data,node_outcome_data,node_openrouter toneMint
class node_course_policy,node_credit_bands,node_analysis,node_credit_rpc toneRose
class node_ai_client,node_ai_endpoint,node_ai_handler,node_student toneIndigo
```

## Components

### Web application

- [Role-based workspace](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/App.jsx): `src/App.jsx`
- [Application entry](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/main.jsx): `src/main.jsx`

### Identity and access

- [Session and role state](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Authentication service](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/authService.js): `src/services/authService.js`

### Academic data

- [Supabase client](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/lib/supabase.js): `src/lib/supabase.js`
- **Supabase platform**
- [Student records](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/studentService.js): `src/services/studentService.js`
- [Course catalog](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/courseService.js): `src/services/courseService.js`
- [Course outcomes](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/courseOutcomeService.js): `src/services/courseOutcomeService.js`

### Credit analysis

- [Credit policies](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/creditPolicyService.js): `src/services/creditPolicyService.js`
- [Allocation bands](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/creditBandService.js): `src/services/creditBandService.js`
- [Competency analysis](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/analysisService.js): `src/services/analysisService.js`
- [Dynamic credit RPC](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/supabase/migrations/004_dynamic_credit_algorithm.sql): `supabase/migrations/004_dynamic_credit_algorithm.sql`

### AI insights

- [AI question service](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/src/services/aiService.js): `src/services/aiService.js`
- [AI API endpoint](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/api/ai/competency-insights.js): `api/ai/competency-insights.js`
- [Competency insights handler](https://github.com/veeranjineyulu1222/credit_calculation_system/blob/main/server/competencyInsightsHandler.js): `server/competencyInsightsHandler.js`

### Other components

- **Student or faculty**
- **OpenRouter**

## Connections

- Student or faculty → Role-based workspace: uses (evidence: `src/App.jsx`)
- Application entry → Session and role state: provides session (evidence: `src/main.jsx`)
- Application entry → Role-based workspace: mounts (evidence: `src/main.jsx`)
- Role-based workspace → Session and role state: checks role (evidence: `src/App.jsx`)
- Session and role state → Authentication service: delegates auth (evidence: `src/context/AuthContext.jsx`)
- Authentication service → Supabase client: uses (evidence: `src/services/authService.js`)
- Supabase client → Supabase platform: connects (evidence: `src/lib/supabase.js`)
- Role-based workspace → Student records: requests records (evidence: `src/App.jsx`)
- Role-based workspace → Course catalog: requests courses (evidence: `src/App.jsx`)
- Role-based workspace → Credit policies: requests policies (evidence: `src/App.jsx`)
- Role-based workspace → Allocation bands: requests bands (evidence: `src/App.jsx`)
- Role-based workspace → Competency analysis: requests analysis (evidence: `src/App.jsx`)
- Student records → Supabase client: queries (evidence: `src/services/studentService.js`)
- Course catalog → Supabase client: queries (evidence: `src/services/courseService.js`)
- Course outcomes → Supabase client: queries (evidence: `src/services/courseOutcomeService.js`)
- Credit policies → Supabase client: queries (evidence: `src/services/creditPolicyService.js`)
- Allocation bands → Supabase client: queries (evidence: `src/services/creditBandService.js`)
- Competency analysis → Supabase client: reads and invokes (evidence: `src/services/analysisService.js`)
- Competency analysis → Dynamic credit RPC: calls RPC (evidence: `src/services/analysisService.js`)
- Dynamic credit RPC → Supabase platform: calculates in (evidence: `README.md`)
- Role-based workspace → AI question service: asks insight (evidence: `src/App.jsx`)
- AI question service → AI API endpoint: posts question (evidence: `src/services/aiService.js`)
- AI API endpoint → Competency insights handler: mounts handler
- Competency insights handler → Supabase platform: reads student data (evidence: `server/competencyInsightsHandler.js`)
- Competency insights handler → OpenRouter: requests explanation (evidence: `server/competencyInsightsHandler.js`)
