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.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Firebase Hosting si integra con i framework web moderni più diffusi, tra cui Angular
e Next.js. Utilizzando Firebase Hosting e Cloud Functions for Firebase con questi framework, puoi sviluppare app e microservizi nell'ambiente del framework che preferisci ed eseguirne il deployment in un ambiente server gestito e sicuro.
Il supporto durante questa anteprima iniziale include le seguenti funzionalità:
Esegui il deployment di app web costituite da contenuti web statici
Esegui il deployment di app web che utilizzano il prerendering / la generazione di siti statici (SSG)
Esegui il deployment di app web che utilizzano il rendering lato server (SSR), ovvero il rendering completo del server on demand
Firebase fornisce questa funzionalità tramite l'interfaccia a riga di comando Firebase. Quando inizializzi
Hosting dalla riga di comando, fornisci informazioni sul tuo progetto web nuovo o esistente e la CLI configura le risorse giuste per il framework web scelto.
Prima di iniziare
Prima di iniziare a eseguire il deployment dell'app su Firebase,
esamina i seguenti requisiti e opzioni:
Firebase CLI versione 12.1.0 o successive. Assicurati di
installare la CLI
utilizzando il tuo metodo preferito.
(Facoltativo) Fatturazione abilitata nel tuo progetto Firebase
(obbligatorio se prevedi di utilizzare il rendering lato server)
Pubblica localmente
Per testare l'integrazione localmente:
Esegui firebase emulators:start dal terminale. In questo modo viene creata l'app e
viene pubblicata utilizzando l'interfaccia a riga di comando Firebase.
Apri l'app web all'URL locale restituito dalla CLI (di solito http://localhost:5000).
Esegui il deployment dell'app su Firebase Hosting
Quando è tutto pronto per condividere le modifiche con il mondo, esegui il deployment dell'app sul tuo sito live:
Esegui firebase deploy dal terminale.
Controlla il tuo sito web su: SITE_ID.web.app o PROJECT_ID.web.app (o sul tuo dominio personalizzato, se ne hai configurato uno).
Configurare ambienti diversi
Puoi eseguire il deployment di più set di variabili di ambiente per diversi ambienti di progetto, ad esempio gestione temporanea e produzione.
Come Cloud Functions for Firebase, questo strumento supporta il formato di file dotenv per caricare le variabili di ambiente specificate in un file .env.
Se hai un alias di progetto staging, puoi eseguire il deployment delle variabili di ambiente da un file .env.staging.
Se hai un alias di progetto production, puoi eseguire il deployment delle variabili di ambiente da un file .env.production.
Se hai un progetto con ID PROJECT_ID, puoi eseguire il deployment delle variabili di ambiente da un file .env.PROJECT_ID.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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)"]]