Collections Overview
The database consists of the following main collections:- artist-clients - Manages relationships between artists and their clients
- availability - Stores availability schedules and time slots
- bookings - Contains booking/appointment information
- conversations - Stores messaging and communication data
- customerPaymentInfo - Manages customer payment-related information
- user-notifications - Handles user notification settings and data
- user-onboarding - Stores user onboarding progress and related data
- users - Contains core user profile information and details
Database Diagram
Database Schema Diagram
Collection Schemas
artist-clients
Theartist-clients collection uses a nested structure to manage the relationship between artists and their clients:
Key Details:
- The collection uses a nested structure for efficient querying of artist-client relationships
- Each artist’s document contains a subcollection of their clients
- Client documents track booking history, spending, and artist notes
- The
bookingIdsarray enables quick access to all bookings between the artist and client firstBookingDateis stored as a timestamp for chronological ordering
bookings
Thebookings collection stores all booking information between artists and clients. Each booking document goes through various states in its lifecycle:
Booking Status Lifecycle:
The booking goes through different states, tracked by thestatus field:
REQUESTED: Initial state when client submits booking requestAWAITING_DEPOSIT: Artist has accepted and waiting for client’s depositCONFIRMED: Deposit received and booking is confirmedCOMPLETED: Tattoo session completedCANCELLED: Booking was cancelled
Key Details:
- Each booking document contains all necessary information about the tattoo request
- The status field determines which fields are required/optional
- Images and links are stored as URLs, with actual files in Firebase Storage
- Timestamps are stored as numbers for efficient querying
- The booking maintains references to both the artist and client
- A conversation is automatically created and linked to each booking
conversations
Theconversations collection manages messaging between users, with a nested structure for messages:
Message Types:
Themessages subcollection supports different types of messages:
TEXT: Standard text messagesFILE: File attachments (images, documents, etc.)REQUEST: Booking requests with tattoo detailsCONFIRMATION: Booking confirmation detailsCANCELLED: Booking cancellation notificationsEDIT: Booking edit notifications
Currently each conversation is unique per booking. We might want to refactor
this to be one conversation per artist-client pair in the future.
Key Details:
- Each conversation document tracks participants and message metadata
- The
unreadCountsmap enables efficient unread message tracking per user lastMessageTextandlastMessageTimestampenable conversation previews- Messages are stored in a subcollection for efficient pagination
- File messages store URLs pointing to Firebase Storage
- Special message types (REQUEST, CONFIRMATION) integrate with the booking system
- The
readByarray tracks message read status for all participants
user-notifications
Theuser-notifications collection manages notification state and history for each user, with a nested structure for individual notifications:
Notification Types
The system primarily supports booking-related notifications that track the lifecycle of a booking:- Booking Status Updates: Notifications for new requests, confirmations, edits, cancellations, and declines
- Payment Updates: Notifications for deposit payments (to be implemented)
- System Updates: Platform-wide notifications like new feature announcements (to be implemented)
Key Details:
- Each user has a document tracking their notification state
lastUpdatedtracks when the user last viewed their notificationsnewNotificationIdsmaintains a list of notifications that appeared since the last view- Individual notifications are stored in a subcollection for efficient pagination
- The
isReadflag tracks individual notification read status - Notification data is type-safe through TypeScript generics
user-onboarding
Theuser-onboarding collection tracks the onboarding progress for users:
Key Details:
- Each document represents a user’s onboarding progress
- Boolean flags track completion status of each onboarding step
- Steps include email verification, profile setup, calendar configuration, booking link setup, and payment setup
updatedAtfield helps track when users last made progress in onboarding- Used to guide users through the necessary setup steps before they can fully use the platform
users
Theusers collection stores core user profile information and extends Firebase Authentication user data:
Key Details:
- Extends Firebase Authentication with additional user profile information
- Supports both artist and client user types
- Artists have additional fields for styles, social media, and payment processing
- Profile photos and media are stored in Firebase Storage with URLs in the document
- Some fields become required based on user type and onboarding progress
- Integrates with Stripe for artist payment processing
- Social media integration currently focuses on Instagram, with potential for expansion
availability
Theavailability collection will manage artist availability and scheduling:
customerPaymentInfo
ThecustomerPaymentInfo collection will handle customer payment methods and history:
Relationships
The database is built around several key relationships that enable the booking and communication flow:Core User Relationships
users↔user-onboarding: Each user has an onboarding document tracking their setup progressusers↔user-notifications: Each user has a notifications document with their notification historyusers↔artist-clients: Artists have client relationships stored in nested collections
Booking Flow
bookings↔users: Each booking references both an artist and a clientbookings↔conversations: Each booking has an associated conversation for communicationbookings↔artist-clients: Bookings are tracked in the artist-client relationship
Communication
conversations↔users: Conversations track participants and their read/unread statusconversations↔bookings: Messages can contain booking-related actions (requests, confirmations)user-notifications↔bookings: Notifications are generated for booking status changes
- Artists can manage their client relationships and booking history
- Clients can track their bookings and communications with artists
- All booking-related actions are properly communicated and tracked
- User progress and notifications are properly managed