الـ RBAC و ABAC والملكية: policy واحدة بدل ifs متفرقة

جارٍ التحميل…

01 / ملخص الدرس

الـ RBAC و ABAC والملكية: policy واحدة بدل ifs متفرقة

API فيه documents لشركتين، والصلاحيات ifs متفرقة في كل route: admin من شركة تانية بيعدّل، و role جديد بيعدّي، و editor بيعدّل حاجة مش بتاعته، والكاتب بينشر لنفسه. بنفهم RBAC و ABAC و ReBAC والملكية والـ tenant isolation، وبنكتب policy واحدة deny by default بترجّع القرار والسبب، و middleware واحد بيسجّل كل قرار، وبنختبرها كـ matrix.

02 / شرح الدرس مكتوبًا

نص شرح المعلم والكود الذي كتبه ونتيجة تشغيله، بنفس ترتيب الدرس.

أهلًا بيك. الدرس اللي فات كان فيه admin ومستخدم عادي وبس. في الحقيقة الصلاحيات أعقد من كده بكتير. data dot js: شركتين، acme و globex. كل شركة اسمها tenant. مُنى editor، وعمر viewer، وسارة admin، وكلهم في acme. هاني admin بس في globex. و Zein intern، role جديد حد ضافه ومحدش عرّفله صلاحيات. والـ documents ليها owner و status: draft أو published. server dot js: كل route بيشيك الصلاحيات بطريقته. GET بيشيك الـ tenant، والـ viewer بيشوف المنشور بس. PATCH: نسي الـ tenant خالص، وبيمنع الـ viewer بس، يعني أي role تاني يعدّي، وما بيشيكش الملكية. publish: الـ editor بينشر الـ document اللي هو كاتبه، من غير ما حد يراجعه. ده شكل أغلب الـ code الحقيقي: كل واحد كتب if في حتة، ومفيش مكان واحد تقرا منه مين يقدر يعمل إيه.

نشغّل attack dot js.

attack.js
import { as } from "./client.js";
const show = (who, what, r) =>
  console.log(String(r.status).padEnd(4), who.padEnd(6), what.padEnd(28), r.body ? JSON.stringify(r.body).slice(0, 70) : "");

show("hany", "PATCH doc 1 (شركة تانية)", await as("hany")("PATCH", "/docs/1", { title: "hacked" }));
show("zein", "PATCH doc 3 (intern)", await as("zein")("PATCH", "/docs/3", { title: "مرتبات؟" }));
show("mona", "PATCH doc 3 (بتاع sara)", await as("mona")("PATCH", "/docs/3", { title: "اتغيّر" }));
show("mona", "publish doc 1 (بتاعها)", await as("mona")("POST", "/docs/1/publish"));
show("omar", "GET /docs (viewer)", await as("omar")("GET", "/docs"));

المخرجات

