notes.addict.bestTOURISM VPS
← Notes Hub← الفهرس

Free / self-hosted stack on your VPS — organized notes الحزمة المجانية والمستضافة ذاتيًا على VPS — ملاحظات منظّمة

Three original chat answers are kept intact below. Four later spec files (recommended stack, shared infra, unified audit, translator build plan) are now also on this page — they correct Nginx→Caddy, public LibreTranslate ports, and the 50k-user claim. The green box is the ship-first plan using the VPS and Caddy you already have. الإجابات الثلاث الأصلية محفوظة كما هي. أُضيفت أربعة ملفات مواصفات لاحقة تصحّح Nginx إلى Caddy، ومنافذ LibreTranslate العامة، وادعاء ٥٠ ألف مستخدم. الصندوق الأخضر هو خطة الشحن الأولى باستخدام الخادم وCaddy الموجودين لديك.

3 chat notes + 4 later specs EN + AR Caddy · PWA · LibreTranslate internal Honest 2–5K, not 50K

https://notes.addict.best/tourism-vps-stack/

RECOMMENDED — TIPS + TASK PLAN

00. Ship-first free stack (your VPS + Caddy + AI agents) 00. حزمة الشحن الأولى المجانية (خادمك + Caddy + الوكلاء)

Merged from the 3 chats below + RECOMMENDED-STACK-AND-FEATURES.md + BUILD-00 + UNIFIED + BUILD-01 + Gemini/Grok master stack. Later files override the chats where they conflict.

Verdict: PWA translator first. Caddy you already run. Browser speech. LibreTranslate internal only. No Nginx, no Meilisearch, no Whisper on the same box, no Coolify. القرار: مترجم PWA أولاً. Caddy الموجود. كلام المتصفح. LibreTranslate داخلي فقط. بلا Nginx وبلا Meilisearch وبلا Whisper على نفس الصندوق وبلا Coolify.

The three chat answers keep the layers (front, API, DB, cache, search, translate, speech, CDN). They still recommend Nginx + Certbot + Coolify + Postgres+Redis+Meilisearch+Strapi on day one, and Source 3 even prefers Google/Azure free tiers. Your later specs (July 28+) already chose Caddy, bind 127.0.0.1 / expose not publish, LT_DISABLE_WEB_UI, and an honest concurrency ceiling of 2–5K (not Gemini’s 50K). You already have Caddy, domains, and agents. Ship the smallest app that proves speech+translate, then add Egypt/Mom. الإجابات الثلاث تحفظ الطبقات لكنها ما زالت تقترح Nginx وCoolify وPostgres+Redis+Meilisearch من اليوم الأول. المواصفات اللاحقة اختارت Caddy ومنفذاً داخلياً وسقفاً صادقاً ٢–٥ آلاف اتصال لا ٥٠ ألفاً. اشحن أصغر تطبيق يثبت الكلام والترجمة ثم أضف مصر والأمومة.

Chosen stack (v1 tourism translator)الحزمة المختارة (مترجم السياحة الإصدار 1)
LayerChoiceWhy / tip
EdgeCaddy 2 (already on your VPS)Auto-HTTPS, HTTP/3, Brotli. Chats say Nginx+Certbot — skip. Do not rewrite other Caddy hosts.
AppNext.js standalone PWA or vanilla/Preact staticOne codebase = web + installable. Grok: Flutter/RN day one is banned.
STT / TTSWeb Speech API in the browser0 VPS CPU. Text box always visible (Firefox). iOS: short phrases, no continuous mode.
Text MTLibreTranslate Docker, 127.0.0.1:5000 onlyLT_DISABLE_WEB_UI=true, LT_LOAD_ONLY=en,ar,zh,ja,ko,id,ru,fr. UNIFIED: ~2.5 GB if many langs; BUILD-00: 1–2 GB. Gemini’s “<200 MB idle” is wrong — do not plan RAM on that number.
OCRTesseract.js in the browserNo audio/image upload to the VPS on free tier.
OfflineService Worker + region phrase JSONAirplane mode must work before you claim offline. INCONCLUSIVE ≠ shipped.
DB v1None (stateless) / localStorageSQLite later for history. Postgres+PostGIS only when Egypt scam map ships.
Search / CMSSkip Meilisearch, Strapi, Payload, DirectusChat 1/2 want them day one. Translator does not. Add Meilisearch only on ≥4 GB after real search need.
CacheCaddy Cache-Control + optional Redis laterChat Redis is fine later for top-100 country queries — not for MVP translate.
CDNCloudflare free in front of Caddy (optional)Keep if you want to hide the VPS IP. Caddy still does TLS if you skip CF.
MonitorUptime Kuma ~30 MB + docker json-file logsUNIFIED: Loki/Grafana 500 MB–1 GB violates “not heavy”. Rotate 10m×3.
BackupNightly script + off-box copyBUILD-00: one missing cron = total loss. SQLite .backup; Postgres pg_dump. Test restore monthly.
AgentsWrite phrase JSON, cultural notes, diacritics, k6, RTL QANo paid API required inside the running app.

v1 tags

Caddy file_server / reverse_proxy PWA + SW Web Speech LibreTranslate internal Tesseract.js Phrasebook JSON 60 req/min /api/translate /healthz /readyz No Nginx / Certbot / Coolify No public :5000 / :5432 No Whisper/Piper on app VPS No Meilisearch day one No Grafana
Conflicts the later files already settledتعارضات حسمتها الملفات اللاحقة
Chat saidLater spec / this rec
Nginx + Certbot + Coolify/CapRoverCaddy you already run. No extra PaaS.
Postgres + Redis + Meilisearch + Strapi on day 1Stateless translator first. Postgres when Egypt map exists.
Source 3: Option B Google/Azure free tiers firstOK as a quality flag later. Default path A: Web Speech + LibreTranslate (Grok/BUILD-01). Azure 5 speech hours ≠ product volume.
Gemini: 50,000 concurrent / LT <200 MBBUILD-01: 2–5K with quality. LT 1–2.5 GB. Prove with k6, do not advertise 50K.
Publish LT / Postgres portsUNIFIED bug #6: expose only, 127.0.0.1, no web UI.
faster-whisper / Piper on the same 4 GB boxNever next to 4 apps. Split LT when QPS > 5 sustained (BUILD-00).
Task plan (lowest risk)خطة المهام (أقل مخاطرة)
WhenTasksDone when
Days 1–2Caddy site block for translate.*; docker-compose.shared: LT internal + optional Kuma. UFW 80/443 only. Secrets in env, not in git.curl /healthz 200; LT not reachable from the public internet.
Days 3–9Translator MVP: split-screen, text fallback, 8 langs, SW phrasebook, Tesseract OCR, rate limit 60/min, cultural tooltip JSON.First translation <2 s. Egypt pack works in airplane mode on one Android + one iPhone.
Day 10k6 script from BUILD-01. Measure p95 at 500 → 1000 VUs.If p95 >1 s at 1K → move LT to a second VPS. Do not raise the public claim.
Weeks 3–4Uptime Kuma on /healthz + /readyz. Backup cron. Feature-detect Speech → type-in.Alert on 2 failures. Restore drill once.
Weeks 5–7Egypt MVP only if translator DAU exists: scam MD, fair price, phrase embed, Leaflet+OSM. PostGIS then — not before.Offline map pack + official gov links only for visa/price.
LaterWebRTC group room (P1). Region packs $0.99. GPT-4o-mini behind paywall. Never Coqui XTTS on the shared 15 GB fleet (~8 GB alone).P1 only after MVP metrics. XTTS needs its own GPU box.

