Firebase Setup Guide
Full guide on how to setup DecentIoT with Firebase RTDB + Auth.
This guide covers creating a Firebase project, enabling Realtime Database, enabling Email/Password auth, creating a web app, and obtaining the SDK config to provide DecentIoT with the necessary credentials.
Note: Realtime Database (RTDB) and Firebase Authentication are used by DecentIoT's Firebase integration. If you prefer device-to-cloud communications with MQTT, skip to the MQTT Guide.
Create Firebase project
-
Click Add project → enter a name (e.g., decentiot-demo).
-
Follow the wizard and finish
Enable Realtime Database
-
In your Firebase project console → Realtime Database (left menu).
-
Click Create database.
-
Choose location and start in Locked mode (recommended). You can temporarily set rules to test; secure them before production.
-
After creation copy the Database URL — you'll need it (e.g., https://decentiot-demo-default-rtdb.firebaseio.com).
Enable Authentication (Email/Password)
-
Go to Authentication → Sign-in method.
-
Enable Email/Password provider.
-
Optionally enable Anonymous sign-in for test devices.
Add a test user
-
In Authentication → Users → Add user.
-
Create an email/password test account for your web/mobile login or test device flow.
Create a Web App (get SDK config)
-
Go to Project Overview → click
</>
icon to add web app. -
Give it a name and register the app.
-
Firebase will show a config snippet like this:
{
"apiKey": "AIzaSyXXX-XXXX",
"authDomain": "decentiot-demo.firebaseapp.com",
"databaseURL": "https://decentiot-demo-default-rtdb.firebaseio.com",
"projectId": "decentiot-demo",
"storageBucket": "decentiot-demo.appspot.com",
"messagingSenderId": "1234567890",
"appId": "1:1234567890:web:abcdef12345"
}
- Copy this block and paste it into your DecentIoT Project Settings → Firebase config field.
Setup Realtime Database rules
- For Development use:
Important: these rules are permissive for quick testing. Do not use in production.
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
- For Production use:
Recommended production rule (example), users can only access their projects. Adjust based on your platform's metadata structure.
{
"rules": {
"decentiot": {
"$projectId": {
".read": "auth != null && root.child('metadata').child($projectId).child('owner').val() === auth.uid",
".write": "auth != null && root.child('metadata').child($projectId).child('owner').val() === auth.uid"
}
}
}
}
Verify connection in DecentIoT
- Paste Firebase config into DecentIoT project settings → click Verify. Platform will attempt to authenticate (using a test user token) and read/write to the configured DB path.
Device integration (options)
-
Direct device to Firebase: use the Firebase ESP Client library (Mobizt) for ESP32/ESP8266. This supports RTDB streaming and writes.
-
Recommended simpler path: use MQTT as a bridge or use your DecentIoT Library to mediate authentication and sync. (MQTT is usually simpler for constrained devices.)
There you go! 🎉. You've successfully set up DecentIoT with Firebase RTDB + Auth.