Full-stack AI Platform
In developmentDarshan AI — Smart Attendance Management System
Automating classroom attendance with existing IP CCTV cameras, a face-recognition pipeline, and a Spring Boot backend.
- Java
- Spring Boot
- Spring Security
- JWT
- PostgreSQL
- Flyway
- Python
- FastAPI
- OpenCV
- ONNX Runtime (SCRFD, ArcFace)
- React
- Flutter
- Docker
- AWS Lightsail
Overview
Darshan AI is a smart attendance management platform designed for colleges. The objective is to automate classroom attendance using existing IP CCTV cameras, an AI-powered face-recognition pipeline, and a centralized backend system — replacing manual registers with an auditable digital workflow.
The product spans a web interface, a mobile application, backend services, a dedicated AI processing service, and a relational database. The design intentionally reuses cameras colleges already own, so adoption does not require new hardware in every classroom.
Status honesty: this project is in active development. Throughout this page, components are labelled as implemented (verified in code), partial (in progress), or planned (designed but not built yet).
Problem statement
- Manual attendance consumes lecture time every day and produces records that are slow to aggregate, easy to misplace, and hard to audit.
- Colleges already have IP CCTV cameras, but the footage is never connected to academic records.
- Ad-hoc attendance apps still require a teacher to take out a phone and mark each student — the classroom step remains manual.
- A camera-based system must cope with distance, small faces, occlusion, duplicates, and unknown people, without pretending recognition is perfect.
System architecture
The platform separates camera processing from business logic. IP CCTV cameras and NVRs expose RTSP streams that a dedicated Python AI service consumes. The AI service runs detection, quality scoring, embedding, and matching, then emits attendance events to the Spring Boot backend, which owns authentication, academic data, and persistence in PostgreSQL. React and Flutter clients consume the backend APIs.
Architecture diagram · editable source in src/data/diagrams.ts
Attendance processing workflow
Attendance is produced by a staged pipeline rather than a single 'recognize' call. Each stage can be tuned or replaced independently — for example swapping the detector without touching business APIs.
Architecture diagram · editable source in src/data/diagrams.ts
Backend and database engineering
The backend is a modular Spring Boot application. Each domain (identity, department, faculty, student, class, subject, classroom, timetable, enrollment, attendance, notification, audit) is its own package with controller, DTO, entity, repository, and service layers, so boundaries stay clear as the system grows.
Authentication is JWT-based (login plus refresh tokens) with Spring Security filters and role-based authorization. Cross-cutting concerns — structured audit logging, soft deletes, optimistic locking, password lifecycle rules — are modeled in the schema rather than left to convention.
The schema is managed entirely through versioned Flyway migrations (19 migrations, from the initial schema through roles, password lifecycle, soft delete, audit logs, profile extensions, notifications, and unmatched-face status), so every environment can be rebuilt deterministically.
Architecture diagram · editable source in src/data/diagrams.ts
- REST API design for identity and academic management (students, faculty, departments, classes, subjects, classrooms, timetable).
- JWT-based authentication with refresh-token management and role-based authorization.
- Relational data modeling for enrollments, class assignments, attendance sessions, and attendance records.
- Flyway schema migrations with optimistic locking, soft delete, and audit columns.
- User and role management with password lifecycle handling.
- Notifications and audit logs as first-class tables, not afterthoughts.
- Unmatched-face records with review status, so uncertain recognitions never silently become attendance.
- Actuator health endpoints, Prometheus metrics, and structured (Logstash-encoded) logging.
- OpenAPI documentation via springdoc, with MapStruct mappers between entities and DTOs.
AI processing pipeline
The AI service is a clean-room Python FastAPI application — its own codebase, separate from the earlier prototype. It runs face detection with SCRFD and generates embeddings with ArcFace, both through ONNX Runtime (GPU on the Windows development machine, CPU on the deployment VM). A cosine matcher with configurable confidence thresholds decides whether a face matches an enrolled student.
Each pipeline stage below is labelled honestly — implemented (verified in the service code), partial (present but evolving), or planned (designed, not yet operational).
- 01Partial
RTSP connection and camera stream handling
Stream-reading path exists; live classroom camera ingestion is being finalized.
- 02Partial
Frame scheduling and buffer management
Frame cadence and buffering rules under active tuning.
- 03Planned
Person tracking
Designed to stabilize per-person frame selection; not yet operational.
- 04Implemented
Face detection — SCRFD via ONNX Runtime
- 05Implemented
Face quality scoring and alignment
Dedicated quality and alignment modules in the AI service.
- 06Partial
Best-frame selection
Quality-driven selection exists; benefits from person tracking (planned).
- 07Implemented
Face embedding generation — ArcFace via ONNX Runtime
- 08Implemented
Face recognition and identity matching — cosine matcher
Configurable match threshold.
- 09Partial
Unknown-person handling
Unmatched-face records with review status in the backend schema.
- 10Partial
Duplicate attendance prevention
Handled at attendance-session level; edge cases still being hardened.
- 11Implemented
Confidence thresholds
Detection confidence and match threshold exposed via settings.
- 12Partial
GPU inference where supported
ONNX Runtime GPU on the Windows dev machine; CPU inference on the Linux deployment VM.
- 13Implemented
Sending attendance events to the backend
FastAPI endpoints (/ai/health, /ai/enroll/validate, /ai/attendance/process, /ai/admin/gallery/reload) integrate with the Spring Boot backend.
The pipeline is designed to work with existing classroom cameras — but no recognition accuracy is guaranteed or claimed. Camera distance, lighting, and resolution directly affect results, which is why quality scoring, confidence thresholds, and unmatched-face review exist.
Deployment architecture
The system is designed as multiple containers orchestrated with Docker Compose on an Ubuntu server (AWS Lightsail), fronted by a Caddy reverse proxy that terminates HTTPS for darshanai.app. Backend and AI service each ship their own Dockerfile; PostgreSQL runs as a container with persistent storage. No secrets, tokens, private IPs, or production credentials are published anywhere in this portfolio.
Architecture diagram · editable source in src/data/diagrams.ts
- Service separation: Spring Boot backend and FastAPI AI service are independent containers with independent release cycles.
- Database persistence: PostgreSQL container with a persistent volume; schema owned by Flyway migrations.
- API routing: Caddy reverse proxy routes domain traffic to the right service and handles HTTPS certificates.
- Logs: structured JSON logging from the backend (Logstash encoder) and per-service log files.
- Health checks: Spring Boot Actuator on the backend and a dedicated /ai/health endpoint on the AI service.
Production infrastructure details (server addresses, credentials, environment files) stay private. Only the architecture shape is documented here.
Engineering contributions
- Designed and built the modular Spring Boot backend: domain packages, layered controllers/DTOs/entities/services, and MapStruct mapping.
- Implemented JWT authentication with refresh tokens and role-based authorization using Spring Security filters.
- Created and evolved the PostgreSQL schema through 19 versioned Flyway migrations.
- Built the FastAPI AI service core: SCRFD detection, ArcFace embedding, quality/alignment, and cosine matching through ONNX Runtime.
- Exposed AI endpoints for health checks, enrollment validation, attendance processing, and gallery reloads.
- Contributed to the React web dashboard and Flutter mobile application that consume the backend APIs.
- Containerized backend and AI services with Dockerfiles and designed the Docker Compose + Caddy deployment layout.
Engineering challenges
- Recognizing faces when classroom cameras are mounted far from students — long distances shrink faces to a few dozen pixels.
- Working with limited image resolution and small faces — which drives detection quality, alignment, and downstream embedding reliability.
- Designing a pipeline that separates camera processing from business APIs, so Python/ONNX model work never couples to Java business logic.
- Avoiding duplicate attendance events — a person in front of a camera for minutes must produce one record, not dozens.
- Handling unknown identities and uncertain matches — below-threshold matches become reviewable unmatched-face records instead of silent failures.
- Structuring academic data and attendance records so departments, classes, subjects, enrollments, sessions, and records stay consistent.
- Managing multiple backend services (Java, Python, React, Flutter) and their deployment as one coherent system.
- Designing for scale-out — from one classroom to many classrooms and cameras without re-architecting.
Current status
In development. The backend, database schema, AI service core (detection, embedding, matching, quality), and both client apps exist and are being actively integrated end to end.
- Incomplete: person tracking, full RTSP ingestion hardening for live classroom cameras, and end-to-end duplicate-prevention edge cases.
- Ongoing: performance and load testing across the camera → AI → backend path.
- Ongoing: multi-classroom integration work and deployment hardening for darshanai.app.
Product direction
The long-term objective is a maintainable attendance solution colleges can actually operate: reusing existing cameras, keeping human-reviewable records, and giving faculty dashboards and reports instead of a black box. Success is measured by less manual attendance work and trustworthy, auditable records — not by marketing claims about accuracy.
An earlier face-recognition attendance prototype preceded this platform; the current AI service is a deliberate clean-room rewrite with a clearer pipeline and stricter separation from business logic.