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.
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Firebase Hosting jest zintegrowany z popularnymi nowoczesnymi platformami internetowymi, takimi jak Angular i Next.js. Korzystając z usług Firebase Hosting i Cloud Functions for Firebase w tych platformach, możesz tworzyć aplikacje i mikroserwisy w wybranym środowisku platformy, a następnie wdrażać je w zarządzanym, bezpiecznym środowisku serwera.
W ramach tego wczesnego dostępu oferujemy następujące funkcje:
wdrażać aplikacje internetowe składające się ze statycznych treści internetowych;
Wdrażanie aplikacji internetowych, które korzystają z wstępnego renderowania lub generowania statycznych witryn (SSG)
wdrażanie aplikacji internetowych, które korzystają z renderowania po stronie serwera – pełne renderowanie serwera na żądanie;
Firebase udostępnia tę funkcję za pomocą interfejsu Firebase. Podczas inicjowania Hosting w wierszu poleceń podajesz informacje o nowym lub istniejącym projekcie internetowym, a CLI konfiguruje odpowiednie zasoby dla wybranego frameworka internetowego.
Zanim zaczniesz
Zanim zaczniesz wdrażać aplikację w Firebase, zapoznaj się z tymi wymaganiami i opcjami:
Opcjonalnie: włączone płatności w projekcie Firebase (wymagane, jeśli planujesz korzystać z renderowania po stronie serwera)
Wyświetlanie lokalne
Aby przetestować integrację lokalnie, wykonaj te czynności:
Uruchom firebase emulators:start w terminalu. Spowoduje to skompilowanie aplikacji i jej udostępnienie za pomocą interfejsu wiersza poleceń Firebase.
Otwórz aplikację internetową pod lokalnym adresem URL zwróconym przez interfejs CLI (zwykle http://localhost:5000).
Wdrażanie aplikacji w Firebase Hosting
Gdy wszystko będzie gotowe do udostępnienia zmian, wdróż aplikację w witrynie na żywo:
Uruchom firebase deploy w terminalu.
Sprawdź swoją witrynę na stronie SITE_ID.web.app lub PROJECT_ID.web.app (lub w domenie Twojej firmy, jeśli ją skonfigurujesz).
Konfigurowanie różnych środowisk
Możesz wdrożyć wiele zestawów zmiennych środowiskowych dla różnych środowisk projektu, takich jak środowisko przejściowe i produkcyjne.
Podobnie jak Cloud Functions dla Firebase, to narzędzie obsługuje format pliku dotenv do wczytywania zmiennych środowiskowych określonych w pliku .env.
Jeśli masz staging alias projektu, możesz wdrożyć zmienne środowiskowe z pliku .env.staging.
Jeśli masz production alias projektu, możesz wdrożyć zmienne środowiskowe z pliku .env.production.
Jeśli masz projekt o identyfikatorze PROJECT_ID, możesz wdrożyć zmienne środowiskowe z pliku .env.PROJECT_ID.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-08-31 UTC."],[],[],null,["\u003cbr /\u003e\n\nFirebase Hosting integrates with popular modern web frameworks including Angular\nand Next.js. Using Firebase Hosting and Cloud Functions for Firebase with these\nframeworks, you can develop apps and microservices in your preferred framework\nenvironment, and then deploy them in a managed, secure server environment.\n\nSupport during this early preview includes the following functionality:\n\n- Deploy Web apps comprised of static web content\n- Deploy Web apps that use pre-rendering / Static Site Generation (SSG)\n- Deploy Web apps that use server-side Rendering (SSR)---full server rendering on demand\n\nFirebase provides this functionality through the Firebase CLI. When initializing\nHosting on the command line, you provide information about your new or existing\nWeb project, and the CLI sets up the right resources for your chosen Web\nframework.\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\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 (required if you plan to use SSR)\n\nServe locally\n\nYou can test your integration locally by following these steps:\n\n1. Run `firebase emulators:start` from the terminal. This builds your app and serves it using the Firebase CLI.\n2. Open your web app at the local URL returned by the CLI (usually http://localhost:5000).\n\nDeploy your app to Firebase Hosting\n\nWhen you're ready to share your changes with the world, deploy your app to your\nlive site:\n\n1. Run `firebase deploy` from the terminal.\n2. Check your website on: `SITE_ID.web.app` or `PROJECT_ID.web.app` (or your custom domain, if you set one up).\n\nConfigure different environments\n\nYou can deploy multiple sets of environment variables for different project environments, such as staging and production.\n\nLike Cloud Functions for Firebase, this tooling supports the [dotenv](https://www.npmjs.com/package/dotenv) file format for loading environment variables specified in a .env file.\n\n- If you have a `staging` project alias, you can deploy environment variables from a `.env.staging` file.\n- If you have a `production` project alias, you can deploy environment variables from a `.env.production` file.\n- If you have a project with id `PROJECT_ID`, you can deploy environment variables from a `.env.PROJECT_ID` file.\n\nSee the [Cloud Functions documentation](https://firebase.google.com/docs/functions/config-env?gen=2nd#deploying_multiple_sets_of_environment_variables) for a detailed guide.\n\nNext steps\n\nSee the detailed guide for your preferred framework:\n\n- [Angular](/docs/hosting/frameworks/angular)\n- [Next.js](/docs/hosting/frameworks/nextjs)\n- [Flutter Web](/docs/hosting/frameworks/flutter)\n- [Frameworks with Express.js](/docs/hosting/frameworks/express)"]]