$ node server.js & sleep 0.8; node attack.js; kill $!
API: http://localhost:3000
200  hany   PATCH doc 1 (شركة تانية)     {"id":1,"tenant":"acme","owner":"mona","status":"draft","title":"hacke
200  zein   PATCH doc 3 (intern)         {"id":3,"tenant":"acme","owner":"sara","status":"draft","title":"مرتبا
200  mona   PATCH doc 3 (بتاع sara)      {"id":3,"tenant":"acme","owner":"sara","status":"draft","title":"اتغيّ
200  mona   publish doc 1 (بتاعها)       {"id":1,"tenant":"acme","owner":"mona","status":"published","title":"h
200  omar   GET /docs (viewer)           [{"id":1,"tenant":"acme","owner":"mona","status":"published","title":"

هاني من globex عدّل document في acme. ده أخطر واحد: data شركة اتلعب فيها من شركة تانية. Zein الـ intern عدّل المرتبات، لأن الشرط كان مش viewer. مُنى عدّلت document سارة. ومُنى نشرت حاجة كتباها لنفسها. والـ list: عمر الـ viewer شاف كل الـ documents، حتى الـ draft بتاع المرتبات، لأن الـ list مكتوبة لوحدها بشرط تاني غير بتاع الـ GET.

فيه تلات طرق تفكير. RBAC: Role-Based. كل role ليه list من الـ actions. سهل تفهمه وتراجعه، بس لوحده ما يعرفش يقول editor يعدّل بتاعه بس. ABAC: Attribute-Based. القرار بيعتمد على صفات الـ user، والـ resource، وحتى الـ context زي الوقت أو الـ IP. مسلًا: الـ owner هو الـ user، أو status published. ReBAC: Relationship-Based. الصلاحية جاية من علاقة: مُنى عضو في team، والـ team ليها folder، والـ document جُوّه الـ folder. ده اللي Google عاملاه في system اسمه Zanzibar، وفيه أدوات open source زي OpenFGA و SpiceDB. وأغلب الـ systems بتخلط: RBAC للصورة العامة، و ABAC للشروط، والـ tenant check قبل أي حاجة. الحل اللي هنعمله: policy واحدة. function اسمها can، بتاخد user و action و document، وبترجّع allow و reason. ما تعرفش حاجة عن HTTP، علشان نختبرها لوحدها بـ matrix. و server dot js الجديد فيه middleware واحد اسمه authorize: بيجيب الـ document، ويسأل can، ويطبع القرار والسبب. ده decision log، ومفيد أوي في التحقيقات والـ audits. ولو مش مسموح: four oh four لو انت أصلًا ما تقدرش تشوفه، و four oh three لو بتشوفه بس مش مسموحلك تعمل الـ action. والـ list بتستخدم نفس الـ policy.

التحدي: اكتب policy dot js. PERMISSIONS للـ roles التلاتة. tenant check الأول. role مش معروف أو action مش معروف: ممنوع. RULES لكل action. و visibleDocs. test dot js بيختبر عشرين قرار وأربع lists من غير server.

تمرين

can(user, action, doc) ← { allow, reason }: tenant الأول، وبعدين PERMISSIONS (RBAC)، وبعدين RULES (ABAC: viewer ← published بس، update ← owner أو admin، publish ← مش الـ owner)، و visibleDocs بنفس الـ policy.

الحل. PERMISSIONS: الجزء الـ RBAC، تقراه في تلات سطور. RULES: الجزء الـ ABAC، كل rule بترجّع true أو السبب. can بتمشي بالترتيب: موجود، tenant، role، rule. وأي حاجة مش متغطية بتقع في deny. و visibleDocs سطر واحد. نشغّل test dot js.

policy.js
// policy.js: كل قرارات الصلاحيات في مكان واحد
// RBAC: كل role بيقدر يعمل أنهي actions
const PERMISSIONS = {
  viewer: ["read"],
  editor: ["read", "update", "publish"],
  admin: ["read", "update", "publish", "delete"],
};

// ABAC: شروط على الـ user والـ document
const RULES = {
  read: (u, d) => d.status === "published" || u.role !== "viewer" || "viewer بيشوف المنشور بس",
  update: (u, d) => u.role === "admin" || d.owner === u.id || "editor بيعدّل بتاعه بس",
  publish: (u, d) => d.owner !== u.id || "صاحب الـ document ما ينشرهوش لنفسه (four-eyes)",
  delete: () => true,
};

export function can(user, action, doc) {
  const deny = (reason) => ({ allow: false, reason });
  if (!user || !doc) return deny("مفيش user أو document");
  if (user.tenant !== doc.tenant) return deny("tenant مختلف");
  if (!PERMISSIONS[user.role]?.includes(action)) return deny(`role ${user.role} ما عندوش ${action}`);
  const rule = RULES[action]?.(user, doc);
  if (rule !== true) return deny(rule || "مفيش rule");
  return { allow: true, reason: "ok" };
}

// الـ list بتتفلتر بنفس الـ policy، مش بشرط تاني مكتوب بإيد
export const visibleDocs = (user, docs) => docs.filter((d) => can(user, "read", d).allow);

المخرجات

$ node test.js
✅ mona  read     doc:1   allow
✅ mona  read     doc:3   allow
✅ mona  update   doc:1   allow
✅ mona  update   doc:3   deny (editor بيعدّل بتاعه بس)
✅ mona  publish  doc:1   deny (صاحب الـ document ما ينشرهوش لنفسه (four-eyes))
✅ mona  publish  doc:3   allow
✅ mona  delete   doc:1   deny (role editor ما عندوش delete)
✅ omar  read     doc:2   allow
✅ omar  read     doc:1   deny (viewer بيشوف المنشور بس)
✅ omar  update   doc:2   deny (role viewer ما عندوش update)
✅ sara  update   doc:1   allow
✅ sara  delete   doc:1   allow
✅ sara  publish  doc:3   deny (صاحب الـ document ما ينشرهوش لنفسه (four-eyes))
✅ hany  read     doc:1   deny (tenant مختلف)
✅ hany  update   doc:1   deny (tenant مختلف)
✅ hany  read     doc:4   allow
✅ zein  read     doc:2   deny (role intern ما عندوش read)
✅ zein  update   doc:3   deny (role intern ما عندوش update)
✅ mona  read     doc:99  deny (مفيش user أو document)
✅ mona  share    doc:1   deny (role editor ما عندوش share)
✅ visibleDocs(omar) = [2]
✅ visibleDocs(mona) = [1,2,3]
✅ visibleDocs(hany) = [4]
✅ visibleDocs(zein) = []

24/24 نجحوا

كله نجح، وكل deny ليه سبب مفهوم. ونشغّل الهجمات على الـ server الجديد.

policy.js

المخرجات

$ node server.js & sleep 0.8; node attack.js; kill $!
API: http://localhost:3000
deny  hany update doc:1 ← tenant مختلف
404  hany   PATCH doc 1 (شركة تانية)     {"error":"مش موجود"}
deny  zein update doc:3 ← role intern ما عندوش update
404  zein   PATCH doc 3 (intern)         {"error":"مش موجود"}
deny  mona update doc:3 ← editor بيعدّل بتاعه بس
403  mona   PATCH doc 3 (بتاع sara)      {"error":"editor بيعدّل بتاعه بس"}
deny  mona publish doc:1 ← صاحب الـ document ما ينشرهوش لنفسه (four-eyes)
403  mona   publish doc 1 (بتاعها)       {"error":"صاحب الـ document ما ينشرهوش لنفسه (four-eyes)"}
200  omar   GET /docs (viewer)           ["سياسة الإجازات"]

هاني: four oh four، والـ body بيقول مش موجود وبس، لأنه مش من حقه يعرف إن الـ document موجود. السبب الحقيقي في الـ log. Zein: four oh four، لأن intern ما عندوش حتى read. مُنى على document سارة: four oh three، لأنها بتشوفه بس مش بتعدّله. والـ publish لنفسها: four oh three. وعمر شاف سياسة الإجازات بس. وفي الـ console كل قرار مكتوب بسببه. لو الـ data في Postgres، نفس الفكرة بتتعمل كمان في الـ query نفسه، WHERE tenant_id، أو بـ Row Level Security، وده هنرجعله في درس الـ multi-tenant. الدرس الجاي: MFA، وإزاي تعمل recovery من غير ما تفتح باب خلفي للمهاجم.

server.js
import express from "express";
import { USERS, DOCS } from "./data.js";
import { can, visibleDocs } from "./policy.js";

const app = express();
app.use(express.json());
app.use((req, res, next) => {
  req.user = USERS[req.get("authorization")?.replace("Bearer ", "")];
  req.user ? next() : res.status(401).end();
});

// middleware واحد: يجيب الـ document ويسأل الـ policy، ويسجّل القرار
const authorize = (action) => (req, res, next) => {
  const doc = DOCS.find((d) => d.id === Number(req.params.id));
  const { allow, reason } = can(req.user, action, doc);
  console.log(`${allow ? "allow" : "deny "} ${req.user.id} ${action} doc:${req.params.id} ← ${reason}`);
  if (!allow) {
    // مش من حقك تعرف إنه موجود ← 404. تقدر تشوفه بس مش مسموحلك ← 403
    const canSee = doc && can(req.user, "read", doc).allow;
    return canSee
      ? res.status(403).json({ error: reason })
      : res.status(404).json({ error: "مش موجود" }); // السبب في الـ log بس
  }
  req.doc = doc;
  next();
};

app.get("/docs", (req, res) => res.json(visibleDocs(req.user, DOCS).map((d) => d.title)));
app.get("/docs/:id", authorize("read"), (req, res) => res.json(req.doc));
app.patch("/docs/:id", authorize("update"), (req, res) => {
  req.doc.title = req.body.title;
  res.json(req.doc);
});
app.post("/docs/:id/publish", authorize("publish"), (req, res) => {
  req.doc.status = "published";
  res.json(req.doc);
});
app.delete("/docs/:id", authorize("delete"), (req, res) => {
  DOCS.splice(DOCS.indexOf(req.doc), 1);
  res.status(204).end();
});

app.listen(3000, () => console.log("API: http://localhost:3000"));
data.js
// data.js: مستخدمين في شركتين (tenants)، و documents
export const USERS = {
  "tok-mona": { id: "mona", tenant: "acme", role: "editor" },
  "tok-omar": { id: "omar", tenant: "acme", role: "viewer" },
  "tok-sara": { id: "sara", tenant: "acme", role: "admin" },
  "tok-hany": { id: "hany", tenant: "globex", role: "admin" },
  "tok-zein": { id: "zein", tenant: "acme", role: "intern" }, // role جديد محدش عرّفه
};
export const DOCS = [
  { id: 1, tenant: "acme", owner: "mona", status: "draft", title: "خطة Q3" },
  { id: 2, tenant: "acme", owner: "sara", status: "published", title: "سياسة الإجازات" },
  { id: 3, tenant: "acme", owner: "sara", status: "draft", title: "مرتبات" },
  { id: 4, tenant: "globex", owner: "hany", status: "published", title: "عقد globex" },
];
client.js
// client.js
export const as = (tok) => async (method, path, body) => {
  const r = await fetch("http://localhost:3000" + path, {
    method,
    headers: { authorization: `Bearer tok-${tok}`, "content-type": "application/json" },
    body: body && JSON.stringify(body),
  });
  const text = await r.text();
  return { status: r.status, body: text ? JSON.parse(text) : null };
};
test.js
// test.js: بيختبر الـ policy لوحدها، من غير server
import { can, visibleDocs } from "./policy.js";
import { USERS, DOCS } from "./data.js";
const u = (id) => Object.values(USERS).find((x) => x.id === id);
const doc = (id) => DOCS.find((d) => d.id === id);

const matrix = [
  ["mona", "read", 1, true], ["mona", "read", 3, true], ["mona", "update", 1, true],
  ["mona", "update", 3, false], ["mona", "publish", 1, false], ["mona", "publish", 3, true],
  ["mona", "delete", 1, false], ["omar", "read", 2, true], ["omar", "read", 1, false],
  ["omar", "update", 2, false], ["sara", "update", 1, true], ["sara", "delete", 1, true],
  ["sara", "publish", 3, false], ["hany", "read", 1, false], ["hany", "update", 1, false],
  ["hany", "read", 4, true], ["zein", "read", 2, false], ["zein", "update", 3, false],
  ["mona", "read", 99, false], ["mona", "share", 1, false],
];
let ok = 0;
for (const [who, action, id, want] of matrix) {
  const r = can(u(who), action, doc(id));
  const pass = r.allow === want;
  if (pass) ok++;
  console.log(pass ? "✅" : "❌", who.padEnd(5), action.padEnd(8), `doc:${id}`.padEnd(7), r.allow ? "allow" : `deny (${r.reason})`);
}
const titles = (who) => visibleDocs(u(who), DOCS).map((d) => d.id).join(",");
const lists = [["omar", "2"], ["mona", "1,2,3"], ["hany", "4"], ["zein", ""]];
for (const [who, want] of lists) {
  const got = titles(who);
  if (got === want) ok++;
  console.log(got === want ? "✅" : "❌", `visibleDocs(${who}) = [${got}]`);
}
console.log(`\n${ok}/${matrix.length + lists.length} نجحوا`);
03 / دروس المسار (122)
  1. 01أهلًا بيك: يعني إيه backend، والكورس ده ماشي إزاي
  2. 02الملفات والفولدرات والـ terminal: تتحرك على جهازك زي المبرمجين
  3. 03Node وأول برنامج: تشغّل وتقرا رسالة الخطأ
  4. 04القيم والمتغيرات والأنواع: const و let و typeof
  5. 05القرارات والتكرار: if و === والـ truthy والـ loops
  6. 06الـ functions: parameters و return والـ arrow functions والـ scope
  7. 07الـ objects والـ arrays: destructuring و spread و map و filter و reduce
  8. 08JSON والنصوص والتواريخ: اللغة اللي الـ backend بيتكلم بيها
  9. 09الـ callbacks والـ closures وأول لمسة async: setTimeout
  10. 10الـ classes والـ errors: throw و try/catch و stack trace
  11. 11git: تحفَظ كل خطوة وترجعلها، وما تسرّبش أسرارك
  12. 12ESM و CommonJS و package exports: Node بيلاقي الـ modules إزاي
  13. 13الـ Promises و async/await: sequential و parallel والأخطاء والإلغاء
  14. 14الـ event loop والـ microtasks: Node بيعمل كل حاجة بـ thread واحد إزاي
  15. 15الـ Streams والـ Backpressure: ملفات أكبر من الـ memory
  16. 16الـ File System والـ paths: قراية وكتابة صح، ومن غير path traversal
  17. 17الـ Buffers والبيانات الـ binary: الـ bytes من جُوّه
  18. 18Crypto APIs والأسرار: random و hash و HMAC و AES-GCM
  19. 19الـ Worker Threads: شغل CPU تقيل من غير ما توقف الـ server
  20. 20الـ Errors على مستوى الـ process: operational و programmer و crash-only
  21. 21الـ Node test runner والـ debugging: tests من غير مكتبات
  22. 22HTTP من جُوّه: الـ methods والـ status codes والـ headers
  23. 23Express والـ Routing: الـ params والـ query والترتيب والـ Router
  24. 24Express 5: إيه اللي اتغيّر، وإزاي تنقل مشروع قديم
  25. 25الـ Middleware ودورة حياة الـ request جُوّه Express
  26. 26Validation للمدخلات بـ Zod: ما تصدّقش أي حاجة جاية من برة
  27. 27تصنيف الأخطاء و Problem Details: شكل واحد لكل الـ errors
  28. 28الـ CORS والـ Cookies: المتصفح بيحمي المستخدم إزاي
  29. 29رفع الملفات وحدود الحجم: multer من غير ثغرات
  30. 30الـ Realtime: Server-Sent Events و WebSockets
  31. 31OpenAPI والـ API Versioning: عقد مكتوب، وتغيير من غير ما تكسر حد
  32. 32PostgreSQL: الـ DDL وأنواع البيانات الصح لكل عمود
  33. 33الـ Constraints: PK و FK و UNIQUE و CHECK — الـ database بتحمي نفسها
  34. 34الـ Normalization والـ ERD: تقسّم البيانات صح من أول يوم
  35. 35الـ JOINs والتجميع: INNER و LEFT و GROUP BY و HAVING و window functions
  36. 36JSONB في PostgreSQL: إمتى تستخدمه، وإزاي تسأله وتعمله index
  37. 37الـ Indexes من جُوّه: B-tree و GIN و BRIN
  38. 38Partial و Covering indexes: indexes أصغر وأسرع
  39. 39الـ Pagination بالـ Keyset: ليه OFFSET بيبطّأ وبيكرر
  40. 40Full Text Search في Postgres: بحث بالكلمات، بالعربي والإنجليزي
  41. 41EXPLAIN ANALYZE والـ Planner: اقرا الـ plan وصلّح الـ query
  42. 42الـ Transactions بـ node-postgres: كله أو ولا حاجة
  43. 43الـ MVCC ومستويات الـ Isolation: transactions كتير في نفس الوقت
  44. 44الـ Locks والـ Deadlocks: مين مستني مين
  45. 45SKIP LOCKED و Job Leasing: Postgres كـ job queue
  46. 46Row Level Security والـ Multi-tenancy: كل عميل يشوف بياناته بس
  47. 47Migrations من غير downtime: expand و backfill و contract
  48. 48الـ Replication والـ Read Replicas: نسخ حية من الـ database
  49. 49الـ Connection Pooling و PgBouncer: connections أقل، requests أكتر
  50. 50الـ Partitioning والـ VACUUM والمراقبة: Postgres على المدى الطويل
  51. 51Redis وأنواع البيانات: strings و hashes و lists و sets و sorted sets
  52. 52Cache-aside والـ TTL: Redis قدام الـ database
  53. 53الـ Cache invalidation والـ Stampede: لما الـ key الشهير يموت
  54. 54Lua والـ Atomicity في Redis: كام أمر كأنهم أمر واحد
  55. 55الـ Rate Limiting في Redis: fixed window و sliding window و token bucket
  56. 56الـ Sessions في Redis: تسجيل دخول تقدر تلغيه في أي وقت
  57. 57Redis Streams والـ Consumer Groups: log بيتوزع على workers
  58. 58Pub/Sub و BullMQ: إشارات بين الـ instances، وطوابير شغل محترمة
  59. 59Redis لما يقع: الـ persistence (RDB و AOF) والـ replication
  60. 60Redis في الإنتاج: الـ ACLs والـ Cluster والمراقبة
  61. 61تخزين الـ Passwords بـ Argon2id: صح من أول مرة
  62. 62Session Fixation والـ Rotation: id جديد مع كل صلاحية جديدة
  63. 63الـ Cookie Flags والـ CSRF: المتصفح بيبعت الـ cookie، فلازم تتأكد مين اللي طلب
  64. 64الـ XSS والـ Content Security Policy: ما تخليش النص يتحوّل لـ code
  65. 65الـ OAuth و OpenID Connect و PKCE: login بـ Google من غير ما تشوف الـ password
  66. 66التأكد من الـ JWT صح: التوقيع والـ claims والـ scopes
  67. 67الـ BOLA و BFLA: الـ token السليم مش معناه إن الطلب مسموح
  68. 68الـ RBAC و ABAC والملكية: policy واحدة بدل ifs متفرقةانت هنا
  69. 69الـ MFA والـ recovery: التاني factor اللي بجد
  70. 70الـ Passkeys و WebAuthn: login من غير password وضد الـ phishing
  71. 71الـ Threat Modeling بـ STRIDE: فكّر زي المهاجم قبل ما تكتب code
  72. 72الـ SQL Injection والـ Parameterization: الـ data ما تبقاش code
  73. 73الـ SSRF والـ Egress: ما تخليش الـ server بتاعك يزور الشبكة الداخلية
  74. 74الـ Security Headers والـ TLS: كل response يقول للـ browser يحمي المستخدم إزاي
  75. 75توقيع الـ Webhooks والـ Replay: الـ webhook ده جاي فعلًا من Stripe؟
  76. 76تغيير الأسرار والـ HMAC: إزاي تغيّر مفتاح من غير ما كل حاجة تقع
  77. 77سلسلة التوريد والـ SBOM: إنت واثق في ألف package ما تعرفهمش؟
  78. 78الـ Audit والـ Privacy Logs: سجّل مين عمل إيه، من غير ما تسجّل الأسرار
  79. 79اختبار الأمان و OWASP ASVS: الأمن جُوّه الـ CI، مش audit آخر السنة
  80. 80الـ Prototype Pollution والـ Resource DoS: request واحد يخلّي الكل admin أو يوقّع الـ server
  81. 81الـ SLI والـ SLO والـ Error Budget: إمتى تصحّي الـ on-call وإمتى تسيبه نايم
  82. 82الـ Event Loop Delay والـ ELU: لما Node نفسه يتخنق
  83. 83الـ Worker Threads والـ CPU Profiling: الشغل التقيل بره الـ event loop، والوقت راح فين
  84. 84الـ Memory والـ GC والـ Leaks: الـ process اللي بيكبر لحد ما يقع
  85. 85الـ N+1 Queries والـ DataLoader: صفحة واحدة بمِيّتين query
  86. 86الـ HTTP Caching والـ Compression: أسرع request هو اللي ما بيوصلش
  87. 87الـ Load Testing والـ Soak Testing: الـ server بيستحمل قد إيه بجد
  88. 88الـ Concurrency Limits والـ Bulkheads: dependency بطيئة ما توقعش الـ app كله
  89. 89الـ Timeouts والـ Retries والـ Circuit Breakers: إزاي تتعامل مع dependency بطيئة أو واقعة
  90. 90OpenTelemetry والـ Distributed Tracing: الـ request راح فين وضاع وقته فين
  91. 91Docker Layers والـ Build Context: ليه الـ build بياخد دقيقة وفيه الـ .env بتاعك
  92. 92Multi-stage Builds و Non-root: image صغيرة ومن غير root
  93. 93Docker Compose والـ Networks: الـ services بتلاقي بعض إزاي
  94. 94Docker Volumes: الـ data بتتحفَظ فين
  95. 95Healthcheck و Restart و Resource Limits: running مش معناها شغّال
  96. 96BuildKit والـ Build Secrets: الـ token ما يدخلش الـ image
  97. 97Reverse Proxy و TLS: اللي واقف قدام الـ app
  98. 98Multi-arch Images والـ Native Modules: اشتغلت عندي
  99. 99CI/CD و Rollback و Canary: الـ deploy يبقى ممل
  100. 100Kubernetes من الأول: Pods و Deployments و Services و Probes
  101. 101Modular Monolith و DDD: حدود واضحة من غير network
  102. 102Transactional Outbox و Inbox: الـ event ما يضيعش وما يتنفذش مرتين
  103. 103Sagas: عملية واحدة على تلات services من غير transaction واحدة
  104. 104CQRS و Event Sourcing: الـ events هي الحقيقة
  105. 105الـ Queues والـ Brokers: BullMQ و RabbitMQ و Kafka و SQS
  106. 106Realtime على أكتر من instance: Redis pub/sub و presence و resume
  107. 107الـ Object Storage والـ Media: presigned URLs و uploads مباشرة
  108. 108التكامل مع الـ Email والـ Search: retries و webhooks و indexes
  109. 109GraphQL و gRPC في الإنتاج: contracts و DataLoader و limits و deadlines
  110. 110Kafka على أكتر من zone و region: الـ replication والـ ISR والـ acks والـ MirrorMaker والـ failover
  111. 111TypeScript و runtime boundaries: الـ types بتختفي، والـ schemas لأ
  112. 112ORM ولا SQL: query builders و repositories و migrations و transactions
  113. 113الـ Serverless من جُوّه: cold starts و freeze و timeouts و connections
  114. 114الـ Testing Pyramid: unit و integration و e2e على Postgres حقيقية
  115. 115Contract Testing و Property-Based Testing بـ fast-check
  116. 116الـ Payments: idempotency و webhooks و refunds و reconciliation
  117. 117الـ Timezones والـ Internationalization: UTC و DST والـ locales والـ plurals والفلوس
  118. 118الـ Privacy والـ Data Retention: consent و export و erasure و crypto shredding
  119. 119الـ ADRs والـ Feature Flags: القرارات المكتوبة والـ rollout من غير deploy
  120. 120Multi-region active-active: حل الـ conflicts بـ HLC و CRDTs
  121. 121Readiness و Liveness و Startup Probes: الـ pod جاهز ولا عايش؟
  122. 122Incident Runbooks: من الـ alert للـ postmortem