System overview
System Student is split into two independent SvelteKit applications that share a single Supabase project as their database and storage backend.monty-app
The student, teacher, and tutor-facing application (package name:
montero). Handles learning, class management, activities, messaging, and the Montero AI tutor.monty-panel
The administrator control panel (package name:
monty). Handles platform-wide configuration, user management, class oversight, and system logs.SECRET_KEY) and use the same Supabase service role key to access shared tables.
monty-app route structure
The app uses SvelteKit’s filesystem-based routing. Routes are organized around user roles.monty-panel route structure
Data model
All persistent data lives in a single Supabase (PostgreSQL) project. The following tables are defined insrc/lib/types/types.ts:
| Table | Description |
|---|---|
users | Student accounts — name, email, password hash, points, profile photo, date of birth |
teachers | Teacher accounts — includes teacher ID for identity verification |
tutors | Tutor accounts — linked to one or more student records via the hijos relationship |
admins | Administrator accounts — access to monty-panel only |
classes | Class definitions — name, description, photo, teacher association, enrolment code |
chat_history | Montero AI conversation records — per-student chat threads, message history, daily usage counters |
config | Platform-wide configuration values managed from the admin panel |
views | Visitor and page-view tracking |
logs | System event logs — actions, errors, and audit trail entries |
Authentication flow
System Student uses a custom JWT-based session system backed bybcrypt password hashing. There is no Supabase Auth — authentication is fully managed by the apps.
The JWT payload carries the user’s
id, name, last_name, email, phone, dob, photo, and role. The role value stored in the token is the internal name (user, teacher, tutor), which is converted to the URL segment (alumno, maestro, tutor) via getRoleConverted().Server-side utilities
Shared server utilities live inmonty-app/src/lib/server/:
| File | Purpose |
|---|---|
auth.server.ts | verifyToken() — validates the u_token JWT cookie |
log.server.js | Writes structured entries to the logs table |
prompts.server.js | Builds AI prompt templates for Montero (student and teacher modes) |
registerVisitors.server.ts | Tracks visitor sessions in the views table |
sendEmailNotifications.server.js | Sends transactional emails (invitations, confirmations) via Nodemailer / Resend |
sendNotifications.server.js | In-app notification dispatch |
Technology stack
| Layer | Technology |
|---|---|
| Frontend framework | SvelteKit 2 + Svelte 5 |
| Styling | Tailwind CSS 4 + DaisyUI 5 |
| Database / storage | Supabase (PostgreSQL + Storage) |
| Authentication | Custom JWT (jsonwebtoken) + bcrypt |
| AI tutor | Groq SDK + OpenAI SDK |
| Charts | Chart.js 4 + chartjs-plugin-datalabels |
| Nodemailer + Resend | |
| PDF export | jsPDF + html2pdf.js |
| QR codes | qrcode |
| Build tool | Vite 6 |