Inspiration
Most study tools assume every learner reads a screen, sits still, and hears well. Many students in Egypt and across MENA don't fit that picture. Some are blind or low-vision, some are Deaf or hard of hearing, and many simply learn better by listening or through stories than from a wall of text. On top of that, most good study tools are English-first.
We wanted a study partner that adapts to the learner instead. It had to work in Arabic and English, take any material a student already has (a PDF, a Word file, some notes), and turn it into something they can actually learn from.
What it does
Tempus AI is a bilingual (Arabic/English), mobile-first AI study platform.
- Upload anything. PDF, DOCX or TXT becomes a story-based learning journey (connected chapters, plain-language explanations, checkpoints, a final recap), flashcards, or a practice exam.
- Listen mode. Every chapter, or the whole journey, can be narrated aloud for blind and low-vision learners. If the server voice quota runs out, it falls back to the browser's built-in speech, so learning is never blocked.
- Sign Studio (prototype). An embedded 3D rigged avatar signs words typed or spoken in Arabic or English. Story chapters can be signed too, and fingerspelling covers any word without a sign.
- AI Tutor. A chat tutor with Markdown answers, web search, image cards from Wikimedia Commons, and export to
.md. It adapts to the student's VARK learning-style profile. - Classrooms and roles. Class codes, enrollments and shared school data.
- Study library. Everything generated is saved to the student's account.
- Customization. Dark/Light themes, a customizable navigation, and multiple languages.
How we built it
- Frontend: React 19 + TypeScript + Vite, with a custom i18n layer for Arabic/English including RTL.
- Backend: Supabase for magic-link and Google auth, Postgres with Row Level Security, Edge Functions (classroom-code validation, notifications), and a private Storage bucket for audio.
- AI: A Cloudflare Workers AI worker parses uploads and generates journeys, flashcards and exams. The tutor uses Puter.js. Narration uses ElevenLabs behind a Vercel serverless route that verifies the user's Supabase session, so no key ever reaches the browser.
- Sign avatar: A Mixamo-style rigged GLB model in Three.js, driven by our own pose engine with 2-bone IK for the arms and per-finger curl and spread. We generated and cleaned the model with Blender scripts.
- SEO: A custom Vite plugin that generates pages and metadata from Markdown blog content.
Making AI affordable
Narration and generation cost money on every call, so we built the cost controls in from the start:
- Content hashing. Every file and every text segment is hashed. Re-uploading the same file in the same format loads the saved result, and re-listening replays the saved mp3 instead of calling the AI or TTS again.
- Atomic daily quotas. One Postgres function checks and increments both a per-user and a global word budget at the same time, so concurrent requests can never overshoot:
$$ \text{allowed} \iff u_{\text{today}} + w \le 200 \;\wedge\; G_{\text{today}} + w \le 1000 $$
where $w$ is the word count of the request, $u$ is the user's usage and $G$ is the global usage. Days roll over at midnight Africa/Cairo. If the migration is missing, the check fails closed.
Challenges we ran into
- Keeping an AI translator from acting like an assistant. Our sign translator kept answering questions instead of translating them. We fixed it by sending a strict translator prompt plus a list of known glosses, and by having the app ignore any free-text reply and accept only structured
glosses/steps. - Sign language is not word-for-word. Facial expression carries grammar, and our model has no face rig. We chose to say so in the app and docs rather than overclaim.
- Unverified sign vocabulary. The avatar's dictionary is placeholder content, not verified Egyptian Sign Language. We were deliberate about flagging it as a prototype that needs Deaf native signers and qualified interpreters to validate it.
- Security with a browser-first stack. Only publishable keys live in
VITE_*variables. Every serverless and worker route verifies the Supabase JWT itself, and RLS has to hold across multiple schools and students. - Arabic word counting and TTS. Counting words for quotas across Arabic and English meant using Unicode letter/mark/number groups, not simple whitespace splitting.
- Slow models vs. serverless timeouts. Document conversion and model inference can outlast a proxy function, so the browser calls the worker directly.
What we learned
- Accessibility is a design constraint from day one, not a feature to bolt on later.
- Caching and quotas are product decisions: they decide who can afford to use the app.
- Being honest about what a prototype can't do (like unverified sign vocabulary) builds more trust than overclaiming.
- Structured output contracts (
tempus_learning_journey_v1) make AI features much easier to test and swap.
What's next
- Replace placeholder signs with a vetted Egyptian Sign Language dataset, validated by Deaf signers.
- A face rig for grammatical facial expressions.
- Spaced-repetition scheduling for the flashcards, using the forgetting curve $R = e^{-t/S}$, where $R$ is retention, $t$ is time since review and $S$ is memory strength.
- Teacher dashboards across classrooms.
Built With
- cloudflare-workers-ai
- deno
- elevenlabs
- google-oauth
- lucide-react
- node.js
- postgresql
- puter.js
- react
- supabase
- three.js
- typescript
- vercel
- webgl