If you are building server-rendered Angular or Next.js apps, check out next-generation Firebase App Hosting, a full-stack solution for modern web frameworks.
عند النشر باستخدام firebase deploy، ينشئ Firebase حزمة المتصفّح وحزمة الخادم، ويُجري العرض المسبق للتطبيق. يتم نشر هذه العناصر
في Hosting وCloud Functions for Firebase.
نشر مخصّص
يفترض Firebase CLI أنّ لديك تطبيقًا واحدًا محدّدًا في angular.json مع إعدادات إصدار الإنتاج.
إذا كنت بحاجة إلى تخصيص الافتراضات في واجهة سطر الأوامر، يمكنك استخدام متغير البيئة
FIREBASE_FRAMEWORKS_BUILD_TARGET أو إضافة
AngularFire وتعديل
angular.json:
اختياري: الدمج مع حزمة تطوير البرامج (SDK) لمنصة Firebase بلغة JavaScript
عند تضمين طرق Firebase JS SDK في حِزم الخادم والعميل، احرص على تجنُّب أخطاء وقت التشغيل من خلال التحقّق من isSupported() قبل استخدام المنتج.
لا تتوافق بعض المنتجات مع بعض البيئات.
اختياري: الدمج مع حزمة تطوير البرامج (SDK) الإدارية في Firebase
ستتعذّر حِزم المشرفين إذا تم تضمينها في إصدار المتصفّح، لذا ننصحك بتوفيرها في وحدة الخادم وإدخالها كعنصر اختياري:
عرض محتوى ديناميكي بالكامل باستخدام العرض من جهة الخادم
اختياري: الدمج مع خدمة "مصادقة Firebase"
تحافظ أدوات النشر المتوافقة مع إطار عمل الويب في Firebase تلقائيًا على مزامنة حالة العميل والخادم باستخدام ملفات تعريف الارتباط. سيتضمّن العنصر Express res.locals اختياريًا مثيلاً مصادقًا لتطبيق Firebase (firebaseApp) والمستخدم الذي سجّل الدخول حاليًا (currentUser). ويمكن إدخال ذلك في الوحدة النمطية من خلال رمز REQUEST المميز (الذي تم تصديره من @nguniversal/express-engine/tokens).
تاريخ التعديل الأخير: 2025-09-06 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-09-06 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["\u003cbr /\u003e\n\nWith the Firebase framework-aware CLI, you can deploy your Angular application\nto Firebase and serve dynamic content to your users.\n| **Note:** Framework-aware Hosting is an early public preview. This means that the functionality might change in backward-incompatible ways. A preview release is not subject to any SLA or deprecation policy and may receive limited or no support.\n| **Caution:** For developers creating a full-stack Angular app, we strongly recommend [Firebase App Hosting](/docs/app-hosting). If you're already using the frameworks experiment in the Firebase CLI, we recommend \"graduating\" to App Hosting. With App Hosting, you'll have a unified solution to manage everything from CDN to server-side rendering, along with improved GitHub integration.\n\nBefore you begin\n\nBefore you get started deploying your app to Firebase,\nreview the following requirements and options:\n\n- Firebase CLI version 12.1.0 or later. Make sure to [install the CLI](/docs/cli#install_the_firebase_cli) using your preferred method.\n- Optional: Billing enabled on your Firebase project\n (required if you plan to use SSR)\n\n- Optional: AngularFire\n\nInitialize Firebase\n\nTo get started, initialize Firebase for your framework project.\nUse the Firebase CLI for a new project, or modify `firebase.json` for an\nexisting project.\n\nInitialize a new project\n\n1. In the Firebase CLI, enable the web frameworks preview: \n\n ```\n firebase experiments:enable webframeworks\n ```\n2. Run the initialization command from the CLI and then follow the prompts:\n\n ```\n firebase init hosting\n ```\n\n \u003cbr /\u003e\n\n3. Answer yes to \"Do you want to use a web framework? (experimental)\"\n\n4. Choose your hosting source directory; this could be an existing Angular app.\n\n5. If prompted, choose Angular.\n\nInitialize an existing project\n\nChange your hosting config in `firebase.json` to have a `source` option, rather\nthan a `public` option. For example: \n\n {\n \"hosting\": {\n \"source\": \"./path-to-your-angular-workspace\"\n }\n }\n\nServe static content\n\nAfter initializing Firebase, you can serve static content with the standard\ndeployment command: \n\n firebase deploy\n\nPre-render dynamic content\n\nTo prerender dynamic content in Angular, you need to set up Angular SSR. \n\n ng add @angular/ssr\n\nSee the [Angular Prerendering (SSG) guide](https://angular.dev/guide/ssr)\nfor more information.\n\nOptional: add a server module\n\nDeploy\n\nWhen you deploy with `firebase deploy`, Firebase builds your browser bundle,\nyour server bundle, and prerenders the application. These elements are deployed\nto Hosting and Cloud Functions for Firebase.\n\nCustom deploy\n\nThe Firebase CLI assumes that you have a single application defined in your\n`angular.json` with a production build configuration.\n\nIf need to tailor the CLI's assumptions, you can either use the\n`FIREBASE_FRAMEWORKS_BUILD_TARGET` environment variable or add\n[AngularFire](https://github.com/angular/angularfire#readme) and modify your\n`angular.json`: \n\n {\n \"deploy\": {\n \"builder\": \"@angular/fire:deploy\",\n \"options\": {\n \"version\": 2,\n \"buildTarget\": \"OVERRIDE_YOUR_BUILD_TARGET\"\n }\n }\n }\n\nOptional: integrate with the Firebase JS SDK\n\nWhen including Firebase JS SDK methods in both server and client bundles, guard\nagainst runtime errors by checking `isSupported()` before using the product.\nNot all products are [supported in all environments](/docs/web/environments-js-sdk#other_environments).\n| **Tip:** consider using [AngularFire](https://github.com/angular/angularfire#readme), which does this for you automatically.\n\nOptional: integrate with the Firebase Admin SDK\n\nAdmin bundles will fail if they are included in your browser build, so consider\nproviding them in your server module and injecting as an optional dependency: \n\n // your-component.ts\n import type { app } from 'firebase-admin';\n import { FIREBASE_ADMIN } from '../app.module';\n\n @Component({...})\n export class YourComponent {\n\n constructor(@Optional() @Inject(FIREBASE_ADMIN) admin: app.App) {\n ...\n }\n }\n\n // app.server.module.ts\n import * as admin from 'firebase-admin';\n import { FIREBASE_ADMIN } from './app.module';\n\n @NgModule({\n ...\n providers: [\n ...\n { provide: FIREBASE_ADMIN, useFactory: () =\u003e admin.apps[0] || admin.initializeApp() }\n ],\n })\n export class AppServerModule {}\n\n // app.module.ts\n import type { app } from 'firebase-admin';\n\n export const FIREBASE_ADMIN = new InjectionToken\u003capp.App\u003e('firebase-admin');\n\nServe fully dynamic content with SSR\n\nOptional: integrate with Firebase Authentication\n\nThe web framework-aware Firebase deployment tooling automatically keeps client\nand server state in sync using cookies. The Express `res.locals` object will\noptionally contain an authenticated Firebase App instance (`firebaseApp`) and\nthe currently signed in user (`currentUser`). This can be injected into your\nmodule via the REQUEST token (exported from @nguniversal/express-engine/tokens)."]]