Browser / phone tipsنصائح المتصفح والهاتف

Chrome/Android: full STT. iOS Safari: limited STT, 60 s timeout — advertise text-first. Firefox: no SpeechRecognition. PWA: Add to Home Screen. Always HTTPS (Caddy). Never autoplay speech.

RAM budget (honest)ميزانية الذاكرة (صادقة)

Caddy ~30 MB. Next app ~150–250 MB. LibreTranslate 1–2.5 GB (heaviest). Kuma ~30 MB. 4 GB VPS = translator + LT only. 8 GB if you add Egypt+Postgres. UNIFIED 15 GB fleet total ~3.6 GB used if you do not start Whisper.

Safety / ethicsسلامة وأخلاق

Grok golden rules: official gov links for visas; never override scam warnings for affiliate money; rate-limit translate before launch day; medical content stays in Mom apps with disclaimer — not in the translator.

What not to build yetما لا تبنه الآن

K8s, Grafana, Clerk paid, Firebase, Google Maps, server Whisper, public LT UI, CMS, Meilisearch, Coolify, voice cloning. Upgrade only on measured trigger (CPU >70% 10 min, LT QPS >5, complaint rate >5%).

Source 1

No, the stack is not exactly the same لا، الحزمة ليست نفسها تمامًا

First answer + the Arabic explanation that came with it (reasons and details). Kept verbatim. Rec §00 overrides Nginx/Coolify/Meilisearch-on-day-1.الإجابة الأولى + الشرح العربي كما هما. التوصية 00 تستبدل Nginx وCoolify وMeilisearch في اليوم الأول.

The architecture and principles stay almost identical (Next.js + Postgres + Redis + caching + ISR-style pages + Cloudflare + atomic notes + pre-translated content), but we replace the managed/paid services with self-hosted or free-tier alternatives so your ongoing cost stays near zero (only the VPS itself).

Free / Self-Hosted Stack (Recommended for Your VPS)

LayerFree / VPS VersionNotes / Trade-offs
HostingYour VPS + Nginx + Docker Compose + Cloudflare freeCloudflare free still gives you excellent CDN, SSL, WAF, and caching
Frontend + APINext.js 15 (App Router) + TypeScript + Tailwind + next-intlSame as before – runs perfectly on a VPS
DatabaseSelf-hosted PostgreSQL (Docker)Easy, free, full control
CacheSelf-hosted Redis (Docker)Same role as before
SearchSelf-hosted Meilisearch (official Docker image)Fast, free, excellent multilingual support
CMS / AdminSelf-hosted Strapi, PayloadCMS, Directus, or simple custom adminFree and powerful
Text TranslationLibreTranslate (self-hosted) or Google/Azure free tiers + aggressive Redis cachingLibreTranslate is 100% free but quality is lower than Google, especially for nuanced customs/etiquette. Prefer Google free quota + heavy caching for better results.
Speech (STT + TTS)Browser Web Speech API (primary) + optional self-hosted Whisper.cpp + Piper/Coqui TTSCompletely free. Quality and language support (especially Urdu, Indonesian, Malay, Arabic accents) is weaker than cloud APIs. Clear text fallback is essential.
CDN / ProtectionCloudflare free planKeep this – it is one of the best free tools available
MonitoringUptime Kuma (self-hosted) + basic logsFree

How to Run It on Your VPS (Easiest Practical Way)

  1. Use Docker Compose with services: next-app, postgres, redis, meilisearch, libretranslate (optional), nginx.
  2. Put Cloudflare free in front (DNS + proxy + caching rules).
  3. Use Let's Encrypt (free SSL) via Certbot or Cloudflare.
  4. Deploy with a simple script or tools like Coolify / CapRover if you want an easier “self-hosted Vercel-like” experience.

Important Trade-offs (Be Honest)

  • Translation quality: Lower if you stay 100% free with LibreTranslate. Google free tier (500k characters/month) + Redis caching is usually the better practical choice.
  • Speech quality: Noticeably weaker with only browser Web Speech API. Real-time conversation mode will feel less smooth.
  • Operations: You are responsible for updates, backups, security patches, and monitoring. A small VPS can handle moderate traffic, but high concurrent users will require a stronger VPS (recommend at least 4–8 GB RAM).
  • Scaling: Vertical (bigger VPS) or later add more servers. Not as automatic as Vercel.
  • Data & content strategy: Stays exactly the same (Wikivoyage + official sources + human review + confidence scores).

Recommended Free Path

Start with this hybrid free approach (best balance):

  • Self-host everything possible on your VPS (Next.js, Postgres, Redis, Meilisearch).
  • Use Cloudflare free.
  • Use Google Cloud Translation free tier + aggressive Redis caching for text.
  • Use Browser Web Speech API for speech MVP.
  • Later migrate pure self-hosted translation/speech if free quotas become a problem.

This keeps the same clean architecture we recommended before, just without monthly cloud bills.

Would you like: 1) A ready Docker Compose example for this free stack? 2) The bilingual (English + Arabic) refined free version? 3) Specific VPS size recommendations?

التغيير الجوهري في هذا الإجراء ليس في المعمارية الهندسيّة للتطبيق (التي تظل كما هي)، بل في مزودي الخدمات؛ حيث يتم استبدال المنصات السحابية المدارة المدفوعة (مثل Vercel وSupabase وAlgolia) ببدائل مفتوحة المصدر تُستضاف ذاتيًا (Self-Hosted) عبر Docker على خادمك الخاص (VPS)، لخفض التكلفة إلى الصفر تقريبًا.

المعمارية والمبادئ تبقى شبه متطابقة (Next.js + Postgres + Redis + تخزين مؤقت + صفحات بأسلوب ISR + Cloudflare + ملاحظات ذرّية + محتوى مترجم مسبقًا). السبب: الأدوات المدفوعة ليست شرط المعمارية؛ المعمارية هي الطبقات (واجهة، API، قاعدة، كاش، بحث، ترجمة، كلام، CDN، مراقبة). التفاصيل: تستبدل الطبقة لا الشكل.

مكونات الحزمة المجانية والبدائل المستضافة ذاتيًا

الطبقة (Layer)البديل المجاني على الـ VPSسبب الاختيار والبديل الشائع
الاستضافة (Hosting)VPS + Nginx + Docker Compose + Cloudflare Freeيوفر بيئة معزولة لإدارة التطبيقات بسهولة مع شبكة CDN وحماية مجانية من Cloudflare.
الواجهة والأنظمة (Frontend/API)Next.js 15 (App Router) + TypeScript + Tailwindنفس الإطار البرمجي الأصلي؛ ويعمل بكفاءة عالية على خادم VPS محلي.
قاعدة البيانات (Database)PostgreSQL (عبر Docker)بديل مباشر لخدمات Supabase/Neon المدفوعة؛ يمنحك تحكمًا كاملاً وبدون قيود بيانات.
التخزين المؤقت (Cache)Redis (عبر Docker)يُستخدم للتقليل من استعلامات قاعدة البيانات وتسريع استجابة الترجمات والصفحات.
محرك البحث (Search)Meilisearch (عبر Docker)بديل مجاني وسريع جدًا لـ Algolia، ويدعم البحث باللغة العربية ولغات متعددة بكفاءة.
إدارة المحتوى (CMS)Strapi أو PayloadCMS أو Directusلوحات تحكم مفتوحة المصدر ومجانية ومصممة للربط المباشر مع واجهات البرمجة (APIs).
الترجمة النصية (Translation)Google Cloud Translate (الحد المجاني) أو LibreTranslateLibreTranslate مجاني 100% لكن جودته أقل. الخيار الأفضل هو دمج حصة Google المجانية (500 ألف حرف/شهريًا) مع تخزين الإجابات مؤقتًا في Redis.
معالجة الصوت (STT / TTS)Web Speech API في المتصفح + Whisper.cpp (اختياري)استغلال قدرات متصفح المستخدم مجانًا دون الحاجة لاستهلاك معالج الـ VPS في تحويل الصوت إلى نص أو العكس.
شبكة التوزيع والحماية (CDN)Cloudflare (الباقة المجانية)توفر شهادات أمان SSL، وحماية من هجمات DDoS، وتخزينًا مؤقتًا للملفات الثابتة عالميًا.
المراقبة (Monitoring)Uptime Kuma (عبر Docker)أداة مفتوحة المصدر لمتابعة حالة الخادم والتطبيق وإرسال تنبيهات عند حدوث أعطال.

