Logo
Command Palette

Search for a command to run...

~/ cd ..

A production-ready multi-tenant school management system with AI-powered analytics for attendance tracking, marks management, and student risk prediction.

KOTATSU-OG

Kotatsu

A production-ready, multi-tenant school management platform with AI-powered analytics for attendance tracking, marks management, and student risk prediction — built with Next.js 15, Prisma ORM, and deployed on Kubernetes.

About The Project

Kotatsu lets multiple schools (tenants) manage their entire operation inside one unified system — attendance, marks, analytics dashboards, and AI-driven insights for admins, teachers, and parents — all isolated by school within a single shared database.

Key Features

  • Row-level multi-tenancy via schoolId — one database, infinite schools
  • Real-time attendance updates over WebSockets across dashboards
  • Marks management with per-subject, per-exam entry and trend analytics
  • AI-powered student risk prediction based on attendance and marks
  • AI advisor chat with natural-language explanations for struggling students
  • Automated, AI-summarized performance reports exported as PDF
  • Role-based access control for admins, teachers, parents, and students
  • Subdomain-based tenant routing with per-school branding
  • Mobile-first, responsive UI with React Native–ready API contracts
  • Kubernetes-ready deployment with Docker images and full manifests

Development Progress

Overall Progress~40%

Core platform — multi-tenancy, authentication, attendance, marks, dashboards, and the calendar system — is complete. AI risk prediction, the advisor chat, Kubernetes deployment, Redis caching, and background jobs are actively in progress, with report generation, notifications, and mobile API support still planned.

Technology Stack

System Architecture

Kotatsu is structured in layers: a Next.js App Router frontend (with experimental React Native compatibility) talks to Better Auth, Server Actions, and API routes, which all flow through Prisma into PostgreSQL. Redis backs session storage and a BullMQ job queue. AI features call out to the OpenAI API and a separate Python FastAPI risk-scoring service. The whole stack runs on a Kubernetes cluster, with dedicated pods for the Next.js app, a PostgreSQL StatefulSet, a Redis deployment, and an ingress controller handling subdomain routing.

Multi-Tenant Architecture

Every data model carries a schoolId field for row-level isolation, enforced automatically: a Prisma middleware layer intercepts queries and scopes them to the current tenant, resolved from the session or the request subdomain (e.g. school1.example.com, school2.example.com). This means one database serves an arbitrary number of schools without per-tenant infrastructure.

RBAC (Role-Based Access Control)

Four distinct roles — Admin, Teacher, Parent, and Student — each get their own gated routes and dashboard experience, with permissions enforced at both the route and the data layer.

AI Capabilities

FeatureDescription
Risk PredictionML model scoring students based on attendance + marks
AI AdvisorConversational interface explaining student struggles
Report GenerationAuto-summarized performance reports with PDF export
Smart NotificationsAI-generated alerts for low attendance/marks

The AI layer is provider-flexible: it can run against OpenAI's API in production or fall back to a local LLM via Ollama for offline/demo use.

Motivation

The goal was to build a school management system that actually scales across institutions instead of being rebuilt per-school — combining solid multi-tenant fundamentals with genuinely useful AI features rather than AI as a bolt-on.

  • Support an arbitrary number of schools from a single deployment
  • Give teachers a fast, mobile-friendly way to mark attendance and enter marks
  • Surface at-risk students automatically instead of relying on manual review
  • Build something production-ready enough to actually deploy on Kubernetes

Development Journey

  1. Set up the multi-tenant architecture and row-level schoolId scoping.
  2. Implemented Better Auth with role-based access control.
  3. Built attendance CRUD with real-time WebSocket updates.
  4. Built the marks management system and analytics dashboards with Recharts.
  5. Added a drag-and-drop calendar system for events and scheduling.
  6. Currently building the AI risk prediction service (Python FastAPI), the OpenAI advisor chat, Kubernetes manifests, Redis caching, and the BullMQ job queue.

What's Next

  • AI-generated PDF report summaries
  • Parent and teacher notification system
  • Mobile app API endpoints for React Native
  • Comprehensive end-to-end test suite
  • Production monitoring with Prometheus and Grafana
Command Palette

Search for a command to run...