Back

TutorIA

ENEM tutoring inside WhatsApp: solves math questions from photos, grades essays, and answers questions through RAG

Private repository

About the project

TutorIA is a tutoring platform for students preparing for the ENEM (Brazil's national high school exam) and other college entrance exams, accessible through WhatsApp. The student photographs a math question and gets a step by step solution; submits an essay and gets a grade with detailed feedback and suggested sociocultural references; asks about the exam and is helped by an assistant that answers based on indexed material. The system is split into four independent services, orchestrated with Docker Compose: the WhatsApp gateway, the AI core, the user service, and the payment processor. Monetization is subscription based, with Stripe and a dedicated webhook to confirm payment. Math solutions are delivered fully formatted: the service generates LaTeX and returns a PDF, instead of dumping formulas as plain text in the chat.

How it works

The message arrives through the TypeScript gateway built with whatsapp-web.js, which manages conversation state and routes it to the Python AI service based on intent: math, essays, ENEM questions, or guided study. On the math route, the multimodal solver receives the photo of the question, extracts the text with OCR through Google Cloud Vision, solves it with the model, and passes through a conservative reviewer before responding, with the solution converted into LaTeX and PDF. On the essay route, a multi agent flow evaluates the text and returns feedback by competency along with suggested references. The ENEM assistant answers through RAG over an indexed knowledge base, instead of relying only on the model's built in knowledge. The user service keeps authentication and sessions in Postgres via Supabase, and the Stripe webhook service grants or revokes access based on the subscription's status. A cost tracking module monitors API spend by operation type.

Architecture

  1. 01

    WhatsApp gateway in TypeScript with whatsapp-web.js: channel and conversation state

  2. 02

    Python AI service: routes for math, essays, ENEM, study, and game

  3. 03

    Multi agent essay grading with feedback by competency

  4. 04

    ENEM assistant powered by RAG over an indexed knowledge base

  5. 05

    User service in TypeScript: authentication and sessions in Postgres

  6. 06

    Stripe webhook service: subscriptions and access provisioning

  7. 07

    Solution generation in LaTeX and PDF

  8. 08

    Docker Compose tying together the four services

Features

  • Math problem solving from a photo of the question
  • Conservative reviewer before delivering the answer to the student
  • Solution formatted in LaTeX and delivered as a PDF
  • Multi agent essay grading with feedback and suggested references
  • ENEM Q&A assistant powered by RAG
  • Guided study mode
  • Stripe subscription with confirmation webhook
  • API cost tracking by operation type

Tech stack

Backend
Python · FastAPI · TypeScript · whatsapp-web.js
AI/ML
OpenAI GPT · RAG · Google Cloud Vision
Tools
PyLaTeX · Stripe
Database
PostgreSQL · Supabase
Infrastructure
Docker