كيف تشغّله على VPS (الطريقة العملية الأسهل)

  1. استخدم Docker Compose بالخدمات: next-app وpostgres وredis وmeilisearch وlibretranslate (اختياري) وnginx.
  2. ضع Cloudflare المجاني في الأمام (DNS + بروكسي + قواعد كاش).
  3. استخدم Let's Encrypt (SSL مجاني) عبر Certbot أو Cloudflare.
  4. انشر بسكربت بسيط أو أدوات مثل Coolify / CapRover إن أردت تجربة أقرب إلى Vercel مستضافة ذاتيًا.

التنازلات والحدود المتوقعة (Trade-offs)

  • جودة الترجمة والصوت: المحركات المجانية بالكامل مثل LibreTranslate أو أدوات المتصفح الصوتية أقل دقة في التعامل مع السياقات اللغوية المعقدة واللهجات العربية مقارنة بنماذج الذكاء الاصطناعي المدفوعة (مثل OpenAI أو Google Cloud API).
  • إدارة العمليات التشغيلية (DevOps): تصبح أنت المسؤول الكامل عن أمان الخادم، وأخذ النسخ الاحتياطية (Backups)، وتحديث الحزم، وإصلاح المشاكل الفنية عند توقف إحدى الخدمات.
  • التوسع والتدرج (Scaling): لا يتم زيادة الموارد تلقائيًا كما في Vercel. للتوسع، ستلجأ للترقية العمودية (زيادة مواصفات الـ VPS) أو إضافة خوادم أخرى يدويًا.
  • جودة الكلام: أضعف بوضوح مع Web Speech API وحده. وضع المحادثة اللحظية سيكون أقل سلاسة.
  • استراتيجية البيانات والمحتوى: تبقى كما هي تمامًا (Wikivoyage + مصادر رسمية + مراجعة بشرية + درجات ثقة).
  • VPS صغير يكفي لحركة متوسطة؛ الحركة العالية تحتاج 4–8 جيجابايت رام على الأقل.

الخطة الهجينة الموصى بها (Hybrid Approach)

أفضل موازنة بين الجودة والتكلفة الصفرية هي:

  • استضافة (Next.js, Postgres, Redis, Meilisearch) على الـ VPS باستخدام Docker Compose.
  • استخدام Google Translate Free Tier مع ربطه بـ Redis لتخزين الترجمات السابقة وتجنب استهلاك الحصة المجانية بسرعة.
  • الاعتماد على Web Speech API في متصفح المستخدم كخيار أساسي للصوت.
  • لاحقًا انتقل إلى ترجمة/كلام مستضاف ذاتيًا بالكامل إن نفدت الحصص المجانية.

هذا يُبقي نفس المعمارية النظيفة السابقة، بلا فواتير سحابية شهرية. السبب: الحصص المجانية من Google تعطي جودة أعلى من LibreTranslate في العادات والآداب الدقيقة، والكاش في Redis يمنع حرق الحصة.

Source 2 · Kimi

No — the concepts stay the same, but the tools must change لا — المفاهيم تبقى، والأدوات يجب أن تتغيّر

Kimi English answer + Kimi Arabic (including natural-language explanations of Compose and Nginx).إجابة كيمي بالإنجليزية + العربية (بما فيها شرح Compose وNginx بلغة طبيعية).

When you move from managed platforms (Vercel, Supabase, paid APIs) to your own VPS, you trade convenience for cost control. You now do the DevOps, but your monthly bill drops to essentially zero (just the VPS you already have).

1. The Free/Self-Hosted Stack

LayerManaged Stack (Before)Your VPS Stack (Free)Why the Change
FrontendNext.js on VercelNext.js (static export) or React + Vite served by NginxVercel is paid/convenient; Nginx on your VPS is free and faster for static content
Reverse Proxy / SSLVercel handles itNginx + Let's Encrypt (Certbot)Industry standard, completely free
CDN / WAFVercel EdgeCloudflare Free PlanGenuine free tier with global caching + DDoS protection
Backend APINext.js API RoutesFastify (Node.js) or FastAPI (Python) in DockerLightweight, runs anywhere, easier to debug on VPS
DatabaseSupabase / NeonPostgreSQL (self-hosted in Docker)Full control, no row limits
CacheUpstash RedisRedis (self-hosted in Docker)Zero cost, unlimited
SearchAlgolia / paid Meilisearch CloudMeilisearch (self-hosted in Docker)Open-source, runs perfectly in Docker, no per-search fees
Process ManagerVercel auto-scalingPM2 (for Node) or systemdKeeps your API alive if it crashes
ContainersServerless functionsDocker ComposeOrchestrates Postgres + Redis + Meilisearch + API on one machine
Text TranslationGoogle Cloud Translation ($$$)LibreTranslate (self-hosted) + Azure Translator free tier as backupLibreTranslate is open-source NMT; Azure gives 2M chars/month free
Speech-to-TextWhisper API ($$$)Browser Web Speech API (client-side, free) + self-hosted faster-whisper (CPU)Browser API costs nothing; self-hosted Whisper is slow on CPU but works
Text-to-SpeechGoogle TTS / ElevenLabs ($$$)Browser SpeechSynthesis (free) or Coqui TTS (self-hosted)Browser voices are instant and free
MonitoringVercel Analytics / SentryUptime Kuma + Nginx access logsFree, self-hosted status pages

2. What Stays the Same

  • Next.js still works, but you will likely use output: 'export' to generate static HTML/JS and let Nginx serve it. This is much faster than running a Node.js server for content pages.
  • PostgreSQL + Redis + Meilisearch architecture remains identical — you just run them in Docker instead of paying for managed instances.
  • Content strategy (atomic notes, editorial workflow, i18n routing) is unchanged.
  • Cloudflare sits in front of your VPS to cache pages globally and absorb traffic spikes.

3. What Changes Radically: Translation

This is the hardest part to do for free. Neural translation and speech recognition are compute-heavy.

Text Translation (Free Options)

OptionCostQualityBest For
LibreTranslate (self-hosted Docker)$0Fair-Good for major languagesCommon phrases, menu items, basic communication
Argos Translate (LibreTranslate backend)$0FairSame as above
Azure Translator2M characters/month freeExcellentSafety-critical notes, customs, legal info
DeepL Free API500k chars/monthExcellentEuropean/Japanese/Chinese (but missing Malay, Indonesian, Urdu)

