How cmreddyg85/statgen works
Secure Business Portal is a role-based internal administration and student-record application. Admins and users sign in through the portal; authenticated requests reach the Express API, where server-side sessions and roles govern user administration, student ownership, and record operations. The student workflow covers CRM management, per-student record creation and review, and controlled release of finalized statements. SBI statement extraction, transaction generation, and saved reports form a separate capability; the other named modules have record-generation structure but placeholder payloads. The graph reflects documented architecture and sampled calls; unsampled route and persistence wiring is kept conservative.
Main entry points: api.ts API client · app.ts Express API · pool.ts PostgreSQL · sbi.routes.ts SBI endpoints
Components 29
Web portal
- Portal pages
frontend/src/app/(portal) - Login form
frontend/src/app/login/LoginForm.tsx - API client
frontend/src/lib/api.ts - Session context
frontend/src/lib/session-context.tsx - User management
frontend/src/app/(portal)/users/UsersClient.tsx - Student CRM
frontend/src/app/(portal)/students/StudentsClient.tsx - Record generation
frontend/src/app/(portal)/students/[id]/generate/page.tsx - SBI reports
frontend/src/app/(portal)/sbi/SbiReportsClient.tsx
API and access
- Express API
backend/src/app.ts - Auth routes
backend/src/routes/auth.routes.ts - Authentication
backend/src/services/auth.service.ts - Session policy
backend/src/services/session.service.ts - User routes
backend/src/routes/users.routes.ts - Student routes
backend/src/routes/students.routes.ts
Business workflows
- User service
backend/src/services/user.service.ts - Student service
backend/src/services/student.service.ts - Record service
backend/src/services/student-record.service.ts - SBI endpoints
backend/src/sbi/sbi.routes.ts - Statement extraction
backend/src/sbi/extract.js - Transaction generation
backend/src/sbi/generate.js - Report service
backend/src/services/sbi-report.service.ts - Audit service
backend/src/services/audit.service.ts
Persistence
- User repository
backend/src/repositories/user.repository.ts - Student repository
backend/src/repositories/student.repository.ts - Record repository
backend/src/repositories/student-record.repository.ts - Report repository
backend/src/repositories/sbi-report.repository.ts - PostgreSQL
backend/src/db/pool.ts
Other components
- Admin
- User
Connections 35
- Admin → Login form: signs in
- User → Login form: signs in
- Admin → Portal pages: uses
- User → Portal pages: uses
- Login form → API client: submits credentials
- Portal pages → API client: requests data
- API client → Express API: same-origin API
- Express API → Auth routes: dispatches
- Express API → User routes: dispatches
- Express API → Student routes: dispatches
- Express API → SBI endpoints: dispatches
- Auth routes → Authentication: authenticates
- Authentication → Session policy: creates session
- Authentication → User repository: looks up account
- Session policy → PostgreSQL: reads and writes
- Session context → API client: checks session
- User management → API client: manages accounts
- User routes → User service: handles requests
- User routes → Audit service: loads activity
- User service → User repository: accesses users
- Student CRM → API client: manages students
- Record generation → API client: submits record
- Student routes → Student service: handles students
- Student routes → Record service: handles records
- Student service → Student repository: accesses students
- Record service → Record repository: reads and writes
- SBI reports → API client: manages reports
- SBI endpoints → Statement extraction: extracts statement
- SBI endpoints → Transaction generation: generates transactions
- SBI endpoints → Report service: manages reports
- Report service → Report repository: reads and writes
- User repository → PostgreSQL: queries
- Student repository → PostgreSQL: queries
- Record repository → PostgreSQL: queries
- Report repository → PostgreSQL: queries