# rabiaadel/stud_reg_system architecture

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

- Interactive diagram: https://gitdiagram.com/rabiaadel/stud_reg_system
- Repository: https://github.com/rabiaadel/stud_reg_system

## Overview

#### Purpose and runtime entry points
FCITU Student Registration System is a three-tier university platform for students, doctors, and admins: account admission, course/semester administration, registration, attendance/grades, transcripts, academic standing, and graduation checks. React starts at `frontend/src/index.js` and routes from `frontend/src/App.js`; Express initializes in `backend/server.js`. Local stack startup is `quick-start.sh` or `docker-compose.yml`.

#### Web client and role-oriented UI
The React 18 SPA keeps authentication in context/store, protects role-specific routes, and calls the REST API through a shared Axios client. Page/component groupings reflect student, doctor, and administrator workflows.
- `frontend/src/context/AuthContext.js`
- `frontend/src/components/shared/ProtectedRoute.js`
- `frontend/src/services/api.js`

Primary flow: browser → Nginx-served SPA → authenticated JSON API requests. UI state slices cover auth, courses, grades, notifications, and semesters under `frontend/src/store/slices/`.

#### API boundary, security, and request lifecycle
Express exposes versioned REST routes assembled centrally, then invokes controllers and domain services. Middleware establishes request context, validates JWT/RBAC, validates inputs, and normalizes failures before controllers execute.
- `backend/server.js`
- `backend/routes/index.js`
- `backend/middleware/auth.js`
- `backend/middleware/requestContext.js`
- `backend/middleware/errorHandler.js`

JWT authentication, bcrypt password hashes, CORS, Helmet, rate limiting, compression, structured logging, and Prometheus metrics are material API cross-cutting concerns. Public and authenticated endpoints are separated by route/middleware policy.

#### Academic domain workflows
Controllers represent transport-facing domains; services encapsulate policy-heavy workflows. Registration validates prerequisites, academic rules/bylaws, enrollment eligibility, and semester windows. Grade submission feeds GPA, transcripts, academic standing, and graduation eligibility; administrators manage users, assignments, courses, and semesters.
- `backend/controllers/registrationController_v2.js`
- `backend/services/registrationValidationService.js`
- `backend/services/prerequisiteCheckService.js`
- `backend/services/bylawsEnforcementService.js`
- `backend/services/academicStandingService.js`
- `backend/services/graduationEligibilityService.js`

Scheduled transitions and standing recalculation reside in `backend/jobs/semesterTransitionJob.js` and `backend/jobs/academicStandingJob.js`.

#### Persistence and lifecycle data
PostgreSQL 16 is the system of record, accessed through a backend connection pool. SQL defines relational users, student/instructor profiles, courses, semesters, enrollments, grades, notifications, attendance, and academic-standing extensions. Migrations and seeds establish schema and university bylaw/curriculum data.
- `backend/config/database.js`
- `database/schema.sql`
- `database/migrations/003_add_academic_standing.sql`
- `database/migrations/005_add_semester_windows.sql`
- `database/seeds/003_complete_curriculum.sql`

Database evolution runs through `backend/scripts/migrate.js`; initialization/demo data uses `backend/scripts/seed.js`.

#### Deployment and operational boundaries
Docker Compose runs frontend, backend, PostgreSQL, Prometheus, and Grafana. The frontend production image is served through Nginx; the API and database are separate containers with persistent DB storage and health checks. Kubernetes manifests provide deployable backend/frontend workloads, a stateful database, autoscaling, and monitoring resources.
- `Dockerfile.frontend`
- `Dockerfile.backend`
- `Dockerfile.db`
- `docker-compose.yml`
- `k8s/kustomization.yaml`
- `k8s/db/statefulset.yaml`

