Skip to content
Thnkers

Alfa learning center · Education

Three Telegram bots, replaced by one app with AI review

A learning center reviewed homework through three Telegram bots on n8n + Supabase + Gemini. It worked, but it was fragile and awkward for students and teacher alike. We rebuilt it as one app with its own backend — the student submits, Gemini checks against the criteria in minutes, and the teacher gives the final grade — built from scratch, backend to deployment, in roughly two weeks.

~2 wk
to working production
34
students in production
3 → 1
bots into one app

Inside the product

AI review result — what to fix
Student home
Pseudonymous class ranking
Teacher workspace

The gap

Reviewing homework was eating the teacher's time, and the process was scattered: submissions in Telegram, criteria in someone's head, grades in Google Sheets. Worse, there was no assignment list and no evaluation criteria at all — the requirements were buried implicitly in the course itself.

  • Three bots with logic scattered across fragile, opaque n8n nodes
  • Free Supabase throttling the project with limits
  • The grade log living in a Google Sheet
  • No single interface for either student or teacher

The insight

The client didn't come for an app — they came to get the teacher's time back. AI could handle the routine formal check; a real educator was only needed for the final grade. But first the course itself had to become a machine-readable specification, or nothing could grade consistently.

A product tour

  • Student: active homework → submit → instant AI review → grade
  • Teacher: assignments, a work feed, grades and reports
  • The bots' domain logic ported 1:1 into a custom API
  • PostgreSQL on our own VPS — zero third-party limits
  • Gemini and Drive server-side only, behind our API
01

Turn the course into a spec

The hardest part came before the first line of app code. We went through the whole course, worked out what each task should demand of a student, and formulated 14 assignments as structured, machine-readable criteria — each tagged required or optional, with reasons for rejection. One spec feeds two things: the AI verdict and what the student sees.

02

Instant AI review

Gemini checks the work against the assignment's criteria and, on rejection, returns a concrete numbered list of what to fix — no fluff. Any format works: text, photo, video, slide deck or document, shot with the camera right in the app.

03

The teacher's workspace

A work feed with AI verdicts, filters, in-app file preview and grading. The teacher can send work back with a comment; assignments can be AI-checked or graded manually, by choice.

04

Gamification without shaming

Points for results (not for spamming attempts), streaks and badges. The class ranking is pseudonymous — names are replaced with animal masks, and the mask layout is unique per viewer, so the class can't collectively de-anonymise who's behind.

05

Reminders and reports

Scheduled push reminders about unsubmitted homework and results via Expo Push, plus a class summary posted to the Telegram group twice a day on a server schedule.

Under the hood

Atomic work claim

If a student fires off five files in a row, only the first should be processed — otherwise they burn through attempts and Gemini budget. The claim is a single atomic UPDATE, so the race is ruled out at the database level.

An async AI review queue

Under a burst of submissions Gemini hit rate limits. A persistent DB-backed queue frees the student immediately, processes work one by one with retries, routes to the teacher after N failures, and survives a server restart.

A Gemini geo-block, solved

A "homework intake is broken" symptom turned out to be a geo-block — the server got 400 · location not supported. We moved production to a VPS in Tashkent and turned the old address into a reverse proxy, so already-installed APKs kept working without an update.

Zero secrets in the client

Gemini keys, Drive credentials and the DB string live only on the backend; the client only ever talks to our API. The token sits in the Keychain/Keystore via SecureStore. Self-hosted from scratch: nginx + Let's Encrypt auto-renew, pm2 autostart, APK via a direct gradle build.

How it went

Groundwork

Course analysis

No assignment list, no criteria. We analysed the whole course and formulated 14 assignments with structured, gradeable criteria — the foundation the AI review stands on.

Week 1

Backend from scratch

A custom API on Express + TypeScript, the bots' domain logic ported 1:1, Gemini and Google Drive wired end to end, the student client built.

Week 2

Production, web, first APK

Moved production to Tashkent for the geo-block, adapted for Expo Web, first APK via local gradle, then iterations in production: the async queue, teacher feed, send-back, auto reports, in-app Office viewer.

Stack & channels

React Native · Expo SDK 56 · TypeScriptNode · Express · PostgreSQL 16 (raw SQL)Google Gemini · Google Drive OAuth2Expo Push · Telegram Bot API · node-cronVPS · nginx · pm2 · Ubuntu 24.04

The outcome

From three bots on n8n to a working production — mobile app, web version and teacher workspace — in roughly two weeks. Live at alfahw.alfakom.uz with 34 students and zero secrets in the client bundle.

Start a project

Tell us what's missing.

One form, a real reply within 24 hours. Or book a call directly.

Other ways to reach us

  • Emailhello@thnkers.com
  • LinkedIn@thnkers
  • Book a callcalendly.com/thnkers