আপনার জাভাস্ক্রিপ্ট প্রকল্পে Firebase যোগ করার বিকল্প উপায়
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
বেশিরভাগ Firebase ওয়েব অ্যাপের জন্য আমরা দৃঢ়ভাবে npm এর মাধ্যমে SDK ব্যবহার করার পরামর্শ দিই। যাইহোক, বিশেষ প্রয়োজনীয় ব্যবহারকারীদের জন্য, Firebase SDK যোগ করার বিকল্প উপায় প্রদান করে। এই পৃষ্ঠাটি এই বিকল্প পদ্ধতিগুলির জন্য বিস্তারিত সেটআপ নির্দেশাবলী প্রদান করে:
আপনি FirebaseJavaScript SDK-এর আংশিক আমদানি কনফিগার করতে পারেন এবং শুধুমাত্র আপনার প্রয়োজনীয় Firebase পণ্যগুলি লোড করতে পারেন৷ Firebase আমাদের গ্লোবাল CDN (কন্টেন্ট ডেলিভারি নেটওয়ার্ক) FirebaseJavaScript SDK-এর প্রতিটি লাইব্রেরি সঞ্চয় করে।
শুধুমাত্র নির্দিষ্ট ফায়ারবেস পণ্যগুলি অন্তর্ভুক্ত করতে (উদাহরণস্বরূপ, Authentication এবং Cloud Firestore ), আপনার <body> ট্যাগের নীচে নিম্নলিখিত স্ক্রিপ্টটি যুক্ত করুন, তবে আপনি যে কোনও ফায়ারবেস পরিষেবা ব্যবহার করার আগে:
<body>
<!--InsertthisscriptatthebottomoftheHTML,butbeforeyouuseanyFirebaseservices-->
<scripttype="module">
import{initializeApp}from'https://www.gstatic.com/firebasejs/12.1.0/firebase-app.js'// If you enabled Analytics in your project, add the Firebase SDK for Google Analyticsimport{getAnalytics}from'https://www.gstatic.com/firebasejs/12.1.0/firebase-analytics.js'// Add Firebase products that you want to useimport{getAuth}from'https://www.gstatic.com/firebasejs/12.1.0/firebase-auth.js'import{getFirestore}from'https://www.gstatic.com/firebasejs/12.1.0/firebase-firestore.js'</script>
</body>
আপনার Firebase কনফিগারেশন অবজেক্ট যোগ করুন, এবং তারপর আপনার অ্যাপে Firebase আরম্ভ করুন:
<body>
<scripttype="module">
// ...// TODO: Replace the following with your app's Firebase configurationconstfirebaseConfig={// ...};// Initialize Firebaseconstapp=initializeApp(firebaseConfig);</script>
</body>
Node.js অ্যাপস
FirebaseJavaScript SDK ইনস্টল করুন:
আপনার যদি ইতিমধ্যে একটি package.json ফাইল না থাকে, তাহলে আপনার JavaScript প্রকল্পের রুট থেকে নিম্নলিখিত কমান্ডটি চালিয়ে একটি তৈরি করুন:
npm init
firebase এনপিএম প্যাকেজ ইনস্টল করুন এবং রান করে আপনার package.json ফাইলে সংরক্ষণ করুন:
npm install --save firebase@12.1.0
আপনার অ্যাপে Firebase মডিউল ব্যবহার করতে নিম্নলিখিত বিকল্পগুলির মধ্যে একটি ব্যবহার করুন:
আপনার যেকোনো জাভাস্ক্রিপ্ট ফাইল থেকে মডিউল require হতে পারে
// Firebase App (the core Firebase SDK) is always required and// must be listed before other Firebase SDKsvarfirebase=require("firebase/app");// Add the Firebase products that you want to userequire("firebase/auth");require("firebase/firestore");
পৃথক SDK-এর পরিবর্তে সমগ্র FirebaseJavaScript SDK অন্তর্ভুক্ত করুন (উৎপাদন অ্যাপের জন্য প্রস্তাবিত নয়)
varfirebase=require("firebase");
আপনি মডিউল import করতে ESM সিনট্যাক্স ব্যবহার করতে পারেন
// Firebase App (the core Firebase SDK) is always required and// must be listed before other Firebase SDKsimportfirebasefrom"firebase/app";// Add the Firebase services that you want to useimport"firebase/auth";import"firebase/firestore";
পৃথক SDK-এর পরিবর্তে সমগ্র FirebaseJavaScript SDK অন্তর্ভুক্ত করুন (উৎপাদন অ্যাপের জন্য প্রস্তাবিত নয়)
importfirebasefrom"firebase";
আপনার Firebase কনফিগারেশন অবজেক্ট যোগ করুন, এবং তারপর আপনার অ্যাপে Firebase আরম্ভ করুন:
import{initializeApp}from'firebase/app';// TODO: Replace the following with your app's Firebase configurationconstfirebaseConfig={//...};// Initialize Firebaseconstapp=initializeApp(firebaseConfig);
[null,null,["2025-08-08 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Alternative ways to add Firebase to your JavaScript project\n\n\u003cbr /\u003e\n\nFor most Firebase web apps we strongly recommend using\n[the SDK via npm](/docs/web/setup).\nHowever, for users with special requirements, Firebase provides alternative\n[ways to add the SDK](/docs/web/learn-more#ways-to-add-web-sdks).\nThis page provides detailed setup instructions for these alternative methods:\n\n- CDN (content delivery network)\n- npm for Node.js apps\n\nUsing these methods, you can add any of the\n[available libraries](/docs/web/learn-more#available-libraries)\nto your app. \n\n### From the CDN\n\nYou can configure partial import of the Firebase JavaScript SDK and only load the\nFirebase products that you need. Firebase stores each library of the\nFirebase JavaScript SDK on our global CDN (content delivery network).\n\n1. To include only [specific Firebase products](/docs/web/learn-more#libraries-cdn)\n (for example, Authentication and Cloud Firestore), add the following\n script to the bottom of your `\u003cbody\u003e` tag, but before you use any\n Firebase services:\n\n ```javascript\n \u003cbody\u003e\n \u003c!-- Insert this script at the bottom of the HTML, but before you use any Firebase services --\u003e\n \u003cscript type=\"module\"\u003e\n import { initializeApp } from 'https://www.gstatic.com/firebasejs/12.1.0/firebase-app.js'\n\n // If you enabled Analytics in your project, add the Firebase SDK for Google Analytics\n import { getAnalytics } from 'https://www.gstatic.com/firebasejs/12.1.0/firebase-analytics.js'\n\n // Add Firebase products that you want to use\n import { getAuth } from 'https://www.gstatic.com/firebasejs/12.1.0/firebase-auth.js'\n import { getFirestore } from 'https://www.gstatic.com/firebasejs/12.1.0/firebase-firestore.js'\n \u003c/script\u003e\n \u003c/body\u003e\n ```\n | You can optionally [delay loading of Firebase SDKs](/docs/web/learn-more#delay-sdks-cdn) until the entire page has loaded.\n2. Add your Firebase configuration object, and then initialize Firebase in\n your app:\n\n ```javascript\n \u003cbody\u003e\n \u003cscript type=\"module\"\u003e\n // ...\n\n // TODO: Replace the following with your app's /docs/web/learn-more#config-object\n const firebaseConfig = {\n // ...\n };\n\n // Initialize Firebase\n const app = initializeApp(firebaseConfig);\n \u003c/script\u003e\n \u003c/body\u003e\n ```\n\n### Node.js apps\n\n| **Caution:** The following instructions are for using the Firebase JavaScript SDK as a client for end-user access (for example, in a Node.js desktop or IoT application). To set up administrative access from privileged environments (such as servers), [set up the Firebase Admin SDK](/docs/admin/setup) instead.\n\n1. Install the Firebase JavaScript SDK:\n\n 1. If you don't already have a `package.json` file, create one by\n running the following command from the root of your JavaScript\n project:\n\n ```\n npm init\n ```\n 2. Install the `firebase` npm package and save it to your\n `package.json` file by running:\n\n ```\n npm install --save firebase@12.1.0\n ```\n2. Use one of the following options to use the Firebase module in your app:\n\n - **You can `require` modules from any JavaScript file**\n\n To include only [specific Firebase products](/docs/web/learn-more#libraries-nodejs)\n (like Authentication and Cloud Firestore): \n\n // Firebase App (the core Firebase SDK) is always required and\n // must be listed before other Firebase SDKs\n var firebase = require(\"firebase/app\");\n\n // Add the Firebase products that you want to use\n require(\"firebase/auth\");\n require(\"firebase/firestore\");\n\n Include the entire Firebase JavaScript SDK, rather\n than individual SDKs\n *(not recommended for production apps)*\n | Loading the entire SDK is not efficient for production web apps. \n Use this option for development purposes only. \n\n ```javascript\n var firebase = require(\"firebase\");\n ```\n\n \u003cbr /\u003e\n\n - **You can use ESM syntax to `import` modules**\n\n To include only [specific Firebase products](/docs/web/learn-more#libraries-nodejs)\n (like Authentication and Cloud Firestore): \n\n // Firebase App (the core Firebase SDK) is always required and\n // must be listed before other Firebase SDKs\n import firebase from \"firebase/app\";\n\n // Add the Firebase services that you want to use\n import \"firebase/auth\";\n import \"firebase/firestore\";\n\n Include the entire Firebase JavaScript SDK, rather\n than individual SDKs\n *(not recommended for production apps)*\n | Loading the entire SDK is not efficient for production web apps. \n Use this option for development purposes only. \n\n ```python\n import firebase from \"firebase\";\n ```\n3. Add your Firebase configuration object, and then initialize Firebase in\n your app:\n\n ```javascript\n import { initializeApp } from 'firebase/app';\n\n // TODO: Replace the following with your app's /docs/web/learn-more#config-object\n const firebaseConfig = {\n //...\n };\n\n // Initialize Firebase\n const app = initializeApp(firebaseConfig);\n ```"]]