La Casa del Bordadito splits its persistence across two Firebase products. Firestore holds catalogue and transactional data that benefits from flexible querying (café items, shopping carts, orders). Firebase Realtime Database stores data that requires low-latency sync or presence signals (users, chat messages, unread counters, embroidery patterns, workshop info). Both databases share the same Firebase project and use the authenticated user’s UID as the primary linking key.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AndresLopezCorrales/La-casa-del-bordadito/llms.txt
Use this file to discover all available pages before exploring further.
Firestore collections
cafes — café menu items
cafes — café menu items
carritos — per-user shopping cart items
carritos — per-user shopping cart items
Each authenticated user gets their own sub-collection of cart items. Items are stored as individual documents rather than an array so that quantity updates and deletions target a single document without re-writing the entire cart.Collection path:
carritos/{uid}/itemsDocument ID format: {cafeId}_{tamano} — for example, abc123_Mediano. This composite key prevents duplicates: adding the same item and size a second time increments cantidad on the existing document instead of creating a new one.| Field | Type | Description |
|---|---|---|
carritoItemId | String | Same as document ID ({cafeId}_{tamano}) |
nombre | String | Item display name (denormalised from cafes) |
tamano | String | Size selected by the user |
precio | Double | Unit price at time of adding to cart |
cantidad | Int | Quantity; minimum 1 |
imagenUrl | String | Item image URL (denormalised from cafes) |
CarritoItem implements Serializable so instances can be passed between activities via Intent extras.ordenes — placed orders
ordenes — placed orders
When a customer confirms checkout, a new document is written to
ordenes. The document ID is auto-generated. Admins query this collection to view all orders; users filter by usuario field.Collection path: ordenes| Field | Type | Description |
|---|---|---|
id | String | Mirrors the Firestore document ID |
usuario | String | Email address of the ordering user |
total | String | Formatted total string, e.g. "90.0 MXN" |
fecha | Long | Unix epoch milliseconds — use Constantes.obtenerFechaHora() to format |
metodoPago | String | Human-readable payment description |
items | List<CarritoItem> | Snapshot of the cart at checkout time |
Orden implements Serializable so it can be passed to HistorialDetalleActivity as an Intent extra.Realtime Database nodes
Usuarios/{uid} — user profiles
Usuarios/{uid} — user profiles
Each user’s profile is written to Realtime Database at sign-up and updated on profile edits. The node key is the Firebase Auth UID.Path:
The
Usuarios/{uid}| Field | Type | Description |
|---|---|---|
uid | String | Firebase Auth UID |
email | String | User’s email address |
nombres | String | Display name |
urlImagenPerfil | String | Profile photo URL (Firebase Storage) or multiavatar SVG URL |
codigoTelefono | String | International dial code (e.g. "+52") |
telefono | String | Phone number (without dial code) |
proveedor | String | Auth provider: "Email" or "Google" |
escribiendo | String | Typing-indicator flag; set to the recipient UID while the user is typing |
tiempo | Long | Unix epoch milliseconds of account creation |
fecha_nac | String | Date of birth in "dd/MM/yyyy" format |
esAdmin | Boolean | true if the account has admin privileges |
esSoporte | Boolean | true if the account is a support agent |
online | Boolean | Presence flag — managed by ApplicationClass.actualizarEstadoOnline() |
online field uses Firebase’s onDisconnect() handler to fall back to false if the client loses connectivity without explicitly signing out. Note that urlImagenPerfil is the database key used in all read/write paths; the Usuario.kt data class maps this to its imagen property only for model-level deserialization.Chats/{rutaChat}/{msgId} — chat messages
Chats/{rutaChat}/{msgId} — chat messages
All messages between two users live under a shared, deterministic room key (see rutaChat below). Each message is a child node keyed by a push ID generated with
FirebaseDatabase.push().Path: Chats/{rutaChat}/{msgId}| Field | Type | Description |
|---|---|---|
idMensaje | String | Firebase push ID |
tipoMensaje | String | "TEXTO" or "IMAGEN" (from Constantes) |
mensaje | String | Message text, or a Firebase Storage URL when tipoMensaje = "IMAGEN" |
emisorUid | String | UID of the message sender |
receptorUid | String | UID of the intended recipient |
tiempo | Long | Unix epoch milliseconds |
ChatsUnreadCount/{uid}/{senderUid} — unread message counters
ChatsUnreadCount/{uid}/{senderUid} — unread message counters
Tracks how many unread messages each user has received from each sender. The outer key is the recipient’s UID; the inner key is the sender’s UID; the value is an integer count.Path: When a user opens a chat with a given sender, the counter for that sender is reset to
ChatsUnreadCount/{uid}/{senderUid}0. MainActivity listens to the recipient’s node to trigger the in-app popup notification.patrones/{id} — embroidery patterns
patrones/{id} — embroidery patterns
Each embroidery pattern is stored as a node under
Per-user progress is stored nested within the pattern node, keyed by UID. The A key of
patrones. The matriz field encodes the pixel grid as a list of rows, where each cell contains a color ID from the paleta list (or 0 for unfilled).Path: patrones/{id}| Field | Type | Description |
|---|---|---|
id | String | Unique pattern identifier |
nombre | String | Display name |
columnas / filas | Int | Grid dimensions |
urlImagen | String | Preview image URL |
paleta | List<ColorPatron> | Array of { id, hex, nombre } colour definitions |
matriz | List<List<Int>> | 2-D grid — each cell holds a ColorPatron.id or 0 |
porcentaje | Int | Completion percentage (aggregate, not per-user) |
activo | Boolean | Whether the pattern is visible to users |
ProgresoUsuario model maps each painted cell:"3_7" means row 3, column 7. This flat-map approach avoids nested arrays and lets Realtime Database rules target individual cells.TallerInfo — workshop information
TallerInfo — workshop information
Stores metadata about the craft workshop offerings. Currently used to publish a promotional flyer URL that
TallerActivity loads via Glide.Path: TallerInfo/flyerUrl| Path | Type | Description |
|---|---|---|
TallerInfo/flyerUrl | String | Firebase Storage URL of the workshop flyer image |
rutaChat: deterministic room key generation
Any two users always resolve to the same chat room path, regardless of who initiates the conversation.Constantes.rutaChat() achieves this by sorting both UIDs alphabetically and joining them with an underscore:
"uid-B" messages user "uid-A", and "uid-A" later replies, both calls produce the same path "uid-A_uid-B" because "uid-A" < "uid-B" lexicographically. This eliminates the need for a separate room-lookup index.
Payment methods
Payment cards are stored locally in Realtime Database under the user’s own profile node (not in a payment processor). ThePaymentMethod model represents a tokenized card:
Full card numbers are never stored. Only the last four digits, brand, holder name, and expiry are persisted. The
EditCredit library handles masked input formatting in TarjetaAgregarActivity.