#### Observability and delivery
The backend exports metrics for Prometheus; Grafana is provisioned with application, performance, enrollment, and academic dashboards. CI/CD definitions exist for GitHub Actions, Jenkins, and a Minikube validation path.
- `docker/prometheus.yml`
- `docker/grafana/dashboards/api-performance.json`
- `docker/grafana/dashboards/academic-affairs.json`
- `.github/workflows/ci-cd.yml`
- `Jenkinsfile`

Main entry points: [`backend/server.js`](https://github.com/rabiaadel/stud_reg_system/blob/main/backend/server.js) (Express API), [`database/schema.sql`](https://github.com/rabiaadel/stud_reg_system/blob/main/database/schema.sql) (University system of record), [`backend/config/database.js`](https://github.com/rabiaadel/stud_reg_system/blob/main/backend/config/database.js) (Database pool), [`docker-compose.yml`](https://github.com/rabiaadel/stud_reg_system/blob/main/docker-compose.yml) (Compose stack)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_browser(("Student, doctor &amp; admin<br/>browser users"))
  node_spa["React SPA<br/>React 18 client<br/>[App.js]"]
  node_auth_ui["Auth &amp; route guard<br/>client security<br/>[AuthContext.js]"]
  node_api_client["Shared API client<br/>Axios client<br/>[api.js]"]
end

subgraph group_api["Backend API"]
  node_express["Express API<br/>Node.js REST server<br/>[server.js]"]
  node_routes["Route assembly<br/>REST routing<br/>[index.js]"]
  node_security["Request security<br/>JWT, RBAC &amp; validation<br/>[auth.js]"]
end

subgraph group_domain["Academic domain"]
  node_registration["Registration policy<br/>domain service"]
  node_academic_records["Academic outcomes<br/>domain services"]
  node_semester_jobs["Semester jobs<br/>scheduled workflows"]
end

subgraph group_data["Data lifecycle"]
  node_db_pool["Database pool<br/>PostgreSQL access<br/>[database.js]"]
  node_postgres[("University system of record<br/>PostgreSQL 16<br/>[schema.sql]")]
  node_migrate["Schema migration<br/>database evolution<br/>[migrate.js]"]
  node_seed["Curriculum seed<br/>database initialization<br/>[seed.js]"]
end

subgraph group_ops["Operations"]
  node_nginx["Nginx frontend<br/>production web server"]
  node_compose{{"Compose stack<br/>local container platform<br/>[docker-compose.yml]"}}
  node_prometheus["Prometheus metrics<br/>monitoring collector<br/>[prometheus.yml]"]
  node_grafana["Academic dashboards<br/>Grafana dashboards"]
  node_kubernetes{{"Kubernetes deployment<br/>production orchestration<br/>[kustomization.yaml]"}}
  node_ci["CI/CD pipeline<br/>GitHub Actions<br/>[ci-cd.yml]"]
end

node_browser -->|"loads SPA"| node_nginx
node_nginx -->|"serves"| node_spa
node_spa -->|"uses"| node_auth_ui
node_auth_ui -->|"authorizes calls"| node_api_client
node_api_client -->|"JSON REST"| node_express
node_express -->|"assembles"| node_routes
node_routes -->|"middleware policy"| node_security
node_security -->|"authenticated requests"| node_registration
node_security -->|"authenticated requests"| node_academic_records
node_registration -->|"reads and writes"| node_db_pool
node_academic_records -->|"reads and writes"| node_db_pool
node_semester_jobs -->|"recalculates standing"| node_academic_records
node_semester_jobs -->|"updates lifecycle data"| node_db_pool
node_db_pool -->|"connection pool"| node_postgres
node_migrate -->|"applies schema changes"| node_postgres
node_seed -->|"loads curriculum data"| node_postgres
node_compose -.->|"runs"| node_nginx
node_compose -.->|"runs"| node_express
node_compose -.->|"persistent service"| node_postgres
node_express -->|"exports metrics"| node_prometheus
node_prometheus -->|"dashboard data"| node_grafana
node_ci -->|"deploys and validates"| node_kubernetes
node_kubernetes -.->|"deploys API workload"| node_express
node_kubernetes -.->|"stateful database"| node_postgres

click node_spa "https://github.com/rabiaadel/stud_reg_system/blob/main/frontend/src/App.js"
click node_auth_ui "https://github.com/rabiaadel/stud_reg_system/blob/main/frontend/src/context/AuthContext.js"
click node_api_client "https://github.com/rabiaadel/stud_reg_system/blob/main/frontend/src/services/api.js"
click node_nginx "https://github.com/rabiaadel/stud_reg_system/blob/main/Dockerfile.frontend"
click node_express "https://github.com/rabiaadel/stud_reg_system/blob/main/backend/server.js"
click node_routes "https://github.com/rabiaadel/stud_reg_system/blob/main/backend/routes/index.js"
click node_security "https://github.com/rabiaadel/stud_reg_system/blob/main/backend/middleware/auth.js"
click node_registration "https://github.com/rabiaadel/stud_reg_system/blob/main/backend/services/registrationValidationService.js"
click node_academic_records "https://github.com/rabiaadel/stud_reg_system/blob/main/backend/services/academicStandingService.js"
click node_semester_jobs "https://github.com/rabiaadel/stud_reg_system/blob/main/backend/jobs/semesterTransitionJob.js"
click node_db_pool "https://github.com/rabiaadel/stud_reg_system/blob/main/backend/config/database.js"
click node_postgres "https://github.com/rabiaadel/stud_reg_system/blob/main/database/schema.sql"
click node_migrate "https://github.com/rabiaadel/stud_reg_system/blob/main/backend/scripts/migrate.js"
click node_seed "https://github.com/rabiaadel/stud_reg_system/blob/main/backend/scripts/seed.js"
click node_compose "https://github.com/rabiaadel/stud_reg_system/blob/main/docker-compose.yml"
click node_prometheus "https://github.com/rabiaadel/stud_reg_system/blob/main/docker/prometheus.yml"
click node_grafana "https://github.com/rabiaadel/stud_reg_system/blob/main/docker/grafana/dashboards/academic-affairs.json"
click node_kubernetes "https://github.com/rabiaadel/stud_reg_system/blob/main/k8s/kustomization.yaml"
click node_ci "https://github.com/rabiaadel/stud_reg_system/blob/main/.github/workflows/ci-cd.yml"

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_browser,node_spa,node_auth_ui,node_api_client toneBlue
class node_express,node_routes,node_security toneAmber
class node_registration,node_academic_records,node_semester_jobs toneMint
class node_db_pool,node_postgres,node_migrate,node_seed toneRose
class node_nginx,node_compose,node_prometheus,node_grafana,node_kubernetes,node_ci toneIndigo
```

## Components

### Web client

- **Student, doctor & admin**: browser users
- [React SPA](https://github.com/rabiaadel/stud_reg_system/blob/main/frontend/src/App.js): React 18 client · Role-oriented pages and state slices. · `frontend/src/App.js`
- [Auth & route guard](https://github.com/rabiaadel/stud_reg_system/blob/main/frontend/src/context/AuthContext.js): client security · `frontend/src/context/AuthContext.js`
- [Shared API client](https://github.com/rabiaadel/stud_reg_system/blob/main/frontend/src/services/api.js): Axios client · `frontend/src/services/api.js`

### Backend API

- [Express API](https://github.com/rabiaadel/stud_reg_system/blob/main/backend/server.js): Node.js REST server · Versioned routes, controllers, and cross-cutting middleware. · `backend/server.js`
- [Route assembly](https://github.com/rabiaadel/stud_reg_system/blob/main/backend/routes/index.js): REST routing · `backend/routes/index.js`
- [Request security](https://github.com/rabiaadel/stud_reg_system/blob/main/backend/middleware/auth.js): JWT, RBAC & validation · Applies request context and normalizes API failures. · `backend/middleware/auth.js`

### Academic domain

- [Registration policy](https://github.com/rabiaadel/stud_reg_system/blob/main/backend/services/registrationValidationService.js): domain service · Checks eligibility, prerequisites, bylaws, and semester windows. · `backend/services/registrationValidationService.js`
- [Academic outcomes](https://github.com/rabiaadel/stud_reg_system/blob/main/backend/services/academicStandingService.js): domain services · Produces standing, transcript inputs, and graduation eligibility. · `backend/services/academicStandingService.js`
- [Semester jobs](https://github.com/rabiaadel/stud_reg_system/blob/main/backend/jobs/semesterTransitionJob.js): scheduled workflows · Runs transitions and standing recalculation. · `backend/jobs/semesterTransitionJob.js`

### Data lifecycle

- [Database pool](https://github.com/rabiaadel/stud_reg_system/blob/main/backend/config/database.js): PostgreSQL access · `backend/config/database.js`
- [University system of record](https://github.com/rabiaadel/stud_reg_system/blob/main/database/schema.sql): PostgreSQL 16 · Stores identity, curriculum, enrollment, grades, attendance, and standing. · `database/schema.sql`
- [Schema migration](https://github.com/rabiaadel/stud_reg_system/blob/main/backend/scripts/migrate.js): database evolution · Applies academic-standing and semester-window changes. · `backend/scripts/migrate.js`
- [Curriculum seed](https://github.com/rabiaadel/stud_reg_system/blob/main/backend/scripts/seed.js): database initialization · `backend/scripts/seed.js`

### Operations

- [Nginx frontend](https://github.com/rabiaadel/stud_reg_system/blob/main/Dockerfile.frontend): production web server · `Dockerfile.frontend`
- [Compose stack](https://github.com/rabiaadel/stud_reg_system/blob/main/docker-compose.yml): local container platform · Runs frontend, API, PostgreSQL, Prometheus, and Grafana. · `docker-compose.yml`
- [Prometheus metrics](https://github.com/rabiaadel/stud_reg_system/blob/main/docker/prometheus.yml): monitoring collector · `docker/prometheus.yml`
- [Academic dashboards](https://github.com/rabiaadel/stud_reg_system/blob/main/docker/grafana/dashboards/academic-affairs.json): Grafana dashboards · Visualizes API performance and academic affairs. · `docker/grafana/dashboards/academic-affairs.json`
- [Kubernetes deployment](https://github.com/rabiaadel/stud_reg_system/blob/main/k8s/kustomization.yaml): production orchestration · Deploys workloads, stateful database, autoscaling, and monitoring. · `k8s/kustomization.yaml`
- [CI/CD pipeline](https://github.com/rabiaadel/stud_reg_system/blob/main/.github/workflows/ci-cd.yml): GitHub Actions · `.github/workflows/ci-cd.yml`

## Connections

- Student, doctor & admin → Nginx frontend: loads SPA
- Nginx frontend → React SPA: serves
- React SPA → Auth & route guard: uses
- Auth & route guard → Shared API client: authorizes calls
- Shared API client → Express API: JSON REST
- Express API → Route assembly: assembles
- Route assembly → Request security: middleware policy
- Request security → Registration policy: authenticated requests
- Request security → Academic outcomes: authenticated requests
- Registration policy → Database pool: reads and writes
- Academic outcomes → Database pool: reads and writes
- Semester jobs → Academic outcomes: recalculates standing
- Semester jobs → Database pool: updates lifecycle data
- Database pool → University system of record: connection pool
- Schema migration → University system of record: applies schema changes
- Curriculum seed → University system of record: loads curriculum data
- Compose stack → Nginx frontend: runs
- Compose stack → Express API: runs
- Compose stack → University system of record: persistent service
- Express API → Prometheus metrics: exports metrics
- Prometheus metrics → Academic dashboards: dashboard data
- CI/CD pipeline → Kubernetes deployment: deploys and validates
- Kubernetes deployment → Express API: deploys API workload
- Kubernetes deployment → University system of record: stateful database
