Digital Study Center
Full-Stack Coaching & Academic Operations Platform
Streamlining academic administration, attendance auditing, and resource distribution for modern educational coaching institutions.
Completely replaced manual register books for daily and monthly attendance workflows.
TOTP two-factor authentication enforcement on all faculty and administrative accounts.
Optimized PostgreSQL composite indexes for fast student history and fee ledger queries.
Strict privilege isolation between Administrator, Teacher, and Student access levels.
The Problem & System Scope
Digital Study Center is an end-to-end management platform engineered for a real coaching institution. The platform replaced error-prone paper attendance ledgers and disconnected WhatsApp broadcast groups with a secure, centralized web portal. It provides role-based workspaces for administrators, educators, and students with robust two-factor security and fast student analytics.
End-to-End Architectural Design
Built upon a modular Node.js and Express backend communicating with a Supabase PostgreSQL relational database. The presentation layer features high-performance semantic HTML, CSS, and modular JavaScript delivering zero-dependency client speed. Multi-factor authentication is enforced at the API gateway layer with JWT token signing and session claim validation.
Client Web Interface
Fast, lightweight portal accessible on any mobile device, low-end tablets, and desktop computers.
Application Server
Authentication gateway, business validation, attendance ledger computation, student report generation.
Database & Storage
Relational data store with foreign keys, cascading integrity, student documents, and homework PDFs.
In-Memory Accelerator
Session tracking, rate-limiting failed login attempts, and caching static subject/batch rosters.
- STEP 1 User accesses portal; client submits credentials over HTTPS to Express authentication controller.
- STEP 2 Backend verifies password hash using bcrypt; checks if account has TOTP MFA enabled.
- STEP 3 If MFA is required, a temporary short-lived intermediate token is issued requiring TOTP verification code input.
- STEP 4 Upon verification, a signed JWT with role claim (ADMIN, TEACHER, STUDENT) is issued to client.
- STEP 5 Role-Based Access Control (RBAC) middleware checks route permissions against JWT claims before controller execution.
- STEP 6 Database queries leverage composite indexes on student ID, batch ID, and date ranges for instantaneous ledger rendering.
Technology Choices & Justifications
Robust ecosystem for REST API creation, customized middleware chaining, and high-performance JSON request handling.
ACID transactions are essential for academic attendance and fee ledgers where missing or corrupted entries are unacceptable.
RFC 6238 time-based OTP protection stops credential stuffing attacks on faculty accounts that hold sensitive student records.
Caches class rosters and enforces brute-force lockout thresholds on login endpoints.
Industry-standard password hashing with high salt rounds and stateless tamper-proof session tokens.
Deep Technical Breakthroughs
High-Volume Attendance Batch Recording & Concurrency
Teachers taking attendance for classes of 50-100 students at the same time caused database lock contention and duplicate record insertion errors.
Inserting records one-by-one was slow (50+ round trips); dropping unique constraints risked double-marked records.
Implemented PostgreSQL atomic batch upserts using `INSERT INTO attendance ... ON CONFLICT (student_id, date, batch_id) DO UPDATE SET status = EXCLUDED.status`. This reduced 50 round trips into a single 12ms atomic transaction and guaranteed data idempotency.
Step-Up MFA with Backend AAL2 Verification
Admins needed heightened protection when modifying student fee records or releasing exam marks, without burdening casual student views.
Forcing MFA on every login annoyed students on poor network connections.
Created an Authenticator Assurance Level (AAL) stepped architecture: basic login grants AAL1 (sufficient for viewing assignments and announcements). Performing administrative actions or faculty grade edits requires AAL2 authentication backed by TOTP verification.
Multi-Batch Schedule Conflicts & Attendance History Aggregation
Calculating monthly percentage summaries over thousands of historical attendance records caused slow page loads on teacher analytics dashboards.
Pre-computing daily summaries required heavy background cron jobs.
Created composite B-tree indexes on `(batch_id, date, student_id)` and created an optimized SQL view utilizing window functions (`COUNT(*) OVER ...`) that retrieves attendance summaries in under 35ms.
Production Engineering Logic
// Express Controller for Batch Attendance
const pool = require('../config/database');
exports.recordBatchAttendance = async (req, res) => {
const { batchId, date, records } = req.body;
// records: [{ studentId: '123', status: 'PRESENT' }, ...]
if (!batchId || !date || !Array.isArray(records)) {
return res.status(400).json({ error: 'Invalid payload structure' });
}
const client = await pool.connect();
try {
await client.query('BEGIN');
// Construct bulk parameterized query
const values = [];
const placeholders = records.map((record, index) => {
const offset = index * 4;
values.push(record.studentId, batchId, date, record.status);
return `($${offset + 1}, $${offset + 2}, $${offset + 3}, $${offset + 4})`;
}).join(', ');
const queryText = `
INSERT INTO attendance (student_id, batch_id, attendance_date, status)
VALUES ${placeholders}
ON CONFLICT (student_id, batch_id, attendance_date)
DO UPDATE SET
status = EXCLUDED.status,
updated_at = NOW()
RETURNING id;
`;
const result = await client.query(queryText, values);
await client.query('COMMIT');
return res.status(200).json({
success: true,
recordsProcessed: result.rowCount,
date,
});
} catch (error) {
await client.query('ROLLBACK');
console.error('Batch attendance failure:', error);
return res.status(500).json({ error: 'Failed to record attendance batch' });
} finally {
client.release();
}
}; Persistence & Schema Design
Normalized relational schema with foreign key constraints, composite unique indexes, and audit timestamps.
Users
Core identity table containing credentials, MFA secrets, and role assignments.
id: UUID (PK)email: VARCHARpassword_hash: VARCHARrole: ENUMtotp_secret: VARCHARis_mfa_enabled: BOOLEAN
Attendance
Daily attendance record per student per batch with unique composite constraint.
id: UUID (PK)student_id: UUID (FK)batch_id: UUID (FK)attendance_date: DATEstatus: ENUM(PRESENT, ABSENT, LATE)
StudyMaterial
Academic resources, lecture notes, and downloadable assignments.
id: UUID (PK)batch_id: UUID (FK)title: VARCHARfile_url: TEXTuploaded_by: UUID (FK)
Key Learnings & Future Enhancements
Key Engineering Learnings
- Understanding real user workflows: educators prioritize speed and keyboard ergonomics over flashy animations when taking attendance.
- Mastered transactional database concurrency: bulk SQL upserts prevent race conditions and drop round-trip network delays by orders of magnitude.
- Learned how to construct enterprise-grade role-based access control and multi-factor authentication from scratch.
Future Roadmap (v2)
- Automated WhatsApp/SMS alerts to parents when a student is marked absent.
- Integrated online fee payment gateway with instant PDF invoice generation.
- Interactive quiz and computerized test evaluation module for entrance exam preparation.