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 is a full-stack Android restaurant management system built with Kotlin and Jetpack Compose. It replaces paper-based order tickets and disconnected spreadsheets with a single, real-time platform that keeps the dining room, kitchen, and administration in perfect sync — even when the internet drops.

What the app does

La Previa Restobar is a role-based point-of-sale and kitchen management system. A Mesero (Waiter) selects a table, builds an order from the live product menu, and sends it straight to the kitchen display. A Cocinero (Chef) receives incoming orders in real time, advances each one through the preparation pipeline (ENVIADO → ACEPTADO → EN_PREPARACION → LISTO → ENTREGADO), and triggers automatic inventory deductions. An Admin manages the product catalogue, monitors live dashboard metrics, views sales reports by day/week/month/year, and exports PDF or CSV reports to the device’s Downloads folder. Every write is persisted to Room first, so orders are never lost when the network is unavailable. WorkManager’s SyncWorker replays any pending changes to Firebase the moment connectivity is restored.

The three user roles

RoleSpanish labelPrimary responsibilities
WaiterMeseroBrowse tables, create orders, track order status, free tables
ChefCocineroAccept orders, update preparation status, manage inventory deductions
AdminAdministradorProduct CRUD, sales reporting, dashboard metrics, report export
After login, AppNavigation routes each authenticated user directly to their own scoped screen graph (waiter_main, chef_main, or admin_main) based on the UserRole sealed class value stored in Firebase Auth and the local UserPreferencesRepository.

Key technologies

TechnologyVersionRole
Kotlin2.2.10Primary language
Jetpack Compose + Material 3BOM 2024.06.00Declarative UI
Hilt2.57.1Dependency injection
Firebase Realtime DatabaseBOM 33.1.2Remote data & real-time listeners
Firebase AuthBOM 33.1.2Authentication & role identity
Room2.8.4Offline-first local persistence
WorkManager2.9.1Background sync via SyncWorker
Retrofit + OkHttp2.11.0 / 4.12.0REST API calls to the Express.js backend
Timber5.0.1Debug-only structured logging
KSPAnnotation processing for Room & Hilt

Architecture overview

The codebase follows Clean Architecture with three clearly separated layers:
Presentation  ──→  Domain  ──→  Data
(Compose UI,       (Use Cases,   (Room DAOs,
 ViewModels)        Repo         Firebase Impls,
                   Interfaces)   Retrofit ApiService)
  • Presentation — Jetpack Compose screens and @HiltViewModel classes. Each role has its own ViewModel (WaiterViewModel, ChefViewModel, AdminViewModel) plus shared cross-cutting ViewModels (SharedViewModel, LoginViewModel, InventoryViewModel, SyncViewModel).
  • Domain — Use-case classes (CreateOrderUseCase, GetProductsUseCase, GetTablesUseCase, UpdateOrderStatusUseCase, CreateProductUseCase, UpdateProductUseCase, DeleteProductUseCase) that contain all business logic and depend only on abstract repository interfaces.
  • Data — Concrete repository implementations backed by two sources: Room (AppDatabase with four DAOs) and Firebase (FirebaseOrderRepositoryImpl, FirebaseProductRepositoryImpl, FirebaseTableRepositoryImpl, FirebaseInventoryRepositoryImpl). The UnifiedOrderRepository, UnifiedProductRepository, UnifiedTableRepository, and UnifiedInventoryRepository classes merge both sources with a local-first emission strategy.

Explore the documentation

Quickstart

Clone the repo, configure Firebase, and run the app in under 10 minutes.

Architecture

Deep-dive into the Clean Architecture layers, DI modules, and offline sync flow.

User Roles

Detailed breakdown of Mesero, Cocinero, and Admin capabilities and screens.

API Overview

REST and WebSocket endpoints exposed by the Express.js backend.

Feature highlights

Real-Time Order Tracking

Firebase Realtime Database listeners push order-status changes (ENVIADO, ACEPTADO, EN_PREPARACION, LISTO, ENTREGADO) to all connected clients instantly.

Offline-First Architecture

Every write lands in Room with syncStatus = "PENDING". SyncWorker uploads pending changes hourly (or immediately on network restoration) using exponential backoff.

Automatic Inventory Deduction

When a Chef accepts an order (OrderStatus.ACEPTADO), ChefViewModel deducts item quantities from both Firebase Realtime Database and Room. Low-stock alerts surface in the Admin dashboard.

Multi-Role Authentication

Firebase Auth provides per-user credentials. The UserRole sealed class (MESERO, COCINERO, ADMIN) is stored in UserPreferencesRepository and drives AppNavigation routing with protected composable routes.

Sales Reporting & Export

AdminViewModel builds SalesReport objects filtered by day, week, month, year, or custom date range. Reports export to PDF (PdfDocument) or CSV, saved to Downloads/LaPreviaReportes/.

Security & Obfuscation

R8 minification and resource shrinking are enabled in the release build type. Timber logs are suppressed in non-debug builds. Sensitive files (google-services.json, serviceAccountKey.json) are git-ignored.

Build docs developers (and LLMs) love