How zaggi-225/kendra-project works
Purpose and entry points
This repository is a student academic-management system with a static browser UI, a Python API backend, and Supabase/PostgreSQL persistence. The frontend begins at index.html; feature pages are under pages/. The API application entry point is backend/app/main.py. Database lifecycle is defined through ordered Supabase migrations in supabase/migrations/.
Frontend feature modules
The browser client is plain HTML/CSS/JavaScript rather than a bundled framework application. js/app.js is the shared client bootstrap, while feature-specific scripts drive student, attendance, DLT, and exam workflows:
• pages/student-master.html, js/studentMaster.js
• pages/attendance.html, js/attendance.js
• pages/dlt.html, js/dlt.js
• pages/exam.html, js/exam.js
Shared presentation structure is centralized in css/base.css, css/layout.css, and css/components.css. js/mockData.js indicates the UI can operate against local/mock data during development or before API integration.
API composition and request boundary
The backend is structured as a FastAPI-style layered service. backend/app/main.py assembles the application and routes; domain HTTP endpoints are separated into routers:
• backend/app/routers/students.py
• backend/app/routers/attendance.py
• backend/app/routers/assessments.py
• backend/app/routers/dlt.py
• backend/app/routers/enrollments.py
Routers form the external API boundary and should handle HTTP concerns, validation invocation, and dependency wiring rather than persistence logic.
Domain service layer
Business operations are organized per educational domain behind service modules:
• backend/app/services/student_service.py
• backend/app/services/enrollment_service.py
• backend/app/services/attendance_service.py
• backend/app/services/assessment_service.py
• backend/app/services/dlt_service.py
The primary control flow is frontend feature action → API router → domain service → database dependency/connection → Supabase PostgreSQL. Services are the key place to coordinate cross-entity rules, such as enrollment context for attendance and assessment records.
Data contracts and persistence access
Backend models and schemas distinguish stored/domain data from API request/response contracts. Relevant parallel structures include:
• backend/app/models/student.py, backend/app/schemas/students.py
• backend/app/models/attendance.py, backend/app/schemas/attendance.py
• backend/app/models/assessment.py, backend/app/schemas/assessment.py
• backend/app/models/dlt.py, backend/app/schemas/dlt.py
Database connectivity and injected request-scoped access are isolated in backend/app/db/connection.py and backend/app/db/dependencies.py. Configuration and security boundaries are in backend/app/core/config.py and backend/app/core/security.py.
Supabase relational model and governance
Supabase provides PostgreSQL infrastructure, schema evolution, seeds, and row-level security. The data model progresses from identity/reference entities to school operations:
• Profiles and academic/class structure: 001_create_profiles.sql, 002_create_academic_years.sql, 003_create_classes.sql
• Student and enrollment relationships: 004_create_students.sql, 008_create_student_enrollments.sql
• Operational records: 010_create_attendance.sql, 011_create_dlt.sql, 012_create_assessments.sql
Indexes and RLS are explicit architectural stages in supabase/migrations/013_create_indexes.sql and supabase/migrations/014_create_rls.sql. Therefore, API authorization must remain compatible with Supabase’s database-level access policies rather than treating the database as an unrestricted internal store.
Main entry points: dependencies.py Database dependency · security.py Security boundary · app.js Client bootstrap · studentMaster.js Student workflow
Components 17
Browser client
- Feature pages · Student, attendance, DLT, and exam workflows.
- Client bootstrap
js/app.js - Student workflow
js/studentMaster.js - Attendance workflow
js/attendance.js - DLT workflow
js/dlt.js - Exam workflow
js/exam.js - Mock data · Allows UI operation before API integration.
js/mockData.js
FastAPI backend
- API application · Assembles the application and route registration.
backend/app/main.py - Domain routers · Students, attendance, assessments, DLT, and enrollment endpoints.
- Domain services · Coordinates cross-entity academic rules.
- API schemas · Student, attendance, assessment, and DLT validation contracts.
- Domain models · Student, attendance, assessment, and DLT representations.
- Database dependency · Connection and injected database access.
backend/app/db/dependencies.py - Security boundary · Must align API authorization with database RLS.
backend/app/core/security.py
Supabase data platform
- Schema migrations · Identity, academic structure, enrollment, and operational records.
- Indexes and RLS · Indexes and row-level access policies.
supabase/migrations/014_create_rls.sql - Supabase PostgreSQL · Persistent academic-management data.
Connections 17
- Feature pages → Client bootstrap: loads shared behavior
- Student workflow → Domain routers: student requests
- Attendance workflow → Domain routers: attendance requests
- DLT workflow → Domain routers: DLT requests
- Exam workflow → Domain routers: assessment requests
- Mock data → Feature pages: development fallback
- Client bootstrap → Student workflow: supports
- API application → Domain routers: registers
- Domain routers → API schemas: validates requests
- Domain routers → Domain services: dispatches
- Domain services → Domain models: uses domain data
- Domain services → Database dependency: uses injected access
- Database dependency → Supabase PostgreSQL: connects
- Security boundary → Database dependency: governs access
- Schema migrations → Supabase PostgreSQL: evolves schema
- Indexes and RLS → Supabase PostgreSQL: enforces policies
- Security boundary → Indexes and RLS: must remain compatible