Covers Engine

Board Update
April 2026

Booking Algorithm — Deep Dive

The Problem

Table assignment is
harder than it looks

Every booking needs a table. Picking the wrong one wastes capacity, frustrates guests, and leaves money on the table.

REVENUE

Lost Revenue

Seat a party of 2 at a 6-top, and that table can't serve a larger party. Multiply by 50 bookings a night.

EXPERIENCE

Guest Frustration

Guest requests a patio seat, gets the bar. Guest books for a quiet dinner, ends up next to the kitchen.

OPERATIONS

Operational Chaos

Staff manually juggling tables on a busy Saturday night. No time to think about optimization — just survival.

Our algorithm solves this automatically — every booking, every time.

Architecture

Two packages,
strict separation

The brain and the body. The algorithm thinks. The engine acts.

ALGORITHM

Booking Algorithm

packages/booking-algo

  • Pure math — no database, no side effects
  • Takes numbers and objects, returns the best table
  • 6-layer pipeline with weighted scoring
  • Deterministic — same input always produces same output
Zero dependencies
ENGINE

Booking Engine

packages/booking-engine

  • Database integration — loads state, writes results
  • 25 parallel queries to build the restaurant snapshot
  • Calls the algorithm internally
  • Atomic transactions with retry logic
Depends on algo + DB
How It Works

End-to-end workflow

From a booking request arriving to a table being assigned

Step 1
Request Arrives
Date, time, party size, channel
Step 2
Engine Loads State
25 parallel DB queries
Step 3
Algorithm Runs
6-layer pipeline
Step 4
Assignment Written
Atomic transaction
<50ms
Single booking
<500ms
Batch optimization (100 reservations)
13
Invariants verified (10K+ runs each)
6
Real-world scenario tests
The Pipeline

6 layers, in sequence

Each layer answers one question. If any rejects, later layers don't run.

5

Admission

"Can we accept more guests right now?"

Pacing Channel caps Overbooking
2

Eligibility

"Which tables pass the 7 hard constraints?"

Capacity Time Channel
3

Combinations

"Can we push tables together for large parties?"

Pre-defined combos Adjacency search
1

Feasibility

"Does this time block fit without overlapping?"

Helper layer
4

Scoring

"Which eligible table scores best on 6 factors?"

Weighted average 0-1 range
6

Optimizer

"Can we rearrange all reservations for a better plan?"

Pre-service Live reshuffle
Combinations — Layer 3

Table combinations &
seat loss

When a single table can't fit the party, the algorithm searches for tables to push together. But combined tables don't seat the sum of their parts.

Two search strategies

Pre-defined combinations

The restaurant explicitly sets these up in the floor plan editor. "Tables 5 + 6 can combine into a 10-top." Uses the stored capacity as-is — the restaurant already factored in seat loss.

Adjacency search (DFS)

The algorithm finds physically adjacent tables using the adjacency graph from the floor plan. Chains up to 3 tables. Deducts seat loss per edge automatically based on table shapes and which sides touch.

Seat loss — why 4 + 4 ≠ 8

When two tables are pushed together, chairs on the joining sides are removed. The algorithm handles this automatically, and restaurants can override per edge.

ScenarioRawLossEffective
Two square 4-tops826
Two narrow 2-tops facing404
Round 6-top + square 4-top1037
Three 4-tops in a chain1248

Staff can override seat loss per join in the floor plan editor. Setting it to 0 means "no seats lost at this join."

Scoring — Layer 4

6 factors, configurable weights

Every table gets a score from 0 to 1. The highest score wins.

Maximize Covers Pack efficiently

Size fit
40%
Turn buffer
30%
Section balance
15%
Guest preferences
5%
Table priority
5%
Combo penalty
5%

Maximize Experience Guest comfort first

Guest preferences
30%
Table priority
25%
Size fit
20%
Turn buffer
10%
Section balance
10%
Combo penalty
5%

Weights are configurable per service. Restaurants choose their strategy — or create a custom blend.

When It Fails

Alternative time suggestions

When a booking can't be fulfilled, the algorithm doesn't just say "no" — it suggests better options.

7:00 PM
7:15 PM
7:30 PM FULL
7:45 PM
8:00 PM

How it works

  • Generate time deltas: ±15, ±30, ±45 ... ±120 minutes from the requested time
  • Run the full pipeline on each alternative
  • Score the suggestions on 4 factors
  • Return top 3 sorted by quality

Suggestion scoring

Time proximity
40%
Table quality
25%
Size fit
20%
Demand level
15%
Control

Table locking

Staff can override the algorithm when they need to. Two lock levels give the right balance between automation and control.

HARD LOCK

Hard Lock

Immovable. The algorithm never reassigns this table.

  • VIP requests — "I want the window booth"
  • Accessibility — wheelchair-accessible table
  • Special events — birthday, proposal setup
  • Moving blocked — must unlock first (two deliberate steps)
  • Always scores 1.0 in suggestions
SOFT LOCK

Soft Lock

Preferred but movable. The algorithm prefers this table via scoring but will reassign if a better arrangement exists.

  • General preferences — "they prefer the patio"
  • Staff instinct — "this table works well for them"
  • How it works — scoring boosts the preferred table via guest preference factor, but the reservation stays in the movable pool during reshuffle
  • Staff can always reassign manually
Channels

Channel-based table availability

Control which tables are bookable on which channels. Not every table should be available to every booking source.

4-level fallback chain

LevelSourceExample
1 — Most specific Per-service override "Table 5 is walk-in only for Saturday Dinner"
2 Per-table default "Table 5 is usually walk-in only"
3 Per-zone default "Garden Patio zone is walk-in only"
4 — Broadest fallback All active channels Nothing configured — all channels allowed
User Experience

Score display for staff

When staff view table suggestions, they see a quality score and human-readable reasons — not just a list.

ScoreLabelColorMeaning
0.80 — 1.00 Best fit Green Right size, good section, good spacing
0.60 — 0.79 Good fit Blue Acceptable — slightly oversized or busy section
0.40 — 0.59 Available Gray Functional but not ideal — oversized or tight timing
Below 0.40 Hidden Poor fit — not shown to staff

Human-readable reasons

  • "Perfect size match (4 seats for party of 4)"
  • "Good spacing — comfortable gap between seatings"
  • "Balances load across sections"
  • "Matches guest preferences"

Special cases

  • Hard-locked reservations always score 1.0
  • Combinations show effective capacity after seat loss
  • Reasons are built from the scoring breakdown, not generic labels
1 / 11