← All work

Al-Madad: an Arabic study platform whose assistant only answers from what each student may see

Client
Moustafa, for two teachers
Role
Sole engineer: product, back end, front end, AI and Azure
Dates
27 Oct – 5 Nov 2026 · Team of 1
Stack
Python, FastAPI, PostgreSQL 16 + pgvector, Azure Container Apps, Blob storage, Azure OpenAI (Whisper, GPT-4.1-mini, embeddings), React PWA

Open the live appWatch the video

students
~1,000
first commit to Azure, solo
10 days
backend tests
129
decision records
23
The assistant answers from released lectures and the student’s own notes, and shows where each answer came from.Demo dataTranscript

The problem

Two teachers run many groups of students. They record their lectures, but students had no way to turn a long recording into notes, and nobody wanted material from one group leaking into another’s answers. They also needed attendance, quizzes and fee records in the same place, in Arabic, on a phone.

Constraints

  • One engineer and 10 days.
  • Many students are minors, so guardian consent, data export and account deletion are part of the first version.
  • AI is billed per use, so spend had to be bounded before launch, not after.

What I built

A teacher uploads a recorded lecture. The platform transcribes it, drafts notes and quiz questions, and waits for the teacher to approve them. The teacher then releases the material to one group at a time. Students study it with their own notes and search, and ask an assistant that answers with links to the exact source.

Around that: attendance by a short code shown in class, quizzes marked on the server, a monthly fee record per group, a moderated chat per group, and an inbox with phone notifications.

Architecture

One FastAPI image runs twice: as the API and as a background worker. PostgreSQL holds the data, the AI outputs, the vectors and the job queue. Files go straight from the phone to Blob storage and never through the API.

Decisions

D1

Access is enforced in the database, not in the prompt.

Telling a model “only use this group’s lectures” is a request, not a guarantee. The retriever accepts only the student’s own notes and lectures currently released to their active groups, read fresh on every question. Removing a student, moving them or withdrawing a release takes effect on the next question, and tests cover each case.

D2

PostgreSQL for everything.

Data, vectors and the job queue live in one database, so a job is created in the same transaction as the change that caused it. I chose this over a separate vector store and queue: fewer moving parts for one engineer, and no job that points at data which was never saved.

D3

Every AI call goes through one door.

Speech-to-text, the language model and embeddings sit behind interfaces, and one wrapper records model, tokens, cost and latency for every call, including failed ones. That is what makes the daily cap and per-user quotas possible, and it lets me switch providers by configuration.

D4

Processing can stop and resume without paying twice.

Processing a lecture is idempotent: a second tap returns the same job, and a retry after a failure skips the transcription chunks already finished. Uploads resume in 4 MB blocks, which matters on a phone connection.

Results

ResultHow it was measured
Live on Azure Container Apps, Sweden CentralDeploy exits 0 and passes readiness
129 backend tests; CI green on 15 of 15 runsGitHub Actions
17 modules with import boundaries enforced in CI; 138 API endpointsImport linter, route count
Every AI call logged with cost and latency; daily and per-user capsAI call ledger
Retrieval scope tests for removal, group moves, withdrawn releases and archivingIntegration tests

What I’d do next

Test transcription on five real classroom recordings with Egyptian dialect and background noise; my tests so far used synthetic speech. The Arabic and English legal pages are drafts waiting for a lawyer’s review, and I’d finish that before adding new features.