Prerequisites
Before you begin, make sure you have the following:- Node.js 18 or later
- pnpm (recommended) — or npm/yarn
- A Supabase project (free tier works)
- A Groq API key (or OpenAI key) for the Montero AI tutor
- An email provider: Resend API key or SMTP credentials for Nodemailer
Clone the repository
monty-app/— student, teacher, and tutor-facing applicationmonty-panel/— admin control panel
Configure environment variables for monty-app
Create a
.env file in the monty-app/ directory:monty-app/.env
SUPABASE_URL is the PostgreSQL connection string (postgresql://...), used for direct database access. PUBLIC_SUPABASE_URL is the Supabase REST/realtime URL (https://...supabase.co).Configure environment variables for monty-panel
Create a
.env file in the monty-panel/ directory:monty-panel/.env
SUPABASE_URL in monty-panel is used by the postgres library for direct PostgreSQL access — required for backup generation (generate-backup endpoint). This is the same PostgreSQL connection string format as in monty-app.Set up the Supabase database
System Student uses the following tables in your Supabase project. Create them via the Supabase SQL editor or migration files:
| Table | Purpose |
|---|---|
users | Student accounts |
tutors | Tutor accounts |
teachers | Teacher accounts |
classes | Class definitions |
admins | Admin accounts |
chat_history | Montero AI conversation records |
config | System-wide configuration |
views | Session/analytics tracking |
logs | Audit log entries |
Row Level Security (RLS) policies should be configured to match your deployment needs. The apps use the
SUPABASE_SERVICE_ROLE_KEY for server-side operations, which bypasses RLS.Start the development servers
Open two terminal windows and start each app:Terminal 1 — monty-app (student/teacher/tutor app):The student app runs at http://localhost:5173 by default.Terminal 2 — monty-panel (admin panel):The admin panel runs at http://localhost:5174 (or the next available port).
Create your first admin account
Admin accounts are created directly in the Supabase Then insert the record in Supabase SQL editor:
admins table. Passwords must be hashed with bcrypt before inserting.You can generate a bcrypt hash using Node.js:hash-password.js
Access the platform
With both servers running:
After login, the auth hook (
| URL | Application | Access with |
|---|---|---|
| http://localhost:5173 | Student/Teacher/Tutor app | Student, teacher, or tutor account |
| http://localhost:5174 | Admin panel | Admin account |
hooks.server.ts) reads the u_token cookie, verifies it with SECRET_KEY, and redirects users to their role-specific dashboard:/app/alumno— students/app/maestro— teachers/app/tutor— tutors
Building for production
start in its scripts):
Next steps
Architecture
Understand how the two apps share data and how authentication works
User Roles
Learn about the four roles: student, teacher, tutor, and admin
Admin Panel
Configure the system, manage users, and set up promotions
Montero AI
Explore the AI tutor and how it serves students