Inspiration
Learning Arabic can feel overwhelming because beginners must understand a new script, unfamiliar sounds, vocabulary, and grammar at the same time. I wanted to create a learning experience that starts with meaningful sentences and lets learners inspect each word without losing the context of the complete sentence.
I also wanted AI assistance to remain optional and transparent. Generated explanations should help learners understand reviewed material, but they should never silently replace trusted translations, answer keys, or curriculum.
What Sofer does
Sofer is a guest-first Arabic learning application for complete beginners.
Learners can:
- Read reviewed Modern Standard Arabic sentences with transliteration and English meaning.
- Select individual Arabic tokens to see curated meanings and grammar notes.
- Complete deterministic comprehension questions with reviewed answer keys.
- Mark difficult words and revisit them through vocabulary recall and sentence reconstruction.
- Preserve progress locally without creating an account.
- Optionally sign in with Firebase Authentication and explicitly merge progress across devices.
- Search a reviewed Arabic, transliteration, and English Dictionary.
- Participate in Community discussions and private two-member Messenger conversations.
The three trusted starter lessons contain seven reviewed sentences. Additional lesson drafts are clearly labeled and excluded from grading and AI grounding until qualified Arabic review is available.
Firebase hybrid AI
The optional Sofer tutor is grounded in the reviewed lesson currently selected by the learner.
The Web application calls Firebase AI Logic at runtime and supports on-device, cloud, and preferred fallback routing. Prompts contain bounded lesson context, and generated responses must pass a strict shared schema before the interface displays them.
Sofer reports an on-device or cloud result only from the SDK's actual inferenceSource. Selecting a mode does not by itself count as evidence that inference ran there.
Firebase App Check with reCAPTCHA Enterprise protects the deployed AI path. If AI is unavailable, times out, or returns an invalid response, Sofer keeps the curated lesson usable and clearly identifies the fallback instead of presenting it as model output.
The demonstration environment did not have a genuine supported Chrome on-device model. The single authorized production cloud request reached Firebase AI Logic with App Check and the strict response schema but returned HTTP 429. I therefore do not claim a successful cloud response or genuine on-device execution in the submitted video.
How I built it
The client uses React, TypeScript, Vite, and shared Zod schemas. It is deployed through Firebase Hosting at aisofer.tech.
Firebase provides:
- Firebase AI Logic for hybrid inference routing.
- App Check with reCAPTCHA Enterprise.
- Firebase Authentication for optional accounts.
- Cloud Firestore for owned progress, Community, Messenger, reports, and blocking.
- Firebase Hosting for the production Web application and same-origin API routing.
The Dictionary uses a bounded Node.js and Express API deployed to Cloud Run. It queries a read-only, versioned lexicon in PostgreSQL on Cloud SQL. Dictionary requests require valid App Check tokens and use parameterized SQL, bounded input validation, and rate limiting.
Firestore Security Rules enforce document ownership, authorship, conversation membership, canonical two-member conversations, immutable reports, blocking, and tombstone deletion. User-written social content remains separate from reviewed curriculum and can never become an answer key.
Challenges I faced
One major challenge was making the AI boundary honest. A selected routing mode is an instruction, not proof of where inference occurred. I changed the interface to use the SDK's returned inference source and to reject unsupported or ambiguous device behavior.
I also corrected structured-output failures, prompt bounds, request cancellation, stalled inference requests, strict Content Security Policy behavior, and an App Check endpoint that was initially blocked in production.
The backend presented a separate deployment challenge. I connected Firebase Hosting, Cloud Run, Cloud SQL, Secret Manager, and App Check while keeping browser requests same-origin and database credentials out of the client.
Community and Messenger required careful Firestore rule testing for forged authorship, cross-user access, malformed fields, conversation-ID manipulation, report mutation, and block enforcement.
Accomplishments
I am proud that Sofer remains useful when AI is unavailable. Learners can continue reading, answering questions, practising vocabulary, and restoring progress without depending on a generated response.
The submitted release includes:
- A live custom-domain Firebase deployment.
- Reviewed sentence learning and deterministic grading.
- Transparent Firebase AI Logic routing and source reporting.
- App Check enforcement.
- Optional authentication and progress synchronization.
- A reviewed Dictionary backed by Cloud Run and PostgreSQL.
- Community and private Messenger experiences.
- Automated unit, integration, Firestore Rules, PostgreSQL, browser, accessibility, and two-user social testing.
- A public security review, evidence ledger, test report, and existing-work disclosure.
What I learned
I learned that hybrid AI requires evidence from the actual runtime environment. Browser capability detection, model preparation, a selected mode, and a successful SDK call are different facts and should be presented separately.
I also learned that schema validation cannot replace educational review. Generated output and draft curriculum therefore remain outside Sofer's trusted answer keys.
Existing work disclosure
Sofer began on October 22, 2026, before the hackathon submission period. The original project contained the React learning experience, three starter lessons, deterministic questions, local progress, an earlier optional AI provider, an Express backend, and initial tests.
During the hackathon period, I significantly updated it with Firebase AI Logic hybrid integration, App Check, Firebase Authentication, Firestore progress synchronization, Firebase Hosting, verifiable inference-source reporting, bounded structured output, practice and review features, trusted-versus-draft curriculum separation, Community, Messenger, and the deployed Cloud Run and Cloud SQL Dictionary.
The repository contains a detailed changelog and existing-work disclosure.
What's next
My next steps are to capture successful inference from a supported branded Chrome device model, obtain qualified Arabic educator review for the draft curriculum, conduct learner usability testing, and expand the reviewed lexicon without weakening the trust boundary between curriculum and generated assistance.
Links
Built With
- ai
- app
- artificial
- authentication
- check
- chrome
- cloud
- education
- express.js
- firebase
- firestore
- gemini
- hosting
- intelligence
- logic
- nano
- node.js
- playwright
- postgresql
- react
- typescript
- vite
- web
- zod