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.

The infra/ directory contains the Infrastructure-as-Code (IaC) foundation for La Previa Restobar. It is designed as a preparatory layer — not all resources are created by default — and its purpose is to automate and document the cloud and local environment so that future deployments are repeatable and auditable. The infrastructure is intentionally decoupled from the Android app’s main development flow and can be adopted incrementally.

Directory Structure

infra/
├── terraform/       # Google Cloud and Firebase resource provisioning
└── ansible/         # Local environment checks and Firebase Hosting deployment

Three Infrastructure Components

Terraform

Provisions Google Cloud Run, Artifact Registry, Firebase Realtime Database, IAM service accounts, and Secret Manager secrets. All resources are defined declaratively and managed through terraform apply.

Ansible

Runs environment verification tasks locally — checking for Node.js, Firebase CLI, and the Gradle Wrapper — and automates firebase deploy --only hosting for the QR digital menu.

Firebase CLI

Publishes Firebase Hosting and security rules independently of Terraform, using firebase deploy. The public digital menu (public-menu/index.html) is deployed this way.

Architecture

The following describes the end-to-end flow across all infrastructure components:
Android App

    │  HTTPS requests

Google Cloud Run  ──────────────────────────────────────────►  Firebase Realtime Database
(Express.js backend, port 3000)          (reads/writes menu, orders, tables)

    │  Docker image pulled from

Artifact Registry
(us-central1-docker.pkg.dev / laprevia-backend)

Firebase Hosting

    │  Public URL (QR code redirect)

public-menu/index.html
(static digital menu for restaurant guests)
  • The Android app communicates with the Cloud Run backend over HTTPS for all restaurant management operations.
  • The Cloud Run backend is an Express.js Node.js 18 service containerized via backend/Dockerfile and stored in Artifact Registry. It connects to Firebase Realtime Database and reads its credentials from Secret Manager at startup.
  • Firebase Hosting serves the static QR digital menu independently from the backend. It is deployed via the Firebase CLI or the Ansible deploy-menu.yml playbook.

Backend Docker Container

The backend image is built from backend/Dockerfile using Node.js 18. The application entry point is server.js, exposing port 3000. Dependencies include express@^4.18.2 and firebase-admin@^12.0.0.
FROM node:18

WORKDIR /app

COPY . .

RUN npm install

EXPOSE 3000

CMD ["node", "server.js"]
When the backend_service_account_json_secret_version variable is set, the container startup command writes the Firebase service account JSON from Secret Manager to serviceAccountKey.json before launching node server.js.

Ansible Playbooks

Verifies that the local deployment environment has all required tools installed. Run it before any deployment task.
ansible-playbook -i inventory.ini playbook.yml
Checks performed:
  • node --version — Node.js is available
  • firebase --version — Firebase CLI is available
  • gradlew.bat exists at the project root

Foundational / Preparatory Nature

The Terraform configuration provisions real Google Cloud and Firebase resources. The terraform apply command should only be run after reviewing terraform plan output and populating terraform.tfvars with your project’s values. Several optional resources (such as a staging Android app and the Firebase service account secret version) are gated behind boolean variables and are not created by default.

Next Steps

Terraform Reference

Detailed variable reference, resource descriptions, outputs, and step-by-step deployment instructions for provisioning all Google Cloud and Firebase resources.

CI/CD Pipeline

GitHub Actions workflow that runs Detekt, Lint, unit tests, builds debug and release APKs, and distributes builds via Firebase App Distribution.

Build docs developers (and LLMs) love