ফায়ারবেসের জন্য Cloud Functions হল একটি সার্ভারহীন ফ্রেমওয়ার্ক যা আপনাকে স্বয়ংক্রিয়ভাবে পটভূমি ইভেন্ট, HTTPS অনুরোধ, Admin SDK বা Cloud Scheduler কাজের দ্বারা ট্রিগার হওয়া ইভেন্টগুলির প্রতিক্রিয়া হিসাবে ব্যাকএন্ড কোড চালাতে দেয়৷ আপনার JavaScript, TypeScript বা Python কোড Google ক্লাউড অবকাঠামোতে সংরক্ষণ করা হয় এবং একটি পরিচালিত পরিবেশে চলে। আপনার নিজস্ব সার্ভার পরিচালনা এবং স্কেল করার কোন প্রয়োজন নেই।
ইতিমধ্যে Google Cloud ক্লাউড ফাংশন ব্যবহার করছেন? ফায়ারবেস কীভাবে ছবিতে ফিট করে সে সম্পর্কে আরও জানুন ।
ক্লাউড ফাংশনগুলির সাথে অ্যাডমিন SDK ব্যবহার করে Firebase বৈশিষ্ট্যগুলি জুড়ে একীভূত করুন এবং আপনার নিজস্ব ওয়েবহুকগুলি লিখে তৃতীয় পক্ষের পরিষেবাগুলির সাথে একীভূত করুন৷ Cloud Functions বয়লারপ্লেট কোড ছোট করে, আপনার ফাংশনের ভিতরে Firebase এবং Google Cloud ব্যবহার করা সহজ করে তোলে।
জিরো রক্ষণাবেক্ষণ
কমান্ড লাইন থেকে একটি কমান্ড দিয়ে আমাদের সার্ভারে আপনার জাভাস্ক্রিপ্ট, টাইপস্ক্রিপ্ট বা পাইথন কোড স্থাপন করুন। এর পরে, Firebase স্বয়ংক্রিয়ভাবে কম্পিউটিং সংস্থানগুলিকে আপনার ব্যবহারকারীদের ব্যবহারের ধরণগুলির সাথে মেলে। আপনি কখনই শংসাপত্র, সার্ভার কনফিগারেশন, নতুন সার্ভারের ব্যবস্থা করা বা পুরানোগুলি বাতিল করার বিষয়ে চিন্তা করবেন না।
আপনার যুক্তি ব্যক্তিগত এবং সুরক্ষিত রাখে
অনেক ক্ষেত্রে, ডেভেলপাররা ক্লায়েন্ট সাইড এড়াতে সার্ভারে অ্যাপ্লিকেশন লজিক নিয়ন্ত্রণ করতে পছন্দ করে। এছাড়াও, কখনও কখনও সেই কোডটিকে রিভার্স ইঞ্জিনিয়ার করার অনুমতি দেওয়া বাঞ্ছনীয় নয়। Cloud Functions সম্পূর্ণরূপে ক্লায়েন্ট থেকে নিরোধক, তাই আপনি নিশ্চিত হতে পারেন যে এটি ব্যক্তিগত এবং সর্বদা আপনি যা চান ঠিক তাই করে৷
এটা কিভাবে কাজ করে?
আপনি একটি ফাংশন লিখতে এবং স্থাপন করার পরে, Google এর সার্ভারগুলি অবিলম্বে ফাংশনটি পরিচালনা করতে শুরু করে৷ আপনি একটি HTTP অনুরোধ, Admin SDK , বা একটি নির্ধারিত কাজের সাথে সরাসরি ফাংশনটি ফায়ার করতে পারেন, অথবা, ব্যাকগ্রাউন্ড ফাংশনের ক্ষেত্রে, Google এর সার্ভারগুলি ইভেন্টগুলি শোনে এবং যখন এটি ট্রিগার হয় তখন ফাংশনটি চালায়৷
লোড বাড়লে বা কমে গেলে, Google আপনার ফাংশন চালানোর জন্য প্রয়োজনীয় ভার্চুয়াল সার্ভারের দৃষ্টান্তের সংখ্যা দ্রুত স্কেল করে সাড়া দেয়। প্রতিটি ফাংশন বিচ্ছিন্নভাবে চলে, নিজস্ব পরিবেশে নিজস্ব কনফিগারেশন সহ।
একটি ব্যাকগ্রাউন্ড ফাংশনের জীবনচক্র
আপনি একটি নতুন ফাংশনের জন্য কোড লিখুন, একটি ইভেন্ট প্রদানকারী নির্বাচন করুন (যেমন Cloud Firestore ), এবং ফাংশনটি কার্যকর করা উচিত এমন শর্তগুলি সংজ্ঞায়িত করুন৷
আপনি যখন আপনার ফাংশন স্থাপন করবেন:
Firebase CLI ফাংশন কোডের একটি .zip আর্কাইভ তৈরি করে, যা Cloud Functions আপনার প্রোজেক্টে একটি Artifact Registry রিপোজিটরি (নাম gcf-artifacts ) তৈরি করার আগে একটি Cloud Storage বাকেট ( gcf-sources সহ প্রিফিক্সড) এ আপলোড করা হয়।
Cloud Build ফাংশন কোড পুনরুদ্ধার করে এবং ফাংশন উত্স তৈরি করে। আপনি Google Cloud কনসোলেCloud Build লগ দেখতে পারেন।
বিল্ট ফাংশন কোডের জন্য কন্টেইনার ইমেজ আপনার প্রোজেক্টের একটি ব্যক্তিগত Artifact Registry রিপোজিটরিতে আপলোড করা হয়েছে (নাম দেওয়া হয়েছে gcf-artifacts ), এবং আপনার নতুন ফাংশন রোল আউট করা হয়েছে।
যখন ইভেন্ট প্রদানকারী একটি ইভেন্ট তৈরি করে যা ফাংশনের শর্তের সাথে মেলে, কোডটি আহ্বান করা হয়। ফাংশনটির সাথে একটি পরিষেবা অ্যাকাউন্ট সংযুক্ত রয়েছে যা Firebase Admin SDK এর সাহায্যে অন্যান্য Firebase পরিষেবাগুলি অ্যাক্সেস করতে ব্যবহার করা যেতে পারে৷
যদি ফাংশনটি অনেকগুলি ইভেন্ট পরিচালনা করতে ব্যস্ত থাকে, তাহলে Google দ্রুত কাজ পরিচালনা করার জন্য আরও উদাহরণ তৈরি করে। ফাংশন নিষ্ক্রিয় থাকলে, দৃষ্টান্তগুলি পরিষ্কার করা হয়।
আপনি যখন আপডেট করা কোড স্থাপন করে ফাংশন আপডেট করেন, Artifact Registry বিল্ড আর্টিফ্যাক্টের সাথে পুরানো সংস্করণের দৃষ্টান্তগুলি পরিষ্কার করা হয় এবং নতুন দৃষ্টান্ত দ্বারা প্রতিস্থাপিত হয়।
আপনি যখন ফাংশনটি মুছে ফেলেন, Artifact Registry সম্পর্কিত বিল্ড আর্টিফ্যাক্টগুলির সাথে সমস্ত দৃষ্টান্ত এবং জিপ সংরক্ষণাগারগুলি পরিষ্কার করা হয়। ফাংশন এবং ইভেন্ট প্রদানকারীর মধ্যে সংযোগ সরানো হয়।
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-08-15 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["Cloud Functions for Firebase \nplat_ios plat_android plat_web plat_flutter plat_cpp plat_unity \nCloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by background events, HTTPS requests, the Admin SDK, or Cloud Scheduler jobs. Your JavaScript, TypeScript or Python code is stored on Google Cloud infrastructure and runs in a managed environment. There's no need to manage and scale your own servers.\n\n\u003cbr /\u003e\n\nAlready using Cloud Functions in Google Cloud?\n[Learn more](/docs/functions/functions-and-firebase) about how Firebase fits\ninto the picture.\n\n[Get started](/docs/functions/get-started)\n[Use cases](/docs/functions/use-cases)\n\nKey capabilities\n\n|----------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Integrates Firebase features and connects Firebase with Google Cloud | The functions you write can respond to events generated by various Firebase and Google Cloud features, from [Firebase Authentication triggers](/docs/functions/auth-events) to [Cloud Storage Triggers](/docs/functions/gcp-storage-events). Integrate across Firebase features using the [Admin SDK](/docs/admin/setup) together with Cloud Functions, and integrate with third-party services by writing your own webhooks. Cloud Functions minimizes boilerplate code, making it easier to use Firebase and Google Cloud inside your function. |\n| Zero maintenance | Deploy your JavaScript, TypeScript, or Python code to our servers with one command from the command line. After that, Firebase automatically scales up computing resources to match the usage patterns of your users. You never worry about credentials, server configuration, provisioning new servers, or decommissioning old ones. |\n| Keeps your logic private and secure | In many cases, developers prefer to control application logic on the server to avoid tampering on the client side. Also, sometimes it's not desirable to allow that code to be reverse engineered. Cloud Functions is fully insulated from the client, so you can be sure it is private and always does exactly what you want. |\n\nHow does it work?\n\nAfter you write and deploy a function, Google's servers begin to manage the\nfunction immediately. You can fire the function directly with an HTTP request,\nthe Admin SDK, or a scheduled job, or, in the case of background functions,\nGoogle's servers listen for events and run the function when it is\ntriggered.\n\nAs the load increases or\ndecreases, Google responds by rapidly scaling the number of virtual server\ninstances needed to run your function. Each function runs in isolation, in its\nown environment with its own configuration.\n\nLifecycle of a background function\n\n1. You write code for a new function, selecting an event provider (such as Cloud Firestore), and defining the conditions under which the function should execute.\n2. When you deploy your function:\n 1. The Firebase CLI creates a `.zip` archive of the function code, which is then uploaded to a Cloud Storage bucket (prefixed with `gcf-sources`) before Cloud Functions creates an Artifact Registry repository (named `gcf-artifacts`) in your project.\n 2. Cloud Build retrieves the function code and builds the function source. You can view Cloud Build logs in the [Google Cloud console](//console.cloud.google.com/logs/query;query%3Dresource.type%253D%2522build%2522&sa=D&ust=1597179510979000&usg=AFQjCNG2BmFrgWjGoP83WiMrB2TLLXpBEQ).\n 3. The container image for the built functions code is uploaded to a private Artifact Registry repository in your project (named `gcf-artifacts`), and your new function is rolled out.\n3. When the event provider generates an event that matches the function's conditions, the code is invoked. The function has a service account attached to it that can be used to access other Firebase services with the help of the Firebase Admin SDK.\n4. If the function is busy handling many events, Google creates more instances to handle work faster. If the function is idle, instances are cleaned up.\n5. When you update the function by deploying updated code, instances for older versions are cleaned up along with build artifacts in Artifact Registry, and replaced by new instances.\n6. When you delete the function, all instances and zip archives are cleaned up, along with related build artifacts in Artifact Registry. The connection between the function and the event provider is removed.\n\nIn addition to listening for events with a background function, you can call\nfunctions directly with an HTTP request or a\n[call from the client](/docs/functions/callable). You can also trigger functions\non a fixed [schedule](/docs/functions/schedule-functions) or\n[enqueue task functions](/docs/functions/task-functions) via the Admin SDK.\n\nImplementation path\n\n|---|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | Set up Cloud Functions | Install the Firebase CLI and initialize Cloud Functions in your Firebase project. |\n| | Write functions | Write JavaScript code, TypeScript code, or Python code to handle events from Firebase services, Google Cloud services, or other event providers. |\n| | Test functions | Use the [local emulator](/docs/functions/local-emulator) to test your functions. |\n| | Deploy and monitor | Upgrade your project to the [pay-as-you-go Blaze pricing plan](/pricing) and deploy your functions using the Firebase CLI. You can then use the [Google Cloud console](//console.cloud.google.com/functions/list) to view and search through your logs. |\n\nNext steps\n\n- [Get started](/docs/functions/get-started) setting up, creating, and deploying functions.\n- Learn more about [what you can do with functions](/docs/functions/use-cases).\n- Try the [Cloud Functions codelab](https://codelabs.developers.google.com/codelabs/firebase-cloud-functions/#0)."]]