notes.addict.best SUB-PATH HUB
← Full Notes Hub ← العودة للفهرس الرئيسي

Arabic App Stack & Architecture Intelligence Hub مركز استخبارات وبنية تطبيق تعليم اللغة العربية الموحد

Every box below is filled from its matching source file — not a 2-bullet stub. The ten files disagree on paid cloud APIs vs self-host; the new recommendation at the top is the lightest stack that still covers pedagogy, PWA install, and every common phone / browser / setting, using the VPS and AI agents you already have. No paid SaaS.

كل صندوق أدناه مملوء من ملفه المصدر نفسه، وليس سطرين مختصرين. الملفات العشرة تختلف حول واجهات السحابة المدفوعة مقابل الاستضافة الذاتية. التوصية الجديدة في الأعلى هي أخف حزمة تغطي المنهج، وتثبيت PWA، وكل الهواتف والمتصفحات والإعدادات الشائعة — باستخدام الخادم والوكلاء الذكيين الموجودين لديك. بلا خدمات مدفوعة.

📁 10 source files, read end-to-end ✅ Recommended: static PWA on Caddy 🎙️ Piper pre-gen · Web Speech fallback 📱 All phones · Chrome Edge Safari Firefox 💵 $0 APIs · existing VPS only
RECOMMENDED BUILD — FREE · LIGHT · PWA

00. Best free stack for this Arabic app (VPS + AI agents you already have) 00. أفضل حزمة مجانية لهذا التطبيق (الخادم والوكلاء الموجودون لديك)

Synthesis of Claude/Unified Tier 0 + Kimi static-first + Monica Service Worker + Z-AI free replacements

Verdict: Static-First PWA on the Caddy you already run. No Node, no Docker, no paid API for version 1. القرار: PWA ساكن أولاً على Caddy الذي يعمل لديك. بلا Node وبلا Docker وبلا واجهة مدفوعة في الإصدار الأول.

Claude/Unified already named this Tier 0 — Static core: HTML/CSS/JS, progress in the browser, Caddy serving files. That alone delivers flashcards, native audio, record-and-compare, RTL, TPR, dialogues, streaks, and the phonetic bootcamp — most of the teaching value. Monica is the only source that requires a Service Worker; we take that piece and add a Web App Manifest so the app is installable from the browser on phones. Piper runs once at build time (your AI agents can generate curriculum + diacritics + audio). Runtime RAM on the VPS is Caddy only (~35 MB). The app stays usable when the mic is denied, when SpeechRecognition is missing (iOS Safari / Firefox), on 3G, in private mode, and with large system fonts.

وثائق كلود/الموحّد تسمّي هذا المستوى 0 — النواة الساكنة: HTML/CSS/JS، التقدم في المتصفح، وCaddy يقدّم الملفات. هذا وحده يعطي البطاقات والصوت الأصلي والتسجيل والمقارنة واتجاه RTL وأوامر TPR والحوارات والسلسلة والمعسكر الصوتي — معظم القيمة التعليمية. مونيكا هي المصدر الوحيد الذي يفرض Service Worker؛ نأخذ ذلك ونضيف بيان تطبيق ويب ليصبح قابلاً للتثبيت من المتصفح على الهواتف. Piper يعمل مرة واحدة وقت البناء (وكلاؤك يولّدون المنهج والتشكيل والصوت). استهلاك الذاكرة وقت التشغيل على الخادم هو Caddy فقط (~35 ميجا). التطبيق يبقى صالحاً عند رفض الميكروفون، وغياب التعرف على الكلام (سفاري آيفون / فايرفوكس)، وعلى شبكة 3G، وفي التصفح الخاص، ومع خط النظام الكبير.

