Thuta Learning
How the Web Works
BasicWeb Developmentbeginner

Client/Server နဲ့ Frontend/Backend

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Client/Server နဲ့ Frontend/Backend concept ကို နားလည်ရှင်းပြနိုင်ရန်
  • Diagram ကို ဖတ်ပြီး request/data/event ဘယ်လိုစီးဆင်းသလဲ ခြေရာခံနိုင်ရန်
  • ဒီ piece က web architecture တစ်ခုလုံးထဲမှာ ဘယ်လို ဆက်စပ်နေသလဲ ရှင်းပြနိုင်ရန်

နားလည်ထားရမယ့် အချက်

Client ဆိုတာ request တင်သွင်းသူပါ — browser, mobile app, desktop app, ဒါမှမဟုတ် server တစ်ခုကိုယ်တိုင်ကတောင် client ဖြစ်နိုင်ပါတယ်။ Server ဆိုတာ ဒီ request ကို လက်ခံပြီး service ပေးဆောင်သူပါ။

Layerတာဝန်
FrontendUI, user interaction, form/input, layout/style (framework ရွေးချယ်မှု နှိုင်းယှဉ်ခြင်း မလုပ်)
Backendauthentication, business logic, database access, API endpoint ဖော်ဆောင်ခြင်း

Rigid binary မဟုတ်ပါဘူး

Modern framework တစ်ချို့ (server components, full-stack meta-framework) တွေက frontend/backend line ကို ဝေဝါးစေတတ်ပါတယ်။

Full-stack ဆိုတာ layer နှစ်ခုစလုံးကို ကျော်ဖြတ်ပြီး အလုပ်လုပ်နိုင်တာကို ဆိုလိုတာပါ — technology အားလုံးကို mastery ရှိစေရမယ်လို့ မဆိုလိုပါဘူး။

text
CLIENT/SERVER AND FRONTEND/BACKEND
----------------------------------
CLIENT  --- request  --->  SERVER
CLIENT  <-- response ----  SERVER

In a typical web app:

BROWSER --> FRONTEND --> BACKEND --> DATABASE / SERVICES
  (user)     (UI layer)   (logic)      (data + other APIs)

လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်

code ဥပမာမှာ task ကို describe လုပ်တဲ့ string တစ်ခုကို input အဖြစ်ယူပြီး keyword-based rule set သုံးပြီး Frontend/Backend/Both/Unclear အဖြစ် classify လုပ်တဲ့ function ကို run ကြည့်ပါမယ်။

  • "Render a button" -> Frontend keyword ရှိလို့ Frontend
  • "Validate a password / Query the database / Authorize a request" -> Backend keyword ရှိလို့ Backend
  • "Animate a dropdown menu" -> "animat" keyword ရှိလို့ Frontend

ဒီလို classification ဟာ ရိုးရှင်းတဲ့ heuristic ပါ — real task တွေမှာ boundary ဝေဝါးတတ်တာကို ပြသဖို့ "Both" category ပါ ထည့်ထားပါတယ်။

အတူတူ စမ်းရေးကြည့်မယ်

javascript
const BACKEND_KEYWORDS = [
  "database", "auth", "password", "server", "api endpoint",
  "business logic", "authorize", "store data", "query",
];
const FRONTEND_KEYWORDS = [
  "render", "button", "layout", "animat", "display",
  "form field", "click", "style", "screen",
];

function classifyTask(task) {
  const lower = task.toLowerCase();
  const isBackend = BACKEND_KEYWORDS.some((k) => lower.includes(k));
  const isFrontend = FRONTEND_KEYWORDS.some((k) => lower.includes(k));

  if (isBackend && !isFrontend) return "Backend";
  if (isFrontend && !isBackend) return "Frontend";
  if (isFrontend && isBackend) return "Both (spans frontend and backend)";
  return "Unclear";
}

const tasks = [
  "Render a button on the page",
  "Validate a password against the stored hash",
  "Query the database for a user's orders",
  "Animate a dropdown menu opening",
  "Authorize a request using an API key",
  "Display a form field's error message",
];

for (const task of tasks) {
  console.log(`"${task}" -> ${classifyTask(task)}`);
}
You should see
"Render a button on the page" -> Frontend
"Validate a password against the stored hash" -> Backend
"Query the database for a user's orders" -> Backend
"Animate a dropdown menu opening" -> Frontend
"Authorize a request using an API key" -> Backend
"Display a form field's error message" -> Frontend

၅ မိနစ် စမ်းကြည့်

"Style a button and save its click count to the database" ဆိုတဲ့ task string အသစ်တစ်ခု ထည့်ပြီး run ကြည့်ပါ။ ဘာ classification ရလဒ် ထွက်လာမလဲ ခန့်မှန်းပါ — "style" (Frontend keyword) နဲ့ "database" (Backend keyword) နှစ်ခုစလုံး ပါဝင်နေတာကို သတိပြုပါ။

သတိလေးတစ်ချက်

Frontend ဆိုတာ "appearance" ပဲလို့ ရိုးရှင်းစွာ ထင်တတ်ကြတယ် — client-side logic, state management, API call တွေလည်း frontend ရဲ့ အစိတ်အပိုင်းပါ

Frontend/backend ကို framework အလိုက် rigid category လို့ ယူဆတတ်ကြတယ် — modern framework တွေမှာ boundary က ဝေဝါးတတ်ပါတယ်

MDN Web Docs — Client-Server overviewHow the Web Works

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Frontend ဆိုတာ "appearance" ပဲလို့ ရိုးရှင်းစွာ ထင်တတ်ကြတယ် — client-side logic, state management, API call တွေလည်း frontend ရဲ့ အစိတ်အပိုင်းပါ
  • Frontend/backend ကို framework အလိုက် rigid category လို့ ယူဆတတ်ကြတယ် — modern framework တွေမှာ boundary က ဝေဝါးတတ်ပါတယ်
  • ဒီ course က system map တစ်ခုပါ — REST/DNS/Database/Security ကို နက်နက်ရှိုင်းရှိုင်း လေ့လာချင်ရင် API Tutorial, Cloud & Deployment, SQL, Cybersecurity tutorial တွေဆီ ဆက်သွားပါ။

လေ့ကျင့်ခန်း

"Style a button and save its click count to the database" ဆိုတဲ့ task string အသစ်တစ်ခု ထည့်ပြီး run ကြည့်ပါ။ ဘာ classification ရလဒ် ထွက်လာမလဲ ခန့်မှန်းပါ — "style" (Frontend keyword) နဲ့ "database" (Backend keyword) နှစ်ခုစလုံး ပါဝင်နေတာကို သတိပြုပါ။

You'll know it worked when: "Render a button on the page" -> Frontend "Validate a password against the stored hash" -> Backend "Query the database for a user's orders" -> Backend "Animate a dropdown menu opening" -> Frontend "Authorize a request using an API key" -> Backend "Display a form field's error message" -> Frontend

Client/Server နဲ့ Frontend/Backend | Thuta Learning