Firebase ဆိုတာ ဘာလဲ?
Firebase ဆိုတာ Google က ပံ့ပိုးထားတဲ့ Backend-as-a-Service platform ဖြစ်ပါတယ်။ ရိုးရိုး Web App တစ်ခုမှာ backend feature တွေထည့်ချင်ရင် server, database, authentication, file storage, deploy system စတာတွေကို ကိုယ်တိုင်တည်ဆောက်ရတတ်ပါတယ်။ Firebase ကတော့ အဲဒီအရာတွေကို service အနေနဲ့ အသင့်ပေးထားတာကြောင့် frontend developer တစ်ယောက်တည်းနဲ့လည်း လုပ်ငန်းသုံး app ပုံစံကို မြန်မြန်စနိုင်ပါတယ်။
Firebase ရဲ့အဓိက service များ
- Authentication — Email/Password, Google login, phone login စတဲ့ user account system များ
- Cloud Firestore — Collection/Document ပုံစံ NoSQL database
- Cloud Storage — Image, PDF, video, avatar စတဲ့ file များသိမ်းဆည်းခြင်း
- Firebase Hosting — Static website/app ကို CDN နဲ့ publish လုပ်ခြင်း
- Cloud Functions — Backend logic အချို့ကို serverless function အနေနဲ့ chạy ခြင်း
နားလည်လွယ်တဲ့ ဥပမာ
သင်က To-do App တစ်ခုဆောက်မယ်ဆိုပါစို့။ User တစ်ယောက်ချင်းစီ login ဝင်နိုင်ရမယ်၊ သူ့ todo list ကို database ထဲမှာသိမ်းရမယ်၊ profile image တင်နိုင်ရမယ်၊ website ကို online ပေါ်တင်ရမယ်။ Firebase သုံးရင် ဒီ feature တွေကို service တစ်ခုချင်းစီအဖြစ် ချိတ်ဆက်သွားနိုင်ပါတယ်။
Common mistake
Firebase config ကို public code ထဲမှာတွေ့ရတာတစ်ခုတည်းနဲ့ app ပျက်စီးသွားတာမဟုတ်ပေမဲ့ Security Rules မမှန်တာက အန္တရာယ်ကြီးပါတယ်။ Config ထက် rules ကို ပိုဂရုစိုက်ပါ။