My recommendation:

  • Run LibreTranslate on your VPS for instant chat/phrase translation (unlimited, no rate limits).
  • Use Azure Translator free tier for pre-translating your curated country notes (2M chars/month is enough for steady content updates).
  • For Arabic↔Japanese/Korean/Urdu, LibreTranslate is usable but not perfect. Have a disclaimer: "Community-powered translation — verify critical info."

Speech Translation (Free Options)

OptionCostLatencyQuality
Browser Web Speech API$0InstantInconsistent across devices; good for English/Arabic/Japanese, poor for Urdu/Indonesian
Self-hosted faster-whisper (CPU)$0Slow (2-5x real-time on VPS CPU)Excellent accuracy
Azure Speech STT free tier5 audio hours/monthFastProduction-grade

My recommendation for a free app:

  • Phase 1: Use the Browser Web Speech API entirely. It runs on the user's phone, costs you nothing, and requires zero backend infrastructure. Add a big microphone button.
  • Phase 2: If quality complaints arise, proxy audio to your VPS running faster-whisper (small model) as a fallback. Warn users it takes 2-3 seconds.

4. Docker Compose for Your VPS

This single file runs your entire backend on one VPS:

# docker-compose.yml
version: '3.8'

services:
  postgres:
    image: postgres:16-alpine
    restart: always
    environment:
      POSTGRES_USER: tourism
      POSTGRES_PASSWORD: your_secure_password
      POSTGRES_DB: tourism_db
    volumes:
      - pgdata:/var/lib/postgresql/data
    ports:
      - "127.0.0.1:5432:5432"  # Only local access

  redis:
    image: redis:7-alpine
    restart: always
    volumes:
      - redisdata:/data
    ports:
      - "127.0.0.1:6379:6379"

  meilisearch:
    image: getmeili/meilisearch:v1.9
    restart: always
    environment:
      MEILI_MASTER_KEY: your_meili_key
    volumes:
      - meilisearch:/meili_data
    ports:
      - "127.0.0.1:7700:7700"

  libretranslate:
    image: libretranslate/libretranslate:latest
    restart: always
    environment:
      LT_UPDATE_MODELS: "true"
    volumes:
      - libretranslate:/home/libretranslate/.local
    ports:
      - "127.0.0.1:5000:5000"

  api:
    build: ./api  # Your Fastify/FastAPI backend
    restart: always
    environment:
      DATABASE_URL: postgres://tourism:your_secure_password@postgres:5432/tourism_db
      REDIS_URL: redis://redis:6379
      MEILI_URL: http://meilisearch:7700
      TRANSLATE_URL: http://libretranslate:5000
    depends_on:
      - postgres
      - redis
      - meilisearch
      - libretranslate
    ports:
      - "127.0.0.1:3001:3001"

volumes:
  pgdata:
  redisdata:
  meilisearch:
  libretranslate:

Nginx config (/etc/nginx/sites-available/tourism)

server {
    listen 80;
    server_name yourdomain.com;

    # Let's Encrypt SSL (certbot handles this)

    # Cache static assets for 1 year
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
        root /var/www/tourism/dist;
        expires 1y;
        add_header Cache-Control "public, immutable";
    }

    # Serve frontend static export
    location / {
        root /var/www/tourism/dist;
        try_files $uri $uri/ /index.html;

        # Cache HTML at Cloudflare edge, not here
        add_header Cache-Control "public, max-age=0, must-revalidate";
    }

    # Proxy API requests
    location /api/ {
        proxy_pass http://127.0.0.1:3001/;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

5. Handling High Traffic on a Single VPS

A $5–$20/month VPS (2–4 vCPU, 4–8GB RAM) can handle surprising traffic if you are disciplined:

TechniqueHow
Cloudflare cachingCache country pages at edge for 1 hour. Your VPS sees almost zero requests.
Nginx static servingPre-built HTML/JS files served directly by Nginx (not Node.js).
Redis query cacheCache the top 100 searches per country. Tourists ask the same questions.
MeilisearchOffloads search from PostgreSQL. Sub-50ms response time.
PgBouncerAdd a connection pooler so PostgreSQL doesn't choke during spikes.
Rate limitingNginx limit_req or Cloudflare rules to prevent abuse.
Gzip/BrotliNginx compresses responses.

Realistic capacity: With Cloudflare caching static pages, a single 4GB VPS can serve 50,000–100,000 page views/day easily. The bottleneck becomes translation API calls (if not cached in Redis).

6. The Honest Trade-offs of "Free"

FeaturePaid StackYour Free VPS Stack
Monthly cost~$200+~$0 (VPS only)
DevOps workMinimalModerate (backups, updates, SSL renewal)
Translation qualityExcellent (Google/Azure)Fair-Good (LibreTranslate)
Speech translation speed<1 second2–5 seconds (self-hosted CPU) or browser-dependent
Uptime responsibilityVercel/SupabaseYou (3 AM server crashes)
ScalingClick buttonManual (bigger VPS or add servers)

7. Recommended Build Order (Free VPS Path)

  1. Week 1: Docker Compose (Postgres + Redis + Meilisearch) + Nginx + static React/Vite frontend
  2. Week 2: Content schema + seed 10 countries from Wikivoyage (with attribution)
  3. Week 3: Meilisearch indexing + language routing + RTL support
  4. Week 4: LibreTranslate container + text translation widget
  5. Week 5: Browser Web Speech API integration (microphone button)
  6. Week 6: Cloudflare caching + PgBouncer + rate limiting
  7. Week 7: Load testing + monitoring (Uptime Kuma)

Bottom Line

No, it is not the same stack — but it is the same architecture. You swap managed services for self-hosted Docker containers and accept lower translation quality (or strict free-tier API limits) in exchange for zero recurring platform costs.

If your VPS has at least 4GB RAM, this is absolutely viable for a free tourism app. If it is a 1GB VPS, drop Meilisearch and use PostgreSQL full-text search instead to save memory.

Do you want the full docker-compose.yml with a pre-configured LibreTranslate image, or a deployment script that automates Nginx + SSL + Docker on your VPS?

١. المقدمة: هل يبقى نفس المكدس التقني؟

الإجابة المختصرة: لا. المفاهيم المعمارية تبقى كما هي، لكن الأدوات يجب أن تتغير. عند الانتقال من المنصات المُدارة (مثل Vercel وSupabase) إلى خادم VPS خاص بك، فأنت تتنازل عن الراحة مقابل التحكم الكامل في التكاليف. الفاتورة الشهرية تنخفض إلى صفر تقريبًا (ما عدا تكلفة الـVPS التي تمتلكه بالفعل).

٢. المكدس التقني المجاني بالكامل على VPS

الطبقةالمكدس المُدارة (المدفوع)مكدس الـVPS المجانيسبب التغيير
الواجهة الأماميةNext.js على VercelNext.js (تصدير ثابت) أو React + Vite يخدمه NginxVercel مدفوع/سهل؛ Nginx على VPS مجاني وأسرع للمحتوى الثابت
البوابة العكسية / SSLيديره VercelNginx + Let's Encrypt (Certbot)معيار الصناعة، مجاني بالكامل
شبكة توصيل المحتوى (CDN)Vercel Edgeخطة Cloudflare المجانيةطبقة مجانية حقيقية مع تخزين مؤقت عالمي + حماية من هجمات DDoS
واجهة برمجة التطبيقات (API)مسارات Next.js APIFastify (Node.js) أو FastAPI (Python) داخل Dockerخفيف الوزن، يعمل في أي مكان، أسهل في التصحيح على VPS
قاعدة البياناتSupabase / NeonPostgreSQL (مستضاف ذاتيًا داخل Docker)تحكم كامل، بدون حدود للصفوف
ذاكرة التخزين المؤقتUpstash RedisRedis (مستضاف ذاتيًا داخل Docker)تكلفة صفر، بدون قيود
محرك البحثAlgolia / Meilisearch المدفوعMeilisearch (مستضاف ذاتيًا داخل Docker)مفتوح المصدر، يعمل بكفاءة في Docker، بدون رسوم لكل عملية بحث
مدير العملياتالتوسع التلقائي في VercelPM2 (لـNode) أو systemdيبقي واجهة البرمجة نشطة إذا تعطلت
الحاوياتدوال ServerlessDocker Composeيدير PostgreSQL + Redis + Meilisearch + API على آلة واحدة
ترجمة النصوصGoogle Cloud Translation (مدفوع)LibreTranslate (مستضاف ذاتيًا) + الطبقة المجانية من Azure Translator كاحتياطLibreTranslate مفتوح المصدر؛ Azure يعطي ٢ مليون حرف شهريًا مجانًا
التحويل من كلام إلى نص (STT)Whisper API (مدفوع)Web Speech API في المتصفح (جانب العميل، مجاني) + faster-whisper مستضاف ذاتيًا (CPU)واجهة المتصفح لا تكلف شيئًا؛ Whisper الذاتي بطيء على المعالج لكنه يعمل
التحويل من نص إلى كلام (TTS)Google TTS / ElevenLabs (مدفوع)SpeechSynthesis في المتصفح (مجاني) أو Coqui TTS (مستضاف ذاتيًا)أصوات المتصفح فورية ومجانية
المراقبةVercel Analytics / SentryUptime Kuma + سجلات وصول Nginxمجاني، صفحات حالة مستضافة ذاتيًا

٣. ما الذي يبقى كما هو؟

  • Next.js لا يزال يعمل، لكنك ستستخدم على الأرجح output: 'export' لتوليد ملفات HTML/JS ثابتة وترك Nginx يخدمها. هذا أسرع بكثير من تشغيل خادم Node.js لصفحات المحتوى.
  • البنية المعمارية لـPostgreSQL + Redis + Meilisearch تبقى متطابقة — الفرق الوحيد أنك تشغّلها في Docker بدلًا من دفع ثمن النسخ المُدارة.
  • استراتيجية المحتوى (الملاحظات الذرية، سير العمل التحريري، توجيه اللغات) لا يتغير.
  • Cloudflare يجلس أمام VPS لتخزين الصفحات عالميًا وامتصاص الذروات المرورية.

٤. ما الذي يتغير جذريًا: الترجمة

هذا هو الجزء الأصعب في المشروع المجاني. الترجمة العصبية والتعرف على الكلام يتطلبان قوة حوسبة هائلة.

الخيارالتكلفةالجودةالأفضل لـ
LibreTranslate (Docker مستضاف ذاتيًا)٠ دولارجيدة-مقبولة للغات الرئيسيةالعبارات الشائعة، عناصر القائمة، التواصل الأساسي
Argos Translate (الخلفية التي يعمل عليها LibreTranslate)٠ دولارمقبولةنفس ما سبق
Azure Translator٢ مليون حرف شهريًا مجانًاممتازةالملاحظات الحرجة، العادات، المعلومات القانونية
DeepL Free API٥٠٠ ألف حرف شهريًاممتازةاللغات الأوروبية/اليابانية/الصينية (لكنه يفتقد الملايو والإندونيسية والأردو)

توصيتي: شغّل LibreTranslate على VPS للترجمة الفورية في الدردشة (غير محدود). استخدم الطبقة المجانية من Azure Translator لترجمة ملاحظات البلدان المُحكَّمة مسبقًا (٢ مليون حرف شهريًا). للعربية ↔ اليابانية/الكورية/الأردو ضع إخلاء: «ترجمة مجتمعية — راجع المعلومات الحرجة.»

الخيارالتكلفةالسرعةالجودة
Web Speech API في المتصفح٠ دولارفوريةمتفاوتة بين الأجهزة؛ جيدة للإنجليزية/العربية/اليابانية، ضعيفة للأردو/الإندونيسية
faster-whisper مستضاف ذاتيًا (CPU)٠ دولاربطيئة (٢-٥ أضعاف الزمن الحقيقي على معالج VPS)دقة ممتازة
Azure Speech STT المجاني٥ ساعات صوتية شهريًاسريعةجودة إنتاجية

توصيتي لتطبيق مجاني: المرحلة الأولى Web Speech API بالكامل على هاتف المستخدم + زر ميكروفون كبير. المرحلة الثانية: إن وُجدت شكاوى جودة، وجّه الصوت إلى faster-whisper (النموذج الصغير) وحذّر أن ذلك يستغرق ٢–٣ ثوانٍ.

٥. شرح ملف Docker Compose لخادمك الخاص

الفكرة العامة: ملف يُخبر Docker أن يشغّل خمس خدمات متصلة:

  • PostgreSQL: صورة Alpine خفيفة. مستخدم tourism وقاعدة tourism_db. Volume حتى لا تُفقد البيانات. المنفذ ٥٤٣٢ محلي فقط.
  • Redis: كاش لنتائج البحث والجلسات والترجمات المتكررة. المنفذ ٦٣٧٩ محلي.
  • Meilisearch: محرك بحث مفتوح المصدر + Master Key. المنفذ ٧٧٠٠ محلي.
  • LibreTranslate: ترجمة عصبية، تنزّل النماذج عند أول تشغيل. المنفذ ٥٠٠٠ محلي.
  • API: Fastify أو FastAPI يتصل بالخدمات الأربع. المنفذ ٣٠٠١ محلي.

الفائدة: docker-compose up يشغّلها معًا على شبكة Docker الداخلية. الكود كما في النسخة الإنجليزية أعلاه (نفس الملف حرفيًا).

٦. شرح إعداد Nginx كبوابة عكسية

  • الملفات الثابتة: Nginx يبحث في /var/www/tourism/dist. الأصول (صور، خطوط، JS) تُكاش في المتصفح سنة.
  • طلبات API: أي مسار يبدأ بـ /api/ يُمرَّر إلى المنفذ ٣٠٠١ مع رؤوس Host وX-Real-IP.
  • SSL: Certbot / Let's Encrypt شهادة مجانية تُجدَّد كل ٩٠ يومًا.

٧. الزيارات العالية على VPS واحد

خادم بـ ٥–٢٠ دولار شهريًا (٢–٤ أنوية، ٤–٨ جيجابايت رام) يكفي إن التزمت: كاش Cloudflare لصفحات البلدان ساعة، Nginx للثابت لا Node، Redis لأعلى ١٠٠ بحث لكل بلد، Meilisearch أقل من ٥٠ مللي ثانية، PgBouncer، تحديد معدل، Gzip/Brotli.

القدرة الواقعية: VPS بـ٤ جيجابايت مع كاش Cloudflare يخدم ٥٠٬٠٠٠ إلى ١٠٠٬٠٠٠ مشاهدة/يوم. الاختناق يصبح استدعاءات الترجمة إن لم تُكاش في Redis.

٨. المقايضات الصادقة

التكلفة ~٢٠٠+ دولار مقابل ~٠ (VPS فقط). DevOps قليلة مقابل متوسطة. جودة ترجمة ممتازة مقابل جيدة-مقبولة. سرعة كلام أقل من ثانية مقابل ٢–٥ ثوانٍ. التشغيل على Vercel/Supabase مقابل أنت (تعطل الثالثة فجرًا). توسع بزر مقابل يدوي.

٩. ترتيب البناء (٧ أسابيع)

  1. الأسبوع الأول: Docker Compose (PostgreSQL + Redis + Meilisearch) + Nginx + واجهة React/Vite ثابتة
  2. الأسبوع الثاني: مخطط قاعدة البيانات + إدخال ١٠ بلدان من Wikivoyage (مع الإسناد)
  3. الأسبوع الثالث: فهرسة Meilisearch + توجيه اللغات + دعم RTL
  4. الأسبوع الرابع: حاوية LibreTranslate + أداة ترجمة النصوص
  5. الأسبوع الخامس: دمج Web Speech API (زر الميكروفون)
  6. الأسبوع السادس: تخزين Cloudflare + PgBouncer + تحديد المعدل
  7. الأسبوع السابع: اختبار الحمل + المراقبة (Uptime Kuma)

١٠. الخلاصة

لا، ليس نفس المكدس التقني — لكنها نفس البنية المعمارية. تستبدل الخدمات المُدارة بحاويات Docker، وتقبل جودة ترجمة أقل (أو حدود الطبقات المجانية) مقابل تكاليف منصة صفر.

إن كان الـ VPS ٤ جيجابايت رام على الأقل فالمسار قابل للتطبيق. إن كان ١ جيجابايت فقط، أزل Meilisearch واستخدم البحث النصي الكامل في PostgreSQL.

Source 3

Not exactly the same stack — Option A vs Option B ليس بالضبط نفس المكدس — الخيار أ مقابل ب

Third answer + Arabic conversion with natural-language term explanations (ISR, Lucia, MinIO, int8, Hetzner CPX41…).الإجابة الثالثة + التحويل العربي مع شرح المصطلحات بلغة طبيعية.

A large part of the earlier recommendation assumed managed cloud (Vercel, Supabase, Upstash, paid translation APIs). Those are not “free” once you leave the trial. On a VPS you already own, most of that is replaced by self-hosted free pieces. Translation and speech are the real fork.

What changes and what does not

LayerBefore (managed cloud)Self-hosted on VPSNotes
HostingVercel / Cloudflare PagesNext.js in Docker on VPS, behind NginxYou own deploys — git push → GitHub Action → docker compose up is enough
DatabaseSupabase / NeonPostgres in Docker on the same VPSYou now own backups — nightly cron pg_dump to off-box storage
Cache / queuesUpstash Redis / QStashRedis in Docker, BullMQ on topEasy to self-host, tiny resource cost
SearchMeilisearch Cloud / AlgoliaMeilisearch in DockerWas already the “free” choice — no real change
CDN / WAFCloudflare (same either way)Cloudflare free plan, pointed at VPS IPKeep this regardless — free, hides VPS IP, absorbs load/attacks
SSLManagedLet's Encrypt / CertbotFree either way
StorageCloudflare R2 / S3Local disk, or self-hosted MinIOJust watch VPS disk
Auth / loginSupabase Auth / ClerkBuild it yourself (sessions + bcrypt, or Lucia)Avoids per-user pricing entirely
MonitoringSentry / DatadogSelf-hosted Grafana + Prometheus, or Sentry free tierEither is fine at your size

This part is a clean swap — free, and honestly not much harder. Translation and speech are where you have a real decision.

Option A — fully self-hosted, no external dependency

  • Text: LibreTranslate (Docker, Argos Translate) — covers Arabic, Indonesian, Malay, Japanese, Korean, Chinese, and Urdu on its supported list, so your full list is there
  • STT: faster-whisper (small/medium, CPU, int8 quantization) — on a decent VPS near real-time
  • TTS: Piper — CPU only, a few hundred MB RAM, 30+ languages
  • Cost: literally $0 forever, no API keys, no data leaving your server
  • Trade-off: translation generally lags DeepL/Google on precise text; speech feels slower than a cloud API — a few seconds per sentence on a modest VPS CPU, not the sub-second feel of streaming Azure

Option B — app self-hosted, keep Google/Azure free tiers

  • Google Cloud Translation: free tier 500,000 characters/month, permanent — does not expire
  • Azure Translator: free tier 2 million characters/month, the most generous among major vendors, no expiry
  • Azure Speech: free tier includes 5 audio hours/month STT, 500,000 characters/month neural TTS, and 5 audio hours/month speech translation
  • Cost: $0 until you exceed the cap, then pay-as-you-go
  • Trade-off: external dependency and a hard ceiling — fine for launch and testing, but 5 audio hours/month is roughly “a few hundred short conversations,” not real monthly product volume once you have users

Recommendation: Option B for translation and speech, Option A for everything else. Self-hosting the app/DB/cache/search costs you nothing extra either way, so do that regardless. Replacing Google/Azure free tiers with LibreTranslate+Whisper+Piper only saves money you were not spending yet, while it costs real quality — and running Whisper well eats CPU the single VPS also needs to serve pages. Start on API free tiers; migrate to a self-hosted ML stack only when the bill becomes real because you have enough traffic.

VPS sizing

For the self-hosted core (Next.js + Postgres + Redis + Meilisearch), 2 vCPU / 4 GB RAM is actually enough at modest traffic, because Cloudflare + Redis + ISR-style static pages absorb most reads before they hit the box. If you pick Option A and add faster-whisper / LibreTranslate / Piper on the same box, raise to 4 vCPU / 8 GB RAM — those models need room, and a ~€15/month box (e.g. Hetzner CPX41 or similar) runs a small/medium Whisper model comfortably near real-time on CPU.

One thing worth resetting

The earlier “high traffic” picture assumed auto-scaling across many servers — that is not available on one VPS. In practice this matters less than it sounds: content browsing is heavily cached (Cloudflare + Redis + ISR static pages), so one modest VPS handles a surprising amount of that traffic. The part that will squeeze the single box first is concurrent live speech sessions, because that is CPU per active user — that is the one thing worth rate-limiting early no matter which translation option you pick.

Want the actual docker-compose.yml for this — Next.js, Postgres, Redis, Meilisearch, Nginx, and a path for whichever translation option you settle on?

جزء كبير مما أوصيت به سابقًا افترض خدمات سحابية مُدارة (Vercel، Supabase، Upstash، واجهات برمجة ترجمة مدفوعة)، وهذه ليست «مجانية» بمجرد تجاوزك فترة التجربة. على VPS تمتلكه بالفعل، يتم استبدال معظم ذلك ببدائل مُستضافة ذاتيًا ومجانية بالفعل. لكن هناك بعض القطع التي تمثل مقايضة حقيقية.

ما يتغير وما لا يتغير

الطبقةقبل (السحابة المُدارة)البديل المُستضاف ذاتيًا على VPSملاحظات
الاستضافةVercel / Cloudflare PagesNext.js داخل Docker على VPS، خلف Nginxأنت تتولى عمليات النشر — يكفي git push → GitHub Action → docker compose up
قاعدة البياناتSupabase / NeonPostgres داخل Docker على نفس VPSأنت تملك النسخ الاحتياطية — cron ليلي pg_dump إلى تخزين خارجي
التخزين المؤقت / الطوابيرUpstash Redis / QStashRedis داخل Docker، BullMQ فوقهسهل الاستضافة الذاتية، تكلفة موارد ضئيلة
البحثMeilisearch Cloud / AlgoliaMeilisearch داخل Dockerكان بالفعل الخيار «المجاني» — لا تغيير حقيقي
شبكة CDN / جدار الحمايةCloudflare (نفسه في الحالتين)خطة Cloudflare المجانية، موجهة إلى IP VPSاحتفظ بهذا بغض النظر — مجاني، يخفي IP، يمتص الحمل/الهجمات
شهادة SSLمُدارةLet's Encrypt / Certbotمجاني في الحالتين
التخزينCloudflare R2 / S3قرص محلي، أو MinIO مُستضاف ذاتيًاراقب مساحة قرص VPS
المصادقة/تسجيل الدخولSupabase Auth / Clerkابنِه بنفسك (جلسات + bcrypt، أو Lucia)يتجنب التسعير لكل مستخدم بالكامل
المراقبةSentry / DatadogGrafana + Prometheus مُستضاف ذاتيًا، أو الطبقة المجانية من Sentryأي منهما مناسب في حجمك

هذا الجزء استبدال نظيف — مجاني، وبصراحة ليس أصعب بكثير. الترجمة والكلام هما حيث لديك قرار حقيقي.

الخيار أ — مستضاف ذاتيًا بالكامل، بلا تبعية خارجية

  • النصوص: LibreTranslate (Docker، Argos Translate) — يغطي العربية والإندونيسية والملايو واليابانية والكورية والصينية والأردو ضمن لغاته المدعومة
  • كلام إلى نص: faster-whisper (نموذج صغير/متوسط، CPU، تكميم int8) — على VPS جيد قرب الزمن الحقيقي
  • نص إلى كلام: Piper — معالج فقط، بضع مئات ميجابايت رام، ٣٠+ لغة
  • التكلفة: ٠ دولار إلى الأبد، بلا مفاتيح، بلا بيانات تغادر الخادم
  • المقايضة: جودة الترجمة تتأخر عن DeepL/Google للنصوص الدقيقة؛ الكلام أبطأ من واجهة سحابية — بضع ثوانٍ للجملة على معالج متواضع، لا الشعور بأقل من ثانية كما في Azure المتدفق

الخيار ب — التطبيق مستضاف ذاتيًا، مع طبقات Google/Azure المجانية

  • Google Cloud Translation: ٥٠٠٬٠٠٠ حرف شهريًا، دائمة لا تنتهي
  • Azure Translator: ٢ مليون حرف شهريًا، الأكثر سخاءً، بلا انتهاء
  • Azure Speech: ٥ ساعات صوتية شهريًا للكلام إلى نص، و٥٠٠٬٠٠٠ حرف شهريًا للنص إلى كلام العصبي، و٥ ساعات لترجمة الكلام
  • التكلفة: ٠ دولار حتى تتجاوز السقف ثم ادفع حسب الاستخدام
  • المقايضة: تبعية خارجية وسقف صلب — مناسب للإطلاق، لكن ٥ ساعات صوتية ≈ «بضع مئات محادثات قصيرة» وليست حجم منتج حقيقي بعد وجود مستخدمين

التوصية: الخيار ب للترجمة والكلام، والخيار أ لكل شيء آخر. استضافة التطبيق/القاعدة/الكاش/البحث ذاتيًا لا تكلفك شيئًا إضافيًا في الحالتين. استبدال طبقات Google/Azure المجانية بـ LibreTranslate+Whisper+Piper يوفّر مالًا لم تكن تنفقه بعد، ويكلفك جودة حقيقية — وتشغيل Whisper يأكل معالجًا يحتاجه VPS الوحيد لخدمة الصفحات. ابدأ بالطبقات المجانية؛ إن صارت الفاتورة حقيقية فذلك دليل حركة كافية لتبرير مكدس تعلم آلي ذاتي، وهاجِر عندها لا قبلها.

تحجيم VPS

للنواة المستضافة ذاتيًا (Next.js + Postgres + Redis + Meilisearch): ٢ نواة / ٤ جيجابايت رام تكفي عند حركة متواضعة لأن Cloudflare + Redis + صفحات ISR تمتص معظم القراءات. إن اخترت الخيار أ وأضفت faster-whisper/LibreTranslate/Piper على نفس الصندوق فارفع إلى ٤ أنوية / ٨ جيجابايت رام — صندوق بنحو ١٥ يورو شهريًا (مثل Hetzner CPX41) يشغّل نموذج Whisper الصغير/المتوسط بشكل مريح قرب الزمن الحقيقي.

شيء واحد يستحق إعادة ضبطه

بنية «الحركة العالية» السابقة افترضت توسعًا تلقائيًا عبر خوادم متعددة — هذا غير متاح مع VPS واحد. عمليًا أقل أهمية مما يبدو: التصفح مُكاش بكثافة. ما يضغط الصندوق أولًا هو جلسات الكلام الحية المتزامنة (معالج لكل مستخدم نشط) — هذا ما يستحق تحديد المعدل مبكرًا أيًا كان خيار الترجمة.

شرح المفاهيم التقنية بلغة عربية طبيعية

  • ما معنى docker compose up؟ أمر في سطر الأوامر. فكّر فيه كـ«زر تشغيل» ينشط كل خدمات تطبيقك دفعة واحدة. بدلًا من تشغيل القاعدة ثم البحث ثم الكاش يدويًا — هذا الأمر يشغّلهم معًا.
  • ما معنى pg_dump؟ برنامج مع PostgreSQL يلتقط لقطة لكل بياناتك في ملف. تخيّل سيلفي لقاعدة البيانات. تشغّله ليلًا عبر cron كنسخة احتياطية لمعلومات السياح والبلدان.
  • ما معنى BullMQ؟ مكتبة فوق Redis. «طابور انتظار ذكي». ترجمة معقدة لا تُنفَّذ فورًا على الصفحة؛ توضع في الطابور وتُعالج واحدة تلو الأخرى حتى لا يختنق الخادم عند آلاف الزوار معًا.
  • ما معنى ISR؟ خاصية في Next.js. تكتب كتابًا: تطبع نسخة على الرف بدل طبعة جديدة لكل قارئ. إن حدّثت الفصل الخامس تعيد طباعة الصفحات المتأثرة فقط. صفحات البلدان تُبنى مسبقًا وتُحدَّث عند تغيّر المحتوى.
  • ما معنى git push → GitHub Action؟ سير عمل آلي. تدفع التعديل إلى GitHub فيستيقظ روبوت يبني التطبيق وينقله إلى VPS ويشغّله. لا ترفع الملفات يدويًا.
  • ما معنى Let's Encrypt / Certbot؟ نظامان مجانيان للقفل الأخضر. Certbot يذهب إلى Let's Encrypt: «هذا الموقع ملكي، أعطني شهادة.» التجديد كل ٩٠ يومًا تلقائيًا.
  • ما معنى MinIO؟ يحوّل VPS إلى تخزين ملفات شبيه بـAmazon S3. «دلو رقمي» على قرص VPS بدل دفع Amazon لصور السياح أو ملفات الصوت.
  • ما معنى Lucia؟ إطار بسيط لتسجيل الدخول. بدل اشتراك Clerk أو Supabase Auth يعطيك كود الجلسات وكلمات المرور المشفّرة مجانًا.
  • ما معنى int8 quantization؟ يُقلّل حجم نماذج الذكاء. حقيبة سفر تُضغط في أكياس مفرغة. int8 يفعل ذلك لـWhisper ليعمل على معالج عادي بلا بطاقة رسوميات.
  • ما معنى rate-limiting؟ حارس على باب النادي: «١٠٠ شخص في الساعة.» من يرسل آلاف الطلبات يُوقف عند الباب.
  • ما معنى Hetzner CPX41؟ VPS من هيتزنر الألمانية: ٤ أنوية و٨ جيجابايت رام بنحو ١٥ يورو شهريًا. مثال اقتصادي يكفي هذا المشروع.

الخلاصة بالعربية

  1. استضف كل شيء ذاتيًا: Next.js وPostgreSQL وRedis وMeilisearch في Docker، وNginx كبوابة أمامية.
  2. استخدم Cloudflare المجاني كدرع وشبكة توصيل — لا تتنازل عنه.
  3. للترجمة: ابدأ بالطبقات المجانية من Google Cloud Translation وAzure Speech. هي مجانية فعليًا وذات جودة عالية.
  4. إذا نمت: عند سقف الطبقات المجانية فقط ابدأ LibreTranslate وWhisper الذاتيين.
  5. لا تشغّل كل شيء على VPS صغير: ٤ جيجابايت تكفي للتصفح؛ إن أضفت ترجمة كلام ذاتية فارفع إلى ٨ جيجابايت.
هل تريد ملف Docker Compose جاهزًا تنسخه وتلصقه؟
RELATED FILE · 2026-07-28

04. Recommended Stack + Features (Mom · Egypt · Tourism)

tourism mom apps/grok analysis/tourism mom apps/recommendations/RECOMMENDED-STACK-AND-FEATURES.md · 330 lines
Not one of the three chats. This file is the later “single source of truth for stack + features.” It already picks Caddy, PWA, LibreTranslate, Web Speech, and translator first.

Shared core: Next.js 14 + Tailwind PWA; Postgres on VPS + Prisma; MinIO; Caddy; Leaflet+OSM; LibreTranslate; Web Speech + Whisper.cpp fallback. Three apps share ~90% stack, monorepo, deploy three times.

Tourism translator (this file’s easiest path)

  • Browser STT/TTS → Caddy → Next PWA :3000 + LibreTranslate :5000.
  • Phase 1 langs: AR (MSA+Egyptian), EN, ID, MS, JA, KO, ZH, UR.
  • 7-day MVP: text, hold-to-speak, speech→speech, auto detect, split conversation, 200 phrases, Tesseract, localStorage, PWA.
  • Comparison: Web Speech+LT = $0 / 7/10 / self-host — “best lazy choice.” Google/Azure/OpenAI are paid quality bumps.
  • 90-day: weeks 1–2 monorepo+Caddy; 3–4 translator live; 5–6 Mom; 7–8 Egypt; 9–10 payments; 11–12 TikTok/SEO.
  • Fixed cost ~$1/mo on existing VPS. Ponytail: no RN/Flutter, no k8s, no custom MT until >5% complaints, no Redis until 100K MAU.

النواة المشتركة: Next وPWA وPostgres وCaddy وLibreTranslate وWeb Speech. ابنِ المترجم أولاً في ٧ أيام ثم الأمومة ثم مصر. التكلفة الثابتة نحو دولار واحد على الخادم الموجود.

RELATED FILE · SHARED INFRA

05. BUILD-00 Shared Infrastructure

…/BUILD-00-SHARED-INFRA.md · 329 lines · foundation for all 4 apps

One shared compose: Caddy 30 MB, PostGIS 1–1.5 GB, LibreTranslate 1–2 GB, Plausible 150 MB, MinIO 200 MB, Uptime Kuma 30 MB. Total ~3–4 GB — fits 8 GB with headroom. LT has no public port.

  • Caddyfile hosts: translate / egypt / ar.addict.mom / en.addict.mom + gated plausible/minio/kuma.
  • Backup: Litestream→MinIO for SQLite (RPO ~1 s). Postgres: nightly pg_dump + WAL via pgBackRest, Restic to Storage Box, keep 7/4/6. Test restore monthly.
  • Every app: /healthz liveness + /readyz (SELECT 1). Kuma every 30s; alert after 2 failures.
  • Topology example: Hetzner CX32 8 GB for shared+Mom; Contabo for Egypt/LT split; ai-developer = Restic/Ollama. Split LT when CPU >70% for 10 min or QPS >5.
  • Logs day 1: Caddy + logrotate + grep. Loki only if SSH debug >1 h/week. No ELK.

بنية مشتركة: Caddy وPostGIS وLibreTranslate الداخلي وكوما. النسخ الاحتياطي إلزامي. نقاط الصحة /healthz و/readyz. انقل الترجمة إلى خادم ثانٍ إذا تجاوز المعالج 70٪ عشر دقائق.

RELATED FILE · AUDIT

06. UNIFIED MASTER SPEC — 6 bugs + 12 gaps

tourism mom apps/UNIFIED_MASTER_SPECIFICATION.md · 353 lines · target 15 GB / 6 cores

Bugs that apply to any VPS compose (do not repeat)

  • Web Speech onend stale closure → use isListeningRef.
  • UI language list must match LT_LOAD_ONLY.
  • Do not publish LibreTranslate :5000 — expose + LT_DISABLE_WEB_UI=true (saves ~20 MB, stops API bypass).
  • Drizzle .where() needs eq(); FAQ confidence must not be score*2.

Resource table (honest): Caddy 30 · Translator 150 · LT 2.50 GB · Egypt 300 · PostGIS 200 · Arabic Mom 150 · English Mom 200 ≈ 3.53 GB + Kuma 30. Headroom ~11 GB on a 15 GB box. Logging: json-file 10m×3, not Grafana (0 extra RAM).

أخطاء لا تكررها: إغلاق Web Speech القديم، قائمة لغات تطابق الحاوية، عدم نشر منفذ 5000. LibreTranslate نحو 2.5 جيجا وليس 200 ميجا.

RELATED FILE · BUILD-01 + GEMINI 00 + GROK 00/04

07. Translator build plan + 3-tier pipeline + honest limits

BUILD-01-TOURISM-TRANSLATOR.md · FINAL-01 · gemini 00-MASTER-STACK · grok 00 + 04

3-tier MT (Gemini, adopted by BUILD-01): (1) Web Speech + optional Bergamot/Transformers.js WASM — 0 server load; (2) LibreTranslate on VPS; (3) HuggingFace free for long-tail langs. WASM is a speed fallback (BLEU 4–6/10), not the quality primary.

P0: split-screen voice, text always visible, 8 langs, Tesseract, cultural tooltips, offline packs, 60/min, healthz/readyz. P1: WebRTC group room (expert: Google’s 1:1 is clunky). P2: Coqui XTTS needs ~8 GB — not on the shared fleet.

Limits (BUILD-01 table): Firefox no STT; iOS 60 s; LT Egyptian dialect 3–4/10 so phrasebook on critical paths; Arabic OCR 70–80%; concurrency 2–5K not 50K. k6 ramps to 2000 VUs, p95 <1 s, error <5%.

Grok 04 browser matrix: Chrome Android good; Safari iOS limited; type box always. High-traffic: LRU cache, 50–100 free/day, LT_LOAD_ONLY, isolate LT, never accept wav on free tier, 503+phrasebook if overloaded.

ثلاث طبقات: متصفح ثم LibreTranslate ثم HuggingFace. السقف الصادق ٢–٥ آلاف. اللهجة المصرية على LibreTranslate ضعيفة — الكتاب المحفوظ يغطي المسارات الحرجة. لا تشغّل استنساخ الصوت على الأسطول المشترك.