ما تحتاج تشتري سيرفر ولا تدفع إيجار شهري — تكتب الكود وترفعه، وCloudflare يشغله عند الطلب
No server rental, no monthly bills — write your code, deploy it, Cloudflare runs it on demand
كودك يشتغل في أقرب نقطة للمستخدم من بين 300+ موقع — السرعة خرافية والـ latency صفر تقريباً
Your code runs at the nearest of 300+ locations to the user — ultra-low latency worldwide
يستخدم نفس محرك Chrome بدل Docker — يشتغل في ميلي ثانية بدون Cold Start الممل
Uses Chrome's V8 engine instead of Docker containers — starts in milliseconds, no cold starts
100,000 طلب يومياً مجاناً — كافي لأي مشروع شخصي أو بروتوتايب
100,000 requests/day free — enough for any personal project or prototype
كل طلب → Edge Location أقرب للمستخدم → Worker يتفاعل مع Storage أو API → يرجع الرد خلال <5ms Each request → nearest Edge location → Worker interacts with Storage or API → responds in <5ms
🔹 مثال 1 — Worker بسيط يرد على الطلبات:
🔹 Example 1 — Basic Worker that responds to requests:
// نقطة الدخول الرئيسية لكل Worker export default { async fetch(request, env, ctx) { const url = new URL(request.url); const name = url.searchParams.get('name') || 'Ayoub'; return new Response( `مرحباً يا ${name}! من Worker على الـ Edge 🚀`, { status: 200, headers: { 'Content-Type': 'text/plain; charset=utf-8', 'Access-Control-Allow-Origin': '*' } } ); } };
🔹 مثال 2 — API Proxy مع Routing:
🔹 Example 2 — API Proxy with Routing:
export default { async fetch(req, env) { const { pathname } = new URL(req.url); // Routing بسيط if (pathname === '/api/time') { return Response.json({ time: new Date().toISOString(), city: req.cf?.city, // مدينة المستخدم تلقائياً! country: req.cf?.country // بلده كمان }); } if (pathname === '/api/proxy') { // Proxy لـ API خارجي بدون CORS مشاكل const data = await fetch('https://api.github.com/users/algoushah'); return new Response(data.body, { headers: { 'Access-Control-Allow-Origin': '*' } }); } return new Response('404 - مو موجود', { status: 404 }); } };
🔹 مثال 3 — KV Storage للحفظ والقراءة:
🔹 Example 3 — KV Storage for read/write:
// wrangler.toml: [[kv_namespaces]] binding = "MY_KV" export default { async fetch(req, env) { const method = req.method; if (method === 'POST') { const { key, value } = await req.json(); await env.MY_KV.put(key, value, { expirationTtl: 86400 // ينتهي بعد يوم }); return Response.json({ ok: true, msg: 'تم الحفظ ✅' }); } if (method === 'GET') { const key = new URL(req.url).searchParams.get('key'); const val = await env.MY_KV.get(key); return Response.json({ key, value: val ?? 'مو موجود' }); } } };
🔹 أوامر النشر بـ Wrangler CLI:
🔹 Deploy commands with Wrangler CLI:
# تثبيت Wrangler $ npm install -g wrangler # تسجيل الدخول $ wrangler login # إنشاء مشروع جديد $ wrangler init my-worker # تشغيل محلياً للتجربة $ wrangler dev # نشر على Edge مباشرة $ wrangler deploy # إضافة Custom Domain $ wrangler publish --route api.ayoub.pw/*
حل مشكلة CORS بين الفرونت والـ API
Solve CORS issues between frontend and APIs
فلترة الطلبات والـ JWT Verification
Filter requests and verify JWT tokens
خزّن الـ API responses على الـ Edge
Cache API responses at the edge
عدّل الصور on-the-fly بدون سيرفر
Transform images on-the-fly, no server needed
استقبل Webhooks من Stripe أو GitHub
Receive webhooks from Stripe or GitHub
وجّه المستخدمين لنسخ مختلفة من الموقع
Route users to different site versions
احمي موقعك من الـ scrapers والـ bots
Protect your site from scrapers and bots
وجّه المستخدمين حسب بلدهم تلقائياً
Redirect users based on their country automatically
| الخاصيةFeature | CF Workers | AWS Lambda | Vercel Functions |
|---|---|---|---|
| وقت الاستجابةResponse time | <5ms | ~100ms | ~50ms |
| Cold StartCold Start | لا يوجدNone | موجودYes | موجودYes |
| Free Tier | 100K/day | 1M/month | 100K/day |
| المواقع العالميةGlobal locations | 300+ | ~30 | ~30 |
| Node.js APIs | جزئيPartial | كاملFull | كاملFull |
| سهولة الإعدادEase of setup | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
حوّل Ayoub Downloader ليمر عبر Worker — يحل مشاكل CORS ويخفي الـ VPS endpoint
Route Ayoub Downloader through a Worker — fixes CORS and hides the VPS endpoint
خلّ ProMT يكال API calls من Worker بدل الفرونت — مفاتيحك تبقى آمنة 100%
Route ProMT API calls through a Worker — keep your API keys server-side and secure
Worker يجيب RSS feeds ويعالجها ويحفظها في KV — يحل مشكلة CORS في AyOuB NeWs
Worker fetches and caches RSS feeds in KV — solves CORS issues in AyOuB NeWs