Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/luisumit/LaPreviaRestobar/llms.txt

Use this file to discover all available pages before exploring further.

La Previa Restobar relies on Firebase for its real-time backend — orders, tables, and product data are all synchronized through Firebase Realtime Database, while Firebase Authentication controls who can read and write that data. Follow the steps below to provision a Firebase project and wire it up to the Android app.
1

Create a Firebase project

Go to console.firebase.google.com and click Add project.
  • Give the project a name (the existing project alias in this repository is laprevia-restobar).
  • Optionally enable Google Analytics when prompted.
  • Once the project is created, click Add app, choose the Android platform, and register the package name com.laprevia.restobar.
The .firebaserc at the repository root pins the default project alias:
.firebaserc
{
  "projects": {
    "default": "laprevia-restobar"
  }
}
If you are working with your own Firebase project, update this alias by running firebase use --add from the repository root after installing the Firebase CLI.
2

Enable Firebase Realtime Database

In the Firebase console, navigate to Build → Realtime Database and click Create database. Choose a region and start in locked mode — you will deploy the correct rules in the next step.The database security rules are stored in database.rules.json at the repository root. Deploy them with the Firebase CLI:
firebase deploy --only database
The file firebase.json tells the CLI where to find the rules:
firebase.json
{
  "hosting": {
    "public": "public-menu",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },
  "database": {
    "rules": "database.rules.json"
  }
}
The rules themselves enforce the following access model:
database.rules.json
{
  "rules": {
    "products": {
      ".read": true,
      ".write": "auth != null"
    },
    "tables": {
      ".read": "auth != null",
      ".write": "auth != null"
    },
    "orders": {
      ".read": "auth != null",
      ".write": "auth != null"
    },
    ".read": false,
    ".write": false
  }
}
The products node is publicly readable so that the digital menu (hosted via Firebase Hosting) can display items without requiring a login. Every other node — tables, orders, and all paths not explicitly listed — requires an authenticated user.
Firebase persistence is also enabled inside FirebaseModule.kt so the app can operate offline:
app/src/main/java/com/laprevia/restobar/di/FirebaseModule.kt
@Provides
@Singleton
fun provideFirebaseDatabase(): FirebaseDatabase {
    return FirebaseDatabase.getInstance().apply {
        try {
            setPersistenceEnabled(true)
        } catch (e: Exception) {
            // already configured
        }
    }
}
3

Enable Firebase Authentication

In the Firebase console, go to Build → Authentication and click Get started. On the Sign-in method tab, enable the Email/Password provider.The app obtains a FirebaseAuth singleton through Hilt:
app/src/main/java/com/laprevia/restobar/di/FirebaseModule.kt
@Provides
@Singleton
fun provideFirebaseAuth(): FirebaseAuth {
    return Firebase.auth
}
Database rules depend on auth != null, so Authentication must be active before any staff member can sign in and interact with orders or tables.
4

Enable Firebase App Check with Play Integrity

In the Firebase console, go to Build → App Check. Select your Android app and choose Play Integrity as the provider. Click Save.App Check prevents unauthorized clients from accessing your Firebase backend. During development, register a debug token so local and CI builds can still call Firebase:
  1. In the Firebase console, open App Check → Apps, click the overflow menu on your Android app, and select Manage debug tokens.
  2. Click Add debug token, copy the generated token.
  3. On the device or emulator, the firebase-appcheck-debug library (already included as a dependency) prints a local debug token to Logcat on first launch. Register that token in the console as well.
The Gradle dependency for App Check is already declared in app/build.gradle.kts:
implementation("com.google.firebase:firebase-appcheck-playintegrity")
implementation("com.google.firebase:firebase-appcheck-debug")
Debug App Check tokens are only valid for development. Release builds use Play Integrity automatically — no additional configuration is required in the app code.
5

Download google-services.json and place it in app/

In the Firebase console, open Project settings (the gear icon) and scroll to Your apps. Click google-services.json to download the configuration file.Move the downloaded file into the app/ directory:
LaPreviaRestobar/
└── app/
    └── google-services.json   ← place it here
The com.google.gms.google-services Gradle plugin (already applied in app/build.gradle.kts) reads this file at build time and generates the Firebase initialization resources automatically.
google-services.json is listed in .gitignore and must never be committed to version control. It contains your Firebase project’s API keys and configuration. For CI/CD, store the full file content as the GitHub Secret GOOGLE_SERVICES_JSON — see the Local Properties page for details.
6

Enable Firebase Crashlytics and Performance Monitoring

Both services are already wired into the build — no extra console setup is required beyond enabling them for your project.In the Firebase console:
  • Crashlytics: Go to Release & Monitor → Crashlytics and click Enable Crashlytics.
  • Performance Monitoring: Go to Release & Monitor → Performance and click Get started.
The corresponding Gradle plugins are applied at the top of app/build.gradle.kts:
app/build.gradle.kts
plugins {
    id("com.google.firebase.firebase-perf")
    id("com.google.firebase.crashlytics")
}
And the runtime dependencies are pulled in via the Firebase BOM:
implementation(platform("com.google.firebase:firebase-bom:33.1.2"))
implementation("com.google.firebase:firebase-perf-ktx")
implementation("com.google.firebase:firebase-crashlytics-ndk")
Crashlytics NDK support is included to capture native crash reports. Performance Monitoring instruments network requests and app start time automatically.
Crash reports are only sent in release builds by default. Run a release build and force a test crash with FirebaseCrashlytics.getInstance().recordException(RuntimeException("test")) to verify the integration before shipping.

Build docs developers (and LLMs) love