Chosen stack (v1)الحزمة المختارة (الإصدار 1)
Layer Choice Why (from the files + your constraints)
UIVanilla HTML5 + CSS3 + ES modulesAll serious build guides reject React/Vue/Next. No bundler. Initial page < 500 KB excluding media (Kimi). Works on old WebViews.كل أدلة البناء الجادة ترفض React/Vue/Next. بلا حزمة بناء. الصفحة الأولى أقل من 500 ك.ب بدون الوسائط. يعمل على متصفحات الويب القديمة في الهواتف.
Install / offlinemanifest.webmanifest + service-worker.jsMonica Week 6 + deploy checklist: Service Worker, HTTPS, Lighthouse >90, iOS/Android. Add-to-Home-Screen on Android Chrome and desktop Chromium; iOS via Share → Add to Home Screen.أسبوع 6 وقائمة مونيكا: Service Worker وHTTPS وLighthouse أعلى من 90. التثبيت على أندرويد كروم وسطح المكتب، وعلى آيفون عبر المشاركة ← إضافة إلى الشاشة الرئيسية.
ServerCaddy 2 file_server onlyAlready on notes.addict.best (Contabo). Auto-HTTPS, HTTP/3, gzip/zstd. No Express process for v1. Node is optional later for multi-device sync only.موجود أصلاً على notes.addict.best. شهادات تلقائية وHTTP/3 وضغط. بلا عملية Express في الإصدار 1. Node لاحقاً فقط لمزامنة الأجهزة.
Lesson voicePiper ar_JO-kareem-medium pre-generated OGG + MP3Z-AI / Kimi / Claude: generate once at build, serve static. 0 MB RAM at runtime. Must feed fully diacritized text. Dual format: OGG for Chrome/Firefox, MP3/MP4 for Safari.ولّد مرة واحدة وقت البناء وقدّم ملفات ساكنة. صفر ذاكرة وقت التشغيل. النص يجب أن يكون مشكّلاً. صيغتان: OGG لكروم/فايرفوكس وMP3/MP4 لسفاري.
Dynamic speakWeb Speech speechSynthesis lang=ar-SA rate 0.85Fallback only for typed text not in the curriculum. Quality varies by OS (Naayf / Maged / Tarik). Label it as auto-voice.احتياطي للنص المكتوب غير الموجود في المنهج. الجودة تختلف حسب النظام. يُوسم بأنه صوت تلقائي.
RecordgetUserMedia + MediaRecorderHTTPS required. Prefer audio/mp4 on iOS, webm/opus elsewhere. playsinline. First play() must sit inside the tap — no await before it (Unified bug table).يتطلب HTTPS. mp4 على آيفون وwebm/opus في غيره. أول تشغيل يجب أن يكون داخل النقرة مباشرة.
PronunciationWeb Speech STT + Levenshtein + optional Meyda MFCCFree, in-browser. Feature-detect. If missing: record-and-compare + type-what-you-said. Honest caveat (Claude C.2): Chrome/Edge/Safari STT often leaves the device to the vendor. Firefox STT is off by default.مجاني داخل المتصفح. إن غاب: سجّل وقارن أو اكتب ما سمعته. تنبيه: تعرف كروم/إيدج/سفاري غالباً يغادر الجهاز إلى مزوّد المتصفح. فايرفوكس معطّل افتراضياً.
ProgresslocalStorage + IndexedDB, SM-2schema_version + try/catch (private browsing). Ease min 1.3; quality <3 resets interval to 1 day. Cap review at 20 items. No SQLite process until you need two devices.إصدار مخطط وtry/catch للتصفح الخاص. حد أدنى لمعامل السهولة 1.3. سقف المراجعة 20 بنداً. بلا عملية SQLite حتى تحتاج جهازين.
ImagesLocal files + Wikimedia Commons (download once)Do not call Unsplash live (Claude/Unified reject Monica/Qwen live APIs). One-time download, then self-host. Fallback image on error.لا تستدعِ Unsplash حيّاً. نزّل مرة ثم استضف. صورة احتياطية عند الفشل.
FontsSelf-host Cairo + Noto Naskh Arabic (woff2)Google Fonts CDN breaks true offline PWA. Gemini: Noto needed for لا ligature. Scale Arabic ~+4pt vs Latin. Logical CSS properties only.خطوط جوجل تكسر العمل بلا إنترنت. نوتو لازم لربط لا. كبّر العربية نحو 4 نقاط. خصائص CSS المنطقية فقط.
Curriculumcurriculum.json with tashkeel written inClaude: do not run a diacritizer at request time. Your agents write tashkeel once. Phases: weeks 1–2 spoken only; 3–4 connected letters; 5–8 roots + toggle.لا تشغّل مشكِّلاً عند كل طلب. الوكلاء يكتبون التشكيل مرة. المراحل: 1–2 كلام فقط؛ 3–4 حروف متصلة؛ 5–8 جذور وتبديل.
Your VPSContabo Caddy site blockDrop public/ under the notes (or a new subdomain) site. Cache /audio/* immutable. UFW already 80/443. Fail2Ban optional. No new Caddyfile rewrite of other hosts.ضع مجلد public تحت الموقع. خزّن /audio/* بلا انتهاء. المنافذ 80/443 موجودة. لا تعِد كتابة مضيفين آخرين في Caddy.
Your AI agentsContent + Piper batch + QAGenerate diacritized JSON, mouth-position SVGs, Wikimedia picks, Piper batch, and Lighthouse/RTL checks. No paid model API is required in the running app.توليد JSON مشكّل ورسوم مخارج الحروف واختيار ويكيميديا ودفعات Piper وفحص Lighthouse/RTL. لا حاجة لواجهة نموذج مدفوعة داخل التطبيق العامل.

v1 tags

Vanilla HTML/CSS/JS Web App Manifest Service Worker Caddy file_server Piper pre-gen OGG+MP3 Web Speech + fallback SM-2 localStorage IndexedDB Wikimedia once Self-hosted woff2 RTL logical CSS No React / Next / Vite No Docker in v1 No Node in v1 No Azure / Chirp / Unsplash live No Firebase / Postgres
Phone / browser / settings matrixمصفوفة الهاتف والمتصفح والإعدادات
Surface What works What we degrade to
Chrome / Edge Android + desktopInstall PWA, STT, record, SW cache, HTTP/3تثبيت PWA والتعرف والتسجيل والتخزين—
Samsung InternetTreat as Chromium. Install + STT usually yes.يُعامل ككروميوم. التثبيت والتعرف غالباً نعم.—
iOS Safari / Chrome-on-iOSAdd to Home Screen, audio with playsinline, record as audio/mp4إضافة للشاشة الرئيسية، صوت playsinline، تسجيل mp4Assume no SpeechRecognition (Unified bug table contradicts “Safari has STT”). Record-compare + type-in.افترض غياب التعرف. سجّل وقارن أو اكتب.
FirefoxPWA + audio + recordPWA والصوت والتسجيلSTT off by default → acoustic/manual pathالتعرف معطّل افتراضياً → مسار يدوي/صوتي
Mic denied / no micLessons, audio, SRS, script toggle still workالدروس والصوت والمراجعة والتبديل تعملHide record; show “type what you heard”أخفِ التسجيل؛ أظهر «اكتب ما سمعت»
Private browsingApp runsالتطبيق يعملlocalStorage try/catch; session-only progresstry/catch؛ تقدم للجلسة فقط
3G / offline after first visitSW cache HTML/CSS/JS + already-heard audioتخزين الصفحات والصوت المسموعNew audio waits; never block UIالصوت الجديد ينتظر؛ لا تجمّد الواجهة
System font 200% / large textrem units, no fixed-height cardsوحدات rem بلا ارتفاع ثابت—
prefers-reduced-motionNo Ken Burns, no pulse on recordبلا نبض أو حركات تكبير—
RTL + LTR mixedhtml dir=rtl; English/translit dir=ltr; logical marginsالجذر rtl والإنجليزي ltr وهوامش منطقية—
Dark / light OS themeShip one dark learning theme; do not depend on color-scheme for meaningثيم داكن واحد؛ لا تعتمد على الوضع الفاتح للمعنى—
Keyboard only / TalkBack / VoiceOveraria-label, aria-live=polite, focus-visible, 44px targetsتسميات حية وتركيز ظاهر وأهداف 44px—

PWA install contractعقد تثبيت PWA

manifest: name, short_name, start_url=./, display=standalone, dir=rtl, lang=ar, theme_color, 192+512 icons, screenshots optional. SW: cache-first for app shell; stale-while-revalidate for curriculum.json; cache audio on first play. Never cache POST. Update via skipWaiting after a visible “new version” toast.

البيان: الاسم وstart_url وstandalone واتجاه rtl وأيقونات 192 و512. العامل: الغلاف أولاً من التخزين؛ المنهج بتحديث كسول؛ الصوت عند أول تشغيل. لا تخزّن POST. حدّث بعد رسالة «إصدار جديد».

Build with agents, not paid APIsابنِ بالوكلاء لا بالواجهات المدفوعة

Agents write curriculum.json with tashkeel, pick Wikimedia files, run Piper on the VPS once, emit OGG+MP3, and check RTL + Lighthouse. The running learner never hits Azure, Chirp 3, Unsplash, Firebase, or Netlify (those appear in older answers and are later rejected).

الوكلاء يكتبون المنهج المشكّل ويختارون ويكيميديا ويشغّلون Piper مرة ويصدرون OGG+MP3 ويفحصون RTL وLighthouse. المتعلم لا يلمس Azure أو Chirp أو Unsplash أو Firebase أو Netlify.

Later tiers (only if needed)مستويات لاحقة (عند الحاجة فقط)

Tier 1: tiny Node + SQLite WAL on 127.0.0.1 for multi-device sync (Kimi db.js). Tier 2: more photos, OPI prompt, root highlighter. Tier 3: self-hosted Whisper + Uptime Kuma + Borg/Restic. Do not start there. Docker/Portainer/Piper-as-a-service (~200 MB idle) is for a later ops upgrade, not the first ship.

المستوى 1: Node صغير وSQLite للمزامنة. 2: صور أكثر ومقابلة ومحلّل جذور. 3: Whisper محلي ومراقبة ونسخ. لا تبدأ من هنا. دوكر وPiper كخدمة (~200 ميجا خاملة) ترقية تشغيل لاحقة.

Why this beats the heavy boxes belowلماذا تتفوق على الصناديق الثقيلة أدناه

Z-AI’s full Docker+Piper-live stack is ~435–450 MB idle. File 4’s generic homelab (Portainer, AdGuard, DokuWiki, Maddy) is a server platform, not the app. Monica’s Netlify + live Unsplash + Chirp 3 needs keys and bills. You asked for non-heavy, free, PWA, every phone. Tier 0 + SW is the only box that matches all four.

حزمة Z-AI الكاملة ~435–450 ميجا خاملة. ملف 4 منصة خادم عامة لا التطبيق. مونيكا تحتاج مفاتيح وفواتير. طلبت خفة ومجانية وPWA وكل هاتف. المستوى 0 مع عامل الخدمة هو الصندوق الوحيد الذي يطابق الأربعة.

arabic-pwa/ # ship this folder to Caddy root ├── index.html # lang=ar dir=rtl, no framework ├── manifest.webmanifest # display=standalone, icons 192/512 ├── sw.js # cache shell + audio-on-first-play ├── css/app.css # logical props, 44px targets, reduced-motion ├── js/ │ ├── app.js # hash router #/lesson/:id │ ├── srs.js # SM-2 (EF min 1.3, reviews cap 20) │ ├── audio.js # <audio playsinline>, OGG then MP3 │ ├── recorder.js # feature-detect; mp4 on iOS │ ├── eval.js # STT if any, else compare / type-in │ └── store.js # localStorage + IndexedDB, schema_version ├── audio/ # piper out: id.ogg + id.mp3 ├── images/ # self-hosted, lazy ├── fonts/ # Cairo + Noto Naskh woff2 └── curriculum.json # tashkeel already written # Caddy (existing style — do not wipe other hosts) arabic.example.com { encode gzip zstd root * /var/www/arabic-pwa file_server @audio path /audio/* header @audio Cache-Control "public, max-age=31536000, immutable" }
STACK TRIAL & MASTER BUILD

01. Z-AI Arabic App Stack Trial & Master Build Blueprint 01. تجربة ودليل بناء حزمة تطبيق تعليم العربية — Z-AI

apps-stack trials/z-ai-Arabic-app-stack-trial.md · 2894 lines · two files: 01_MASTER_GUIDE + 02_APP_CODE (then a CommonJS rewrite)
What this file actually is ما هو هذا الملف فعلاً
Z-AI merges four prior docs (teaching guide, Linux stack, two app-code drafts) into a zero recurring API cost hybrid. Deploy time ~75 minutes. Idle RAM ~435–450 MB on a 2 GB VPS. Monthly cost $0 beyond the VPS you already pay for.
  • Replace paid: Piper instead of Google/Azure TTS; Web Speech instead of Azure Pronunciation; Wikimedia URLs instead of Unsplash/Pexels; Meyda.js MFCC instead of cloud scoring.
  • Keep teaching: phonetic bootcamp, shadowing, SRS, script toggle, diacritics, root patterns, letter-formation SVG, writing practice, real images.
  • Hardened ops: Caddy + Docker + UFW + Fail2Ban + Borg + Restic + Uptime Kuma.
  • Frontend: Vanilla JS, no Vite/Webpack, no React/Vue.
  • Avoid list (verbatim): Cloud TTS, Azure Pronunciation, Unsplash/Pexels keys, Mongo/Postgres, React/Vue, Vite/Webpack.
يدمج Z-AI أربعة مستندات سابقة في هجين بلا فواتير واجهات. زمن النشر نحو 75 دقيقة. الذاكرة الخاملة نحو 435–450 ميجا على خادم 2 جيجا.
  • بدائل مجانية: Piper بدل TTS السحابي، Web Speech بدل تقييم أزور، ويكيميديا بدل Unsplash، Meyda بدل التقييم السحابي.
  • يبقي المنهج: المعسكر الصوتي، التظليل، التكرار المتباعد، تبديل الخط، التشكيل، الجذور، رسم الحرف، الكتابة، الصور الحقيقية.
  • تشغيل مقوّى: Caddy ودوكر وجدار وFail2Ban ونسخ Borg/Restic ومراقبة Kuma.
  • واجهة: جافاسكربت مجردة بلا إطار وبلا خطوة بناء.
Pedagogy → feature map (every row in the file)خريطة المنهج → الميزة (كل صف في الملف)
PedagogyApp featureImplementation
CLTTask-based lessonscurriculum.js real-world scenarios
Phonetic bootcamp ع ح خ غ ق ص ض ط ظHard-phoneme drillsLesson group + MFCC energy-band
Shadowing & chorusingPlay + recordWeb Audio + MediaRecorder
Dialogue skeletonSubstitution drillsDynamic word-swap UI
Comprehensible inputPicture promptsWikimedia embeds
TPRAction commandsقف / اجلس / اشرب / كل
SRSSmart reviewSM-2-lite in state.js + server progress.js
Phased scriptScript / translit toggledir="rtl" + translit column
FormativeRecord & compare1–5 score + A/B playback
SummativeOPI-style promptsTimed response drills
Failure alternativesBack-chaining, streaksSentence splitter + streak counter

Defined stack + ports + RAM

Caddy :80/:443/:443udp ~35MB Node Alpine Express :3000 ~120MB Piper :5002 ~200MB · ar_JO-kareem ~63MB SQLite 10–50MB WAL Uptime Kuma :3001 ~80MB Meyda + Levenshtein Wikimedia URLs Docker network selfhost Borg + Restic /data/

Curriculum phases (anti week-2 dropout)

W1–2 spoken only: 8 phonetic sessions, TPR, greetings, transliteration only. W3–4: connected letters, diacritics ON, SVG stroke order, قلب vs كلب. W5–8: read+write+speak, ك-ت-ب highlighter, hide-tashkeel toggle, OPI prompts. Each lesson: id, phase, type (phonetic/dialogue/tpr/substitution/reading), title_ar/en, translit, audio_text (diacritized), image_url, words[], minimal_pairs[], script_visible, diacritics_visible, tip.

الأسابيع 1–2 كلام فقط ثم الحروف المتصلة ثم الدمج مع الجذور. كل درس يحمل نصاً مشكّلاً للصوت وصورة ويكيميديا وأزواجاً صغرى.

Nine feature specs + scoring

Audio: Piper MP3 cached, never autoplay, playsinline, handle play() reject. Record: AGC/echo/NS off, revoke object URLs. STT: ar-SA, Safari → type-what-you-heard. Score: 0.5×Levenshtein (strip harakat, unify Alef/ى) + 0.3×MFCC + 0.2×50–150 Hz pharyngeal band. Writing: virtual keyboard, 1-typo tolerance if word >4 chars.

الصوت مسبقاً بلا تشغيل تلقائي. التسجيل بدون معالجة المتصفح. الدرجة: نصفها نص ونصفها صوت ونطاق حلقي 50–150 هرتز.

Security + 75-minute roadmap

SSH key-only, no root login, UFW 22/80/443, helmet CSP, rate 100 req/min/IP, textContent only, containers USER node, HSTS. Phases: OS 10m → Docker layout 10m → app 15m → Dockerfiles 5m → compose 10m → Caddy 5m → launch 5m → backups 10m → Kuma 5m. Weekly compose pull; monthly Restic restore drill.

مفاتيح SSH وجدار وCSP وحد معدل. نشر بتسع مراحل في 75 دقيقة. سحب أسبوعي واختبار استعادة شهري.

File 2 code reality

Full tree: generate-audio, Express routes, Piper Python :5002, public JS modules, Dockerfiles, compose, Caddyfile, backup.sh (quiesce SQLite then Borg+Restic). Later rewrite switches ESM → CommonJS. Closing note in the file: still “needs upgrading, enhancing and fixing.”

شجرة كاملة مع دوكر ونسخ احتياطي. الملف نفسه يقول إنه ما زال يحتاج ترقية وإصلاحاً.

UNIFIED BUILD GUIDE

02. Kimi Unified Master Build Guide: Static-First Hybrid 02. دليل كيمي البنائي الموحد: الواجهة الساكنة أولاً

apps-stack trials/kimi/01-Unified_Master_Build_Guide.md · 342 lines
Architecture flipقلب البنية
Generate everything at build time, serve statically, evaluate in the browser. Merged from the teaching guide, Monica, Opus/Claude deep analysis, Kimi, Qwen, Gemini, and Z-AI. Philosophy: every documented feature on the lightest free stack.
  • 95% of use (read, listen, diacritics, flashcards) never touches the CPU of the VPS.
  • Runtime total ~100 MB if you add the optional Node API (Caddy 35 + SQLite ~10 + Node ~50). TTS/STT/images are 0 MB at runtime.
  • Piper voices: file names ar_JO-kareem-medium (this guide) vs Z-AI’s same Jordanian voice. Input must be tashkeel (mishkal or hand-written).
  • Eval: normalize → Levenshtein → heuristic error table (ك for ق, س for ص) → fluency = duration within 20% of model. Claims ~80% of cloud-API teaching value at 0% cost.
  • Caddy: immutable cache on /audio/*, 30-day images, reverse_proxy /api/* to localhost:3000.
  • Deploy: rsync → npm install --production → systemd arabic-app.service. Uptime Kuma optional (~80 MB Docker).
  • Offline: “Full offline PWA support possible” — named, not implemented in this file.
ولّد وقت البناء وقدّم ساكناً وقيم في المتصفح. نحو 95٪ من الاستخدام لا يلمس معالج الخادم. إن أضفت Node الاختياري فالمجموع نحو 100 ميجا. Piper مشكّل إلزاماً. التقييم: تطبيع ثم ليفنشتاين ثم جدول أخطاء ثم مقارنة المدة. كاش صوتي ثابت في Caddy. PWA مذكور كإمكانية لا كشيفرة.
ComponentCloud / cost alternativeThis guideRAM
TTSChirp 3 $0.001/reqPiper pre-gen MP30 runtime
STT / evalAzure $1/1k uttWeb Speech + Levenshtein0 server
RecordingCustom server pipelineMediaRecorder0 server
ImagesUnsplash keysLocal curated0 runtime
DatabasePostgres 200–500 MBSQLite file~10 MB
Web serverNginx + CertbotCaddy~35 MB
BackendDjango / RailsExpress minimal~50 MB

Stack

Static vanilla Caddy Auto-HTTPS Optional Node :3000 SQLite users/progress/mistakes SM-2 client systemd not PM2 UFW 22/80/443/443udp Fail2Ban
CODE BLUEPRINT

03. Kimi App Implementation Blueprint & Production Code 03. المخطط التنفيذي وشيفرة الإنتاج — كيمي

apps-stack trials/kimi/02-App_Implementation_Blueprint.md · 1466 lines
Companion to file 02 — copy-paste architectureمرافق للملف 02 — معمارية جاهزة للنسخ
Production-hardened snippets against bugs collected from all source docs.
  • better-sqlite3 ^9.4.0 because it is synchronous, faster than sqlite3, no pool. Plus express ^4.19, cors, helmet ^7.1. Node ≥18.
  • WAL: db.pragma('journal_mode = WAL'). Tables: users, progress (best_score never decreases via MAX()), mistakes per phoneme. Prepared statements only.
  • Listen on 127.0.0.1:3000 — Caddy is the only public socket. No express.static (Caddy serves public/).
  • APIs: GET /api/health; POST /api/progress (400 if missing user_id/lesson_id); GET /api/progress/:user_id (due reviews LIMIT 20); POST /api/mistakes (no validation). Tree lists auth.js — not implemented.
  • SM-2: EF += 0.1 − (5−q)×(0.08+(5−q)×0.02), floor 1.3. q<3 → interval 1, reps 0. Else 1 then 6 then ×EF. Score 90/75/60/40/20 → quality 5…0.
  • Helmet CSP: self + unsafe-inline scripts/styles, fonts.googleapis/gstatic, img data/blob, media self.
شيفرة إنتاج ضد أخطاء كل الوثائق. SQLite متزامن بنمط WAL. الخادم يستمع على 127.0.0.1 فقط. SM-2 في المتصفح. بعض الملفات المذكورة في الشجرة (auth) غير مكتوبة في الشيفرة.
arabic-app/ ├── build/generate-audio.js # Piper batch from curriculum.json ├── server/index.js # helmet + routes, bind 127.0.0.1 ├── server/db.js # WAL + prepared stmts ├── public/js/{app,state,audioEngine,recorder,evaluator,srs,utils}.js ├── public/audio/ # L01-01.mp3 stems ├── public/images/ └── curriculum.json # meta.phases + lessons[].items # item types in schema: vocabulary | dialogue | minimal-pair | letter # dialogueFrame.A/B + substitutions[]; pairs[] for قَلْب / كَلْب
Bug-prevention checklist (all five groups)

Security: helmet; textContent only; validate user_id/lesson_id; prepared SQL; Node on 127.0.0.1; UFW 22/80/443; SSH key-only no root.

Stability: defer scripts; Utils.$ null checks; localStorage try/catch; API try/catch offline; feature-detect MediaRecorder + SpeechRecognition; handle play() reject; revoke object URLs; addEventListener not inline.

Arabic/RTL: html lang=ar dir=rtl; logical CSS; Cairo stack; no unicode-bidi hacks that break ligatures; tashkeel toggle without layout shift; translit/English dir=ltr.

Performance: pre-gen audio; local images; optional minify; loading=lazy; immutable audio cache; first load <500 KB excluding media.

A11y: aria-label; aria-live=polite; skip link; :focus-visible; contrast ≥4.5:1; Tab/Enter/Space.

أمن: helmet ونص آمن وSQL مجهّز ومنفذ داخلي. ثبات: كشف الميزات وtry/catch وإلغاء روابط الصوت. عربية: dir وخصائص منطقية وCairo. أداء: صوت مسبق وأقل من 500 ك.ب. إتاحة: تسميات وتركيز ظاهر وتباين 4.5.

LINUX SERVER INFRASTRUCTURE

04. Self-Hosted Linux Server Stack (generic homelab — not the Arabic UI) 04. حزمة خادم لينكس العامة (منصة استضافة — ليست واجهة العربية)

Arabic-learning-app.md · 1076 lines · title inside: “Best Free Self-Hosted Linux Server Stack”
This file is a generic VPS platform (Caddy, Portainer, AdGuard, Hugo, Filebrowser, DokuWiki, Maddy). It is not a phonetic-bootcamp spec. The old card only mentioned Docker + Kuma. Every category below is from the file. هذا الملف منصة خادم عامة وليس مواصفات المعسكر الصوتي. البطاقة القديمة ذكرت دوكر وكوما فقط. كل فئة أدناه من الملف.
CategoryPickRAMWhen not / alternative
Web / TLSCaddy single Go binary, ACME in-core, HTTP/320–50 MB (case 35 vs NPM 180)Nginx if weighted/canary proxy_pass; NPM if GUI required (150–200 MB, certbot flakes 2–3%/quarter)
ProxyCaddy over Traefik25–50Traefik only for Docker-label microservice discovery
DB defaultSQLite embedded10–50Postgres 200–500 when many writers / JSONB / RLS (Nextcloud, Ghost). Start SQLite; migrate when latency is measured. Umami case: 180 MB .db, <10 ms, stayed SQLite.
ContainersCompose + Portainer CEPortainer 50–80k8s rejected as heavy; Swarm “80% of k8s at 10% complexity”
MonitorUptime Kuma 50+ notify channels<100Netdata 200–300 + disk I/O; Monitorix <50 PNG-only
DNS adsAdGuard Home DoH/DoT/DoQ30–50Pi-hole 80–120 + PHP; use if you want gravity lists
CMSHugo static0 + CaddyGhost 200–300; WP 400–800. Case 650→40 MB, TTFB 800→60 ms
FilesFilebrowser30–50Nextcloud 1–3 GB if calendar/office. Default login admin/admin — change immediately
FirewallUFW → nftables0raw nftables for NAT; firewalld on RHEL
BackupBorg local (70–90% dedup) + Restic off-site AES10–20Both = 3-2-1. Cron 02:00 or 02:30. Keep 7/4/3 or 7/4/6
WikiDokuWiki flat files20–50BookStack 150–250 if shelves/chapters
MailMaddy one binary100–150Mailcow 2–4 GB. VPS IPs often blacklisted — may need a relay

Three synthesis dimensions

1) Light tools give 80–90% of features at 5–20% RAM (Go/C + SQLite vs PHP/Node + external DB). 2) Five services / two config types beat fifteen services / six types. 3) Everything under /data/ → one Restic command; RTO minutes not hours. Tension: SQLite single writer — migrate only when write latency appears.

الأدوات الخفيفة تعطي 80–90٪ من الميزات بـ 5–20٪ من الذاكرة. خمس خدمات خير من خمس عشرة. كل شيء تحت /data/. التوتر: كاتب واحد في SQLite.

Build plans in the same file

First plan ~105 min (harden 30, Docker 15, Caddy 15, services 20, backup 15, monitors 10) — note: it starts Caddy on network selfhost before creating that network. Second guide ~90 min adds Fail2Ban, compose YAML, first-run wizards (Portainer admin within 5 min or lock), TZ=Africa/Cairo on DokuWiki, idle ~300 MB for the platform alone.

خطتان: نحو 105 دقائق ونحو 90 مع Fail2Ban وCompose. المنصة وحدها ~300 ميجا خاملة.

DEEP TECHNICAL ANALYSIS

05. Deep Arabic App Analysis — same Linux stack as 04, plus hybrid app 05. التحليل العميق — نفس حزمة 04 ثم هجين التطبيق

deep Arabic app analysis and tips.md · 2315 lines · header typo: “depp Arabic app analysis…”
The previous hub card invented “phonetic bootcamp UI” as this file’s core. The file is the Linux guide plus a comparison and “Production-Grade Arabic Learning App on a Hardened Self-Hosted Stack.” Pedagogy lives in files 01, 07, 09 — not here. البطاقة السابقة اخترعت أن جوهر الملف هو المعسكر الصوتي. الملف هو دليل لينكس ثم مقارنة وهجين تطبيق على منصة مقوّاة.
What 05 adds after the shared 04 bodyماذا يضيف 05 بعد جسم 04 المشترك
  • Closer: full platform up in 90–120 minutes, all data under /data/, all traffic through Caddy.
  • Long references block (Reddit/selfhosted, Caddy vs NPM vs Traefik, Kuma, Portainer, Filebrowser, DokuWiki…).
  • Comparison table: “my previous answer” = generic infra; “pasted answer” = one Node+Piper app. Neither is better in the abstract — they answer different questions.
  • Where infra was stronger: UFW, Fail2Ban, SSH keys, Borg+Restic, Kuma, Compose, /data/, verify + budget.
  • Where the app paste was stronger: working product, SRS, phoneme scoring, HTML escaping, CSP, rate limits, STT correctness, threaded Piper, atomic writes, Arabic normalization, hard-phoneme set ع ح خ غ ق ص ض ط ظ.
  • Where both fell short: infra had no app; paste had no firewall/backups/monitoring, Node on :3000 public, no isolation, single VPS SPOF.
  • Hybrid: app code + infra rigor. Target Debian 12 / Ubuntu 22.04, 2 GB+, ~75 min. Dockerfiles: node:20-alpine + sqlite build tools; Python slim + piper-tts. Download ar_JO-kareem-medium. Backup script quiesces the app for a consistent SQLite snapshot. Smoke: curl /api/lessons, POST مرحبا to Piper, run backup.sh.
  • Hybrid idle RAM ~450 MB (Caddy 35 + Node 120 + Piper 200 + Kuma 80). Docker restart replaces PM2 (~30 MB saved). Isolated rebuild: compose down && up --build in ~2 minutes on a new VPS.
بعد دليل لينكس: مراجع طويلة، مقارنة بين إجابة البنية وإجابة التطبيق، ثم هجين يجمع الشيفرة مع الجدار والنسخ والمراقبة. بايبر كحاوية. الذاكرة الخاملة نحو 450 ميجا. إعادة البناء من المصدر في نحو دقيقتين.

Hybrid extras

node:20-alpine + g++ sqlite piper-tts container :5002 Quiesce SQLite then Borg No public :3000 ~450 MB idle compose rebuild ~2 min
OPUS-LABELED COPY

06. “by opus” file — byte-identical to 05 except the title line 06. ملف «أوبوس» — مطابق لـ 05 ما عدا سطر العنوان

deep Arabic app analysis and tips by opus.md · 2315 lines · 2 differing lines (filename + underline)
Do not treat this as a second expert passلا تعامل هذا كتمريرة خبير ثانية
cmp/diff: only the header title differs. The old hub invented “audio buffer pre-fetch” and “RTL unicode-bidi guardrails” as Opus-only findings — those sentences are not in this file. They belong to the teaching/web-app specs (07–09) and Kimi’s RTL checklist.
  • Use card 05 for the hybrid content. Use this card as a duplicate warning so you do not maintain two sources.
  • If you keep both on disk, treat 06 as an alias of 05, not as extra architecture.
  • Real Opus-family refinements live in claude-Arabic-app-stack.md / Unified Build Guide (Tier 0–3, hard-sounds table, Web Speech caveat) — those are sibling files, not this duplicate.
الملفان 05 و06 متطابقان تقريباً. البطاقة القديمة اخترعت توصيات أوبوس غير موجودة هنا. اعتبر 06 اسماً ثانياً لـ 05. التحسينات الحقيقية لأوبوس/كلود في أدلة المستوى 0–3 لا في هذه النسخة المكررة.
3-QUESTIONS MASTER DUMP

07. Long answer to the 3 questions (all models, including both Qwens) 07. الإجابة الطويلة على الأسئلة الثلاثة (كل النماذج بما فيها كوين)

long Answer about Arabic 3 questions.md · 5495 lines · Deepseek → Kimi → Qwen#1 → Gemini → Z-ai → Qwen#2 + starter HTML
The three questions this file concatenatesالأسئلة الثلاثة التي يجمعها الملف
  • Q1 Teaching: CLT/TBLT, phonetic bootcamp (2–3 sessions, قلب/كلب), shadowing 5–7 words, chorusing, dialogue skeleton, TPR (Qwen), Krashen i+1 (Qwen), phased script (Kimi — week-2 dropout), 80/20 (100 words ≈ 50% of speech), diglossia (dialect speak / MSA read), delayed correction, fluency lines 60s, silent period 20–30 h, Alif Baa then Al-Kitaab (Gemini).
  • Q1 Assess: record 1–5, functional success, timed ما هذا؟, error/min, ACTFL Can-Do, portfolio wk 1/4/8, exit tickets, OPIc 5–10 min, IPA, OPI Level Checks + Probes (Gemini), STT+Levenshtein bands >90/70–89/<70, Z-ai weights 0.4/0.25/0.2/0.15, SM-2.
  • Q2 Images: LLM cannot screenshot. Real pixels via <img>, Unsplash/Pexels/GCS/Bing, Wikimedia (Qwen), getUserMedia camera, Playwright networkidle full-page, VNC framebuffer (Gemini), ReAct+VLM (Gemini), RAG image DB (Kimi). Limits: copyright, +1–3 s, verify URL, CORS, no auth bypass.
  • Q3 App: vanilla ES2022 (most) or Vite-without-React (Gemini). Dual MP3+OGG. PWA named by Kimi. Hash routes. localStorage schema_version. Qwen fail-3× → show transliteration. HTTPS required.
سؤال التعليم يجمع كل الطرق من المعسكر الصوتي حتى الصمت 20–30 ساعة. سؤال الصور: النموذج لا يلتقط الشاشة؛ الموقع يجلب صوراً حقيقية. سؤال التطبيق: واجهة مجردة، صوت مزدوج، PWA عند كيمي، فشل ثلاث مرات يظهر النقل عند كوين.
Recording / eval / TTS facts (including a real conflict)

Deepseek precise path: 48 kHz mono, echoCancellation/noiseSuppression/autoGainControl false, raw PCM AudioWorklet → WAV. Clip if peak >0.99; silence if RMS low >2 s; SNR on lead-in.

Z-ai conflict: 44.1 kHz, echo/NS/AGC true, MediaRecorder opus, max 30 s. Do not mix this with the “raw studio” spec.

Eval A: Azure Pronunciation ar-SA/EG (~$1/1k) — rejected for our free rec. B: Meyda 13 MFCC + ع band 50–150 Hz if low/total >0.25. C: ELSA/SpeechAce not viable for Arabic. IQRA 2026 F1 just over 0.72 for MSA mispronunciation.

TTS: Human 48k/24-bit gold; else Chirp 3 / Azure Hamed|Zariyah / Polly Zeina — always diacritize (Farasa/mishkal). Piper is the self-host tier. Long vowels 1.5–2× short; ق must not become ء or /g/ unless dialect.

مسار ديبسيك: 48 كيلوهرتز بلا إلغاء صدى. زي-آي يعارض: 44.1 مع معالجة المتصفح. لا تخلطهما. تقييم أزور مدفوع؛ مييدا مجاني. بايبر هو طبقة الاستضافة الذاتية. شكّل النص دائماً.

If a method fails (union)

ع won’t come out → hand on throat / mirror. Long shadowing → back-chain from last word. Mechanical drills → picture narration. Mic anxiety → choral fade. Rhythm-deaf → clap / colour stress. Grammar fog → TPR (Qwen) or explicit rules first (Gemini — opposite). MSA feels fake → Egyptian/Levantine speak. Diglossia overload → Gemini says pause dialect and decode MSA (also opposite). Motivation → Spacetoon / lyrics / races.

بدائل الفشل متناقضة أحياناً بين كوين (أسقط النحو) وجيميني (صرّح بالقاعدة) — الملف يحفظ الاتجاهين.

Safari / a11y from this dump

Deepseek: Safari has no SpeechRecognition. playsinline, tap-to-play, viewport meta, revoke URLs, stop tracks on leave. Gemini: logical CSS table, Noto for لا, Arabic +4pt, Cypress visual threshold 0.001. Kimi: test system font 200%, offline SW, Android rotate.

سفاري بلا تعرف كلام. نوتو لربط لا. اختبر خط النظام 200٪ والدوران والعمل بلا نت.

SAME DUMP MINUS TAIL

08. “Without Qwen” — filename is wrong; only Qwen#2 + starter are missing 08. «بدون كوين» — الاسم خاطئ؛ الناقص كوين#2 والبادئ فقط

long Answer about Arabic 3 questions without qwen.md · ~4910 lines · Qwen#1 (988–1110) is still inside
Delta vs file 07 (verified by full read)الفرق عن الملف 07 (بعد قراءة كاملة)
Deepseek, Kimi, first Qwen, Gemini, and the huge Z-ai ALP block are identical. Missing only:
  • Qwen#2 (07 lines 4910–5033) — near-duplicate of Qwen#1.
  • Qwen starter trio (07 lines 5036–5495): index.html lang=ar dir=rtl + Cairo; style.css max-width 450px; script.js vocab قَهْوَة / كِتَاب / مَاء / شُكْرًا; Unsplash or loremflickr; STT ar-SA interimResults=false maxAlternatives=1; strip tashkeel /[\u064B-\u065F\u0670]/ so قَهْوَة ≡ قهوة; localStorage.arabicMastered; “do not file://” — use Live Server or python -m http.server.
No extra frontend-task spec, no extra diacritic-preservation chapter, no extra noisy-room algorithm beyond the shared Deepseek/Kimi/Z-ai text. Z-ai’s ALP (auth, badges, JWT, Docker FE:3000/BE:5000) is in both files.
الفرق الحقيقي: ينقص تكرار كوين الثاني وملفات البداية الثلاثة. كوين الأول ما زال داخل الملف. لا توجد فصول إضافية عن الضوضاء أو حفظ التشكيل غير ما هو مشترك.
CONSOLIDATED MANUAL

09. Consolidated Guide (merged, condensed reference) 09. الدليل الموحد (مرجع مدمج ومكثّف)

Consolidated_Guide_Arabic_Teaching_WebApp.md · 174 lines · (DOCX twin named on the old card)
Six sections — all of themستة أقسام — كلها
Opening frame: script (cursive RTL, positional shapes) + phonology (ع ح ق + emphatics) + diglossia. All three must be taught without killing motivation.
  • 1.1 Methods: CLT+TBLT tasks; phonetic bootcamp 2–3 sessions; shadowing then chorusing; dialogue skeleton; comprehensible input + forced output; TPR; SRS/Anki (100 words ≈ 50%).
  • 1.2 Phased script: W1–2 speak only (MSA or Egyptian/Levantine); W3–4 connected letters; W5–8 integrate.
  • 1.3 Assess: formative (record 1–5, functional success, timed ما هذا؟, Can-Do, portfolio, exit ticket) + summative (OPI/OPIc, IPA, error/min).
  • 1.4 Fail table: tactile ع; back-chain; picture narration; choral for anxiety; clap rhythm; drop grammar→TPR; dialect speak / MSA read; gamify; if diglossia overloads, pause dialect and decode MSA; if inductive fails, go deductive.
  • 2 Images: AI is text-only; retrieve via search APIs, raw <img>, Playwright screenshot, ReAct loop, RAG DB, getUserMedia. Limits: copyright, 1–3 s, hallucination, CORS, no auth bypass.
  • 3 App: vanilla + optional Vite/ESLint/Prettier; Unsplash/Pexels + Web Speech + cloud TTS (this guide still lists paid TTS — later stack files override); localStorage versioning. Modular css/ + js/modules. Feature table with anti-bug column. Arabic extras: tashkeel toggle, SVG stroke order, root highlighter.
  • 3.5 Bugs: XSS textContent; schema migrate; hash routes; no autoplay; logical CSS; validate JSON; revoke URLs; one MediaRecorder; iOS playsinline + no STT; safe text helper.
  • 4 Record/eval: raw 48 kHz, processing off, WAV; clip/silence/SNR; table Cloud vs MFCC vs Hybrid; Azure/SpeechSuper for Arabic; ELSA/SpeechAce no; add 50–150 Hz ع check because MFCC misses ayn vs hamza.
  • 5 Audio sources: human VO gold; cloud neural; browser TTS; Piper/VITS; Common Voice / MGB-2 / Halabi. Hybrid: pre-gen static + human core + browser for typed text. Always diacritize. Linguist checks emphatics, ق, long vowels, pharyngeals.
  • 6 Action table: teach now; assess week 2+; images phase 3; raw record phase 2; hybrid eval 3–4; TTS phases 1–2; vanilla foundation throughout.
الإطار: الخط والصوتيات والازدواجية معاً. ستة أقسام تغطي الطرق والمراحل والقياس والبدائل والصور وخطة التطبيق ومنع الأخطاء والتسجيل ومصادر الصوت وخطة العمل. ما زال يذكر TTS سحابياً — ملفات الحزمة اللاحقة تستبدله بـ Piper.
MONICA AI PDF

10. Monica 4.5 Haiku consolidation (11 pages) 10. تجميع مونيكا 4.5 هايكو (11 صفحة)

Arabic Learning Content Consolidation - Monica AI Chat.pdf · 608 KB · shareId lE8qoK1H5EuA14Fc · 6/8/26
What the PDF actually contains (OCR is noisy; this is the intended content)محتوى الـ PDF الفعلي (التعرف الضوئي مشوش؛ هذا المقصود)
Short merge of the long multi-model answer. It is the only source that requires a Service Worker.
  • Methods: CLT tasks, TBLT role-play, comprehensible input, shadowing, SRS (80%+ at 30 days), TPR.
  • Speaking: phonetic bootcamp ع ح خ ق غ + ص ض ط ظ with mouth guides; record-compare; fluency pairs every 60 s; 80/20 greetings/pronouns/verbs.
  • Assess: ACTFL Can-Do, audio portfolio, exit tickets; OPIc 5–10 min; IPA (read→listen→respond); functional success.
  • Fallbacks: grammar fog → TPR; MSA fake → Egyptian/Levantine speak + MSA read; low motivation → cartoons/lyrics; anxiety → 20–30 h silent period; plateau → explicit phoneme drill.
  • Images: Unsplash/Pexels/GCS; Playwright; getUserMedia. Best practice in this PDF: Unsplash + loremflickr/placeholder — later guides reject live Unsplash.
  • Monica stack (later rejected): vanilla JS, Netlify/Vercel, localStorage or Firebase/Mongo, live Unsplash, Chirp 3 ar-XA to a CDN.
  • 6 weeks: W1 git/folders/ESLint; W2 RTL + Cairo CDN + logical CSS; W3–4 SM-2, images, audio, STT, Levenshtein; W5 QA (strict, no var, mic-denied, 3G); W6 minify, images <200 KB initial, HTTPS, Service Worker, load <3 s.
  • Eval tiers: Azure $1/1k 2–3 s · Meyda free <500 ms · Web Speech+Levenshtein free <1 s.
  • KPIs: load <3 s (retention −50% at 3 s); pronunciation >80% at 30 days; session >15 min; 7-day return >40%; vocab retention >80% at 30 days. No 5-minute micro-lesson number in the PDF.
  • Deploy checklist: HTTPS (required for Speech), SW offline, Lighthouse >90, iOS/Android, RTL on small screens, mic permission, Sentry (paid — skip), progress backup, GDPR if EU.
  • Starter: قهوة / كتاب; strip harakat then exact match; “browser doesn’t support speech recognition” alert — too blunt vs our recommended fallback UI.
تجميع قصير وهو المصدر الوحيد الذي يفرض Service Worker. يذكر نتلايفاي وFirebase وChirp وUnsplash الحيّ — الأدلة اللاحقة ترفضها. مؤشرات: تحميل أقل من 3 ثوان، دقة نطق أعلى من 80٪ بعد 30 يوماً، جلسة أطول من 15 دقيقة، عودة 40٪ خلال أسبوع. لا يوجد في الـ PDF رقم «درس 5 دقائق».

Keep from Monica / drop from Monica

Keep: Service Worker Keep: Lighthouse >90 Keep: <3s / KPIs Keep: vanilla + RTL + Cairo Drop: Netlify / Vercel Drop: Firebase / Mongo Drop: live Unsplash key Drop: Chirp 3 billed TTS Drop: Sentry