Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Firebase Realtime Database è un database ospitato sul cloud. I dati vengono archiviati come
JSON e sincronizzati in tempo reale con ogni client connesso. Quando crei
app multipiattaforma con i nostri SDK per Android, piattaforme Apple e JavaScript,
tutti i tuoi client condividono un'istanza Realtime Database e ricevono automaticamente
gli aggiornamenti con i dati più recenti.
Possiamo utilizzare qualsiasi URL Firebase Realtime Database come endpoint REST. Tutto ciò che dobbiamo fare è aggiungere .json alla fine dell'URL e inviare una richiesta dal nostro client HTTPS preferito.
Crea un account
Innanzitutto, registrati per un account senza costi nella console Firebase. Verrà creata una nuova app Firebase con un URL univoco che termina con firebaseio.com. Utilizzerai questo URL per autenticare gli utenti e
per archiviare e sincronizzare i dati nel database dell'app.
All'interno della console Firebase puoi creare, gestire ed eliminare le app Firebase. Se fai clic su un'app Firebase specifica, puoi visualizzare e modificare il database dell'app in tempo reale. Nella dashboard dell'app puoi anche impostare
Firebase Realtime Database Security Rules, gestire l'autenticazione, i deployment e visualizzare le analisi dell'app.
Crea un database
Vai alla sezione Realtime Database della
console Firebase.
Ti verrà chiesto di selezionare un progetto Firebase esistente.
Segui il flusso di lavoro di creazione del database.
Seleziona una modalità iniziale per Firebase Security Rules:
Modalità di prova
Ideale per iniziare a utilizzare le librerie client web e mobile,
ma consente a chiunque di leggere e sovrascrivere i tuoi dati. Dopo il test, assicurati
di esaminare la sezione Comprendere le regole di Firebase Realtime Database.
Per iniziare a utilizzare l'SDK per il web, Apple o Android, seleziona testmode.
Modalità di blocco
Nega tutte le operazioni di lettura e scrittura dei client web e su dispositivi mobili.
I server delle applicazioni autenticati possono comunque accedere al database.
Scegli una posizione per il database.
A seconda della
posizione del database, l'URL
del nuovo database avrà uno dei seguenti formati:
DATABASE_NAME.firebaseio.com (per i database in us-central1)
DATABASE_NAME.REGION.firebasedatabase.app
(per i database in tutte le altre località)
Fai clic su Fine.
Quando abiliti Realtime Database, viene abilitata anche l'API in
Cloud API Manager.
Scegliere una libreria helper
Puoi leggere e scrivere dati tramite l'API REST direttamente dalla riga di comando.
In questa guida utilizzeremo cURL
per tutti gli esempi. Abbiamo anche diverse librerie helper di terze parti per
interagire con l'API REST dal tuo linguaggio preferito. Puoi utilizzare una delle seguenti librerie helper o crearne una personalizzata:
[null,null,["Ultimo aggiornamento 2025-07-25 UTC."],[],[],null,["\u003cbr /\u003e\n\nThe Firebase Realtime Database is a cloud-hosted database. Data is stored as\nJSON and synchronized in realtime to every connected client. When you build\ncross-platform apps with our Android, Apple platforms, and JavaScript SDKs,\nall of your clients share one Realtime Database instance and automatically receive\nupdates with the newest data.\n\nWe can use any Firebase Realtime Database URL as a REST endpoint. All we need\nto do is append `.json` to the end of the URL and send a request from\nour favorite HTTPS client.\n\nCreate an Account\n\nFirst sign up for an account at no cost in the [Firebase console](//console.firebase.google.com/). A new\nFirebase app will be created for you with a unique URL ending in\n`firebaseio.com`. You'll use this URL to authenticate your users and\nto store and sync data to the app's database.\n\nWithin the [Firebase console](//console.firebase.google.com/) you can create, manage and delete Firebase\napps. Clicking on a specific Firebase app lets you view and modify your app's\ndatabase in real time. In your app dashboard, you can also set\nFirebase Realtime Database Security Rules, manage your\napp's authentication, deploys, and view analytics.\n\nCreate a Database\n\n1. Navigate to the **Realtime Database** section of the\n [Firebase console](https://console.firebase.google.com/project/_/database).\n You'll be prompted to select an existing Firebase project.\n Follow the database creation workflow.\n\n2. Select a starting mode for your Firebase Security Rules:\n\n Test mode\n\n : Good for getting started with the mobile and web client libraries,\n but allows anyone to read and overwrite your data. After testing, **make\n sure to review the [Understand Firebase Realtime Database Rules](/docs/database/security)\n section.**\n\n :\n | **Note:** If you create a database in Test mode and make no changes to the default world-readable and world-writeable Rules within a trial period, you will be alerted by email, then your database rules will deny all requests. Note the expiration date during the Firebase console setup flow.\n\n : To get started with the web, Apple, or Android SDK, select testmode.\n\n Locked mode\n\n : Denies all reads and writes from mobile and web clients.\n Your authenticated application servers can still access your database.\n\n3. Choose a location for the database.\n\n Depending on the\n [location of the database](/docs/projects/locations#rtdb-locations), the\n URL for the new database will be in one of the following forms:\n - \u003cvar translate=\"no\"\u003eDATABASE_NAME\u003c/var\u003e`.firebaseio.com` (for\n databases in `us-central1`)\n\n - \u003cvar translate=\"no\"\u003eDATABASE_NAME\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e`.firebasedatabase.app`\n (for databases in all other locations)\n\n4. Click **Done**.\n\nWhen you enable Realtime Database, it also enables the API in the\n[Cloud API Manager](https://console.cloud.google.com/projectselector/apis/api/firebasedatabase.googleapis.com/overview).\n\nChoose a Helper Library\n\nYou can read and write data through the REST API directly from the command line.\nIn this guide we'll use [cURL](https://en.wikipedia.org/wiki/CURL)\nfor all of our examples. We also have several third-party helper libraries for\ninteracting with the REST API from your favorite language. You can use one of\nthe following helper libraries or create your own: \n\n| Language | Libraries |\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Clojure | [taika](https://github.com/cloudfuji/taika) by [Cloudfuji](https://github.com/cloudfuji/) |\n| Dart | [IO Client](https://github.com/firebase/firebase-dart#io-client) in the official [firebase-dart](https://pub.dartlang.org/packages/firebase) library |\n| Go | [Firego](https://github.com/zabawaba99/firego) by [Steven Berlanga](https://github.com/zabawaba99) and [Tim Gossett](https://github.com/MrGossett) [Go Firebase](https://github.com/JustinTulloss/firebase) by Cosmin Nicolaescu and Justin Tulloss |\n| Java | [firebase4j](https://github.com/bane73/firebase4j) by [Brandon Gresham](https://twitter.com/bane73) |\n| Perl | [Firebase-Perl](https://metacpan.org/pod/Firebase) by Kiran Kumar and JT Smith |\n| PHP | [firebase-php](https://github.com/kreait/firebase-php) by [kreait](https://github.com/kreait) [firebase-php](https://github.com/ktamas77/firebase-php) by [Tamas Kalman](https://github.com/ktamas77) |\n| Python | [Pyrebase](https://github.com/thisbejim/Pyrebase) by [James Childs-Maidment](https://github.com/thisbejim) [python-firebase](http://ozgur.github.io/python-firebase/) by [Özgür Vatansever](https://github.com/ozgur) [python-firebase](https://github.com/mikexstudios/python-firebase) by [Michael Huynh](https://twitter.com/mikexstudios) |\n| Ruby | [firebase-ruby](https://github.com/oscardelben/firebase-ruby) by [Oscar Del Ben](https://twitter.com/oscardelben) [BigBertha](http://derailed.github.io/bigbertha) by [Fernand Galiana](https://twitter.com/kitesurfer) [rest-firebase](https://github.com/CodementorIO/rest-firebase) by [Codementor](https://www.codementor.io/) |\n\nNext Steps\n\n- Learn how to [structure data](/docs/database/rest/structure-data) for Realtime Database.\n- [Save data.](/docs/database/rest/save-data)\n- [Retrieve data.](/docs/database/rest/retrieve-data)\n- [View your database in the Firebase console.](https://console.firebase.google.com/project/_/database/data)"]]