Technical Architecture & System Design

How the Crumbloom Engine Works

Most company software is built in disconnected silos: marketing on WordPress, customer ordering on Shopify, kitchen tickets on thermal POS, and packaging in Adobe Illustrator. Crumbloom is built as a single monolithic TypeScript kernel where 72 distinct operational surfaces render purely from shared tokens, pure domain functions, and physical frames.

1. The Kernel Architecture: One Source, Ten Wings

The dependency graph below illustrates how atomic tokens in src/kernel/tokens.ts flow unidirectionally through shared frames into all ten commercial and physical wings.

TOKEN KERNELsrc/kernel/tokens.ts• 7 OKLCH Palettes• FSSAI / GSTIN / Rules• Vegetarian / Vegan Spec16 PHYSICAL FRAMESPaperFrame (A4, A5, Thermal)DeviceFrame (Phone, Tablet)DielineFrame (Fold, Cut, Glue)GarmentFrame (Apron, Tee)InboxFrame & ElevationFrame1. Identity Wing (8)2. Print Wing (12)3. Packaging Wing (10)4. Place & Spatial (8)5. Wear Wing (6)6. Web Wing (4)7. App Wing (7)8. Operations Wing (4)9. Partners Wing (5)10. Campaigns Wing (9)

2. Pure Domain Logic: deriveBakeList

Per CONVENTIONS.md §7, domain functions must have zero side-effects. The bakery hearth schedule is calculated strictly from input arguments without querying globals or mutable clocks:

export function deriveBakeList(
  orders: readonly CakeOrder[],
  subscriptions: readonly StandingSubscription[],
  parLevels: readonly ParLevel[],
  now: Date,
): BakeListRow[] {
  const tomorrow = addDays(now, 1)

  // Monday closure rule: bakery is closed on Mondays, zero bake list
  if (getDay(tomorrow) === 1) {
    return []
  }

  const tomorrowDateStr = format(tomorrow, 'yyyy-MM-dd')

  // 1. Tally pre-orders due tomorrow
  const preOrderCounts: Record<
    string,
    { count: number; eggless: boolean; station: string; unit: string }
  > = {}

  for (const order of orders) {
    const isTomorrow =
      order.pickup.date === tomorrowDateStr ||
      (order.pickup.slot && order.pickup.slot.toLowerCase().includes('tomorrow'))

    if (isTomorrow) {
      const spongeName =
        FLAVOUR_TO_SPONGE_NAME[order.flavour] ?? `${order.flavour} Sponge`
      const spongesNeeded = Math.max(1, order.tiers)
      const isEggless = order.egg === 'eggless'

      const existing = preOrderCounts[spongeName] ?? {
        count: 0,
        eggless: isEggless,
        station: 'Cake Station',
        unit: 'sponges',
      }
      existing.count += spongesNeeded
      if (isEggless) existing.eggless = true
      preOrderCounts[spongeName] = existing
    }
  }

  // 2. Tally active standing subscriptions
  const subscriptionCounts: Record<string, number> = {}
  for (const sub of subscriptions) {
    if (!sub.isPaused && !sub.isTomorrowSkipped) {
      subscriptionCounts[sub.item] =
        (subscriptionCounts[sub.item] ?? 0) + sub.quantity
    }
  }

  // 3. Merge with station par levels (floored by statutory buffer)
  const rows: BakeListRow[] = []
  for (const par of parLevels) {
    const preOrders = preOrderCounts[par.item]?.count ?? 0
    const subCount = subscriptionCounts[par.item] ?? 0
    const demand = preOrders + subCount
    const totalQuantity = Math.max(par.parLevel, demand)
    const eggless = par.eggless ?? preOrderCounts[par.item]?.eggless ?? false

    rows.push({
      id: par.item.toLowerCase().replace(/[^a-z0-9]+/g, '-'),
      station: par.station,
      item: par.item,
      preOrders,
      subscriptions: subCount,
      parLevel: par.parLevel,
      totalQuantity,
      unit: par.unit,
      eggless,
    })
  }

  return rows
}

3. The 72-Artifact Manifest Schema

Every artifact across all ten wings is declared in src/kernel/manifest.ts. Descriptions are strictly capped at 90 characters to guarantee grid uniformity.

Artifact Identity

id: string & name: string

Kebab-cased unique identifier matching URL route and registry key.

Wing Assignment

wing: WingId

One of 10 commercial categories: identity, print, packaging, ops, etc.

Physical Frame

frame: FrameType

Device, Paper, Dieline, Deck, Garment, Elevation, or Inbox chrome.

Length Invariant

blurb.length ≤ 90

Automated unit test assertion ensures zero card height distortion.

4. The 16 Frame Components

Physical frames transform on-screen React components into tangible artifacts with calibrated real-world dimensions and printer marks.

Frame ComponentExport TypePhysical Medium & GeometryCanonical Use
PaperFrameContainerA4, A5, Visiting Card, 80 mm Thermal ContinuousThermal receipts, letterheads, menu cards
DeviceFrameContainerPhone (375 × 812), Tablet (1024 × 768)Customer ordering app, 72h kitchen board
DielineFrameContainerPackaging dielines with bleed margins and registration1 kg cake box, brownie sleeves, cookie pouches
DeckFrameContainer16:9 Presentation slide aspect with slide scrubberFOFO Franchise kit, investor presentation
GarmentFrameContainerFront & Back garment elevation with embroidery marksBakers apron, counter staff tee, rider jacket
ElevationFrameContainerArchitectural millwork elevations in mmPickup cubby shelf, shopfront fascia, menu board
InboxFrameContainerEmail client chrome with 600px desktop & 360px mobileWelcome email, Diwali corporate blast, review request
IsoPlanSpatial View30° Isometric architectural floorplan gridSector 56 kiosk plan, DLF Phase 4 café layout
IsoBox3D SimulationPure CSS 3D folded packaging preview with shadowsFolded cake box 3D view, tamper sticker seam
SpecRailSidebar RailMaterial substrates, finishing coats, pantone chipsSide rail on all 72 individual artifact routes
Cut, Fold, Glue, DimSVG PrimitivesCyan cut lines, magenta crease folds, cross-hatch tabsCAD packaging dieline precision vectors

5. Measured Engineering Metrics

Audited performance figures and test coverage copied directly from the canonical LOG.md:

72

Artifacts Built

10

Wings Shipped

319

Unit Tests (25 files)

93

E2E Playwright Tests

0

Axe Violations

119 kB

First Load JS (Lobby)

6. Market Context & Architectural Independence

Contemporary food and beverage technology is heavily distorted by commercial aggregators. Delivery marketplaces like Zomato, Swiggy, and Blinkit charge 28% to 35% commission on gross order value while obscuring direct customer relationships. Conversely, legacy chain bakery operations like Theobroma and Monginis rely on industrial central commissaries with frozen dough distribution and rigid POS software.

Crumbloom represents an alternative architectural paradigm: an independent, local artisan bakehouse executing 36-hour slow cold fermentation with direct customer digital touchpoints. By integrating custom cake ordering, instant WhatsApp booking confirmations, live kitchen dispatch boards, and packaging dielines under a single shared token kernel, the business eliminates third-party aggregator tax while preserving complete control over food safety, statutory compliance, and unit profitability.