Every entity in the system gets a unique identifier (ID) used in URLs, QR codes, and API calls. For example, when a guest shares their booking reference or scans a QR code for a restaurant, they see this identifier.
Format: {prefix}_{random suffix} → e.g. act_a1b2c3
- Prefix identifies the type of entity (
rm= room,gst= guest, etc.) - Suffix is a random string that makes each ID unique
Exception: Booking has no prefix — just 6A3BJQ (like an airline booking reference).
The suffix is generated randomly. A shorter suffix means fewer possible combinations, which increases the chance of generating a duplicate (collision). A longer suffix is safer but makes IDs harder to read and share.
| Suffix Length | Possible Combinations | Safe up to |
|---|---|---|
| 4 hex chars | 65,000 | ~50 records |
| 6 hex chars | 16.7 million | ~1,000 records |
| 8 hex chars | 4.29 billion | ~50,000 records |
| 6 base36 chars | 2.18 billion | ~10,000 records |
If a collision happens, the system rejects the insert (unique constraint in the database) — no data is lost, but it costs a retry.
Bookings are shared by guests (verbally, via SMS, printed on confirmations). We want them as short as possible while remaining clear.
- Hex uses 16 characters:
0-9, a-f→ needs more chars for the same safety - Base36 uses 36 characters:
A-Z, 0-9→ more combinations per character, uppercase only = no case ambiguity
| Encoding | 6 chars |
|---|---|
| Hex (16 chars) | 16.7 million |
| Base36 (36 chars) | 2.18 billion |
6 base36 chars gives 2.18 billion combinations — equivalent to 8 hex chars but in only 6 characters, with no prefix.
We start with short suffixes. As record counts grow, we increase the suffix length for new records only — existing IDs are never changed.
| Encoding | Characters | Use case |
|---|---|---|
hex |
0-9, a-f (16) |
Default for most entities |
alpha |
A-Z (26) |
Letters only, no digit confusion |
base36 |
A-Z, 0-9 (36) |
Booking — short, uppercase, clear |
base62 |
A-Z, a-z, 0-9 (62) |
Maximum density per character |
These are identifiers that guests and users see, share, or interact with.
| # | Entity | Prefix | Encoding | Suffix | Scale-up at | Example |
|---|---|---|---|---|---|---|
| 1 | Booking | none | base36 | 6 | > 10K → 7 | 6A3BJQ |
| 2 | Guest | gst |
hex | 6 | > 1K → 8 | gst_a1b2c3 |
| 3 | User | usr |
hex | 6 | > 1K → 8 | usr_cd8d73 |
| 4 | Room | rm |
hex | 4 | > 50 → 6 | rm_5097 |
| 5 | Restaurant | rt |
hex | 4 | > 50 → 6 | rt_0566 |
| 6 | Activity | act |
hex | 6 | > 1K → 8 | act_a1b2c3 |
| 7 | ActivityBooking | acb |
hex | 6 | > 1K → 8 | acb_a1b2c3 |
| 8 | RestaurantBooking | rbk |
hex | 6 | > 1K → 8 | rbk_a1b2c3 |
| 9 | RoomServiceOrder | rso |
hex | 6 | > 1K → 8 | rso_a1b2c3 |
| 10 | ServiceOrder | svo |
hex | 6 | > 1K → 8 | svo_a1b2c3 |
| 11 | Chat | ch |
hex | 6 | > 1K → 8 | ch_095766 |
| 12 | Review | rev |
hex | 6 | > 1K → 8 | rev_a1b2c3 |
| 13 | Request | req |
hex | 6 | > 1K → 8 | req_a1b2c3 |
| 14 | SpecialOffer | spo |
hex | 4 | > 50 → 6 | spo_a1b2 |
These are only used by admins or the system internally. They keep the standard 8 hex suffix — no changes needed.
| # | Entity | Prefix | Suffix | Example |
|---|---|---|---|---|
| 15 | Hotel | htl |
8 | htl_a1b2c3d4 |
| 16 | Role | rol |
8 | rol_a1b2c3d4 |
| 17 | Admin | adm |
8 | adm_a1b2c3d4 |
| 18 | ApiKey | apk |
8 | apk_a1b2c3d4 |
| 19 | ImageCategory | imc |
8 | imc_a1b2c3d4 |
| 20 | Service | srv |
8 | srv_a1b2c3d4 |
| 21 | HotelContact | htc |
8 | htc_a1b2c3d4 |
| 22 | HotelSchedule | hts |
8 | hts_a1b2c3d4 |
| 23 | ServiceQuestion | svq |
8 | svq_a1b2c3d4 |
| 24 | Amenity | amn |
8 | amn_a1b2c3d4 |
| 25 | AmenityAssignment | amna |
8 | amna_a1b2c3d4 |
| 26 | MenuCategory | mec |
8 | mec_a1b2c3d4 |
| 27 | MenuItem | mei |
8 | mei_a1b2c3d4 |
| 28 | RestaurantOperatingHour | roh |
8 | roh_a1b2c3d4 |
| 29 | ActivityVariant | acv |
8 | acv_a1b2c3d4 |
| 30 | Companion | cmp |
8 | cmp_a1b2c3d4 |
| 31 | DocumentVerification | docv |
8 | docv_a1b2c3d4 |
| 32 | UserPreference | upr |
8 | upr_a1b2c3d4 |
| 33 | BookingRecommendation | brec |
8 | brec_a1b2c3d4 |
| 34 | ImageObject | imo |
8 | imo_a1b2c3d4 |
| 35 | ChatMessage | chm |
8 | chm_a1b2c3d4 |
| 36 | RoomServiceOrderItem | rsoi |
8 | rsoi_a1b2c3d4 |
| 37 | RewardTransaction | rwt |
8 | rwt_a1b2c3d4 |