← Back to Case Studies

Hierarchical Modeling for Restaurant Chains

7 min
architecturemodelingdomainwhite-labelhierarchy

Loyaltify is a white-label loyalty platform aimed at restaurant chains. One of the project's central challenges was correctly modeling the organizational structure of served chains — controlling groups, multiple brands, various physical units, and variable menus. This case study explores how hierarchical modeling became a structural element of product architecture, delegating operational autonomy to units with corporate supervision without ambiguity of responsibilities.


The Problem: Modeling Complex Hierarchies Without Ambiguity

The Context: Multi-Level Food Service Chains

Food service chains operate at multiple organizational levels. It's common to have:

  • 🏢 A controlling group (corporate holding)
  • 🍔 Multiple brands under the same group (McDonald's, Burger King style)
  • 📍 Various physical units per brand
  • 📋 Menus that vary by unit

The Modeling Challenge

In Loyaltify, an important architectural decision was made:

Promotions would not be global by brand or group. Each promotion belongs to a specific unit.

This reflects operational reality: each restaurant has autonomy to define its local campaigns, without interference from other units.

But how to represent this technically without generating ambiguity?


The Solution: Clear Hierarchy with Well-Defined Responsibilities

Loyaltify was structured with the following domain hierarchy:

Defined Structure

Group → Brand → Unit → Menu

Each level has distinct responsibilities:

LevelResponsibilityExample
GroupCorporate vision and consolidationXYZ Holdings Group
BrandCommercial identity and brandingBurger Prime, Pizza Express
UnitLocal operation and promotion definitionBurger Prime - ABC Mall
MenuConfigurable catalog per unitUnit's Special Burger

Critical Decision: Promotions at Unit Level

Promotions and benefits are defined at unit level.

This avoids ambiguity in rule application:

  • ✅ Each unit controls its own campaigns
  • ✅ No automatic promotion inheritance exists
  • ✅ Conflicts between hierarchical levels are eliminated by design

Implementation: Resolved Technical Challenges

1. Structural and Operational Separation

Hierarchy organizes network structure.
But promotional logic belongs to local operation.

This means that:

  • No automatic inheritance of promotions exists (parent → child)
  • Each unit controls its own campaigns
  • Conflicts between hierarchical levels are eliminated by design

Practical example:

Group has 3 brands. Brand A has 5 units. Each unit defines promotions independently. Unit 1 may have "50% off", Unit 2 may have no promotion at all.

2. Permissions by Scope

Even though promotions are local, access control needed to respect hierarchy:

RoleAccess ScopePermissions
Corporate AdminEntire groupBroad view, consolidated reports
Brand ManagerSpecific brandSupervision of brand units
Unit OperatorSpecific unitDirect control of promotions and menu

Authorization considers both role and organizational scope.

3. Independent Menus per Unit

Even under the same brand, units can:

  • 🍔 Have exclusive items (regional special pizza)
  • 💰 Adjust prices (based on local costs)
  • 🎁 Create specific combinations (local combo)

Since promotions link to menu, modeling needed to guarantee integrity between:

  • Registered items
  • Promotional rules
  • Purchase records

Solution: Foreign keys with controlled cascade + business validations at application level.


Impact and Measurable Results

Hierarchical modeling allowed Loyaltify to:

  • Represent real structure of food service chains
  • Delegate operational autonomy to units
  • Maintain corporate supervision (consolidated reports)
  • Avoid unnecessary complexity in promotional rules
  • Scale organically — adding new brand/unit is trivial

Tangible result: Zero overlapping promotion conflicts. Zero responsibility ambiguity.

"Hierarchy organizes. Unit decides."


Relevant Technical Decisions

1. Why promotions at unit level, not at group?

Analyzed trade-off:

ApproachBenefitProblem
Global promotions (group)Initial simplicityConflicts when unit wants different promotion
Promotions per unitOperational autonomyMore database rows, but zero ambiguity

Conclusion: Operational autonomy wins. Real chains operate this way.

2. How to implement hierarchy in database?

Relational model:

groups (id, name)
brands (id, group_id, name)
units (id, brand_id, name, address)
menus (id, unit_id, name)
promotions (id, unit_id, description, discount)

Benefits:

  • Simple queries with JOINs
  • Referential integrity via FK
  • Easy to understand and maintain

3. How to validate that a promotion only applies to right unit?

Validation in multiple layers:

  1. Database: FK constraints
  2. Application: Business validations
  3. API: Authorization by scope

Architectural Learnings

Domain modeling is not just data structure. It defines where operational responsibility lies.

Applied principles:

  1. Model reality, not the ideal

    • Real chains have local autonomy
    • Don't force artificial centralization
  2. Separate structure from operation

    • Hierarchy organizes
    • Promotional rules are local
  3. Eliminate ambiguity by design

    • If inheritance creates conflicts, don't use inheritance

When to apply hierarchical modeling?

This approach is appropriate when:

  • You model organizations with multiple levels
  • Operational autonomy is business requirement
  • Corporate supervision needs to coexist with local control
  • Organizational structure changes frequently (new brands/units)

When NOT to apply:

  • Completely flat structure (everyone equal)
  • Purely conceptual hierarchy (no operational impact)
  • Simple CRUD without business logic

Strategic Conclusion

Loyaltify's hierarchical modeling demonstrates that domain architecture should reflect operational reality, not disconnected conceptual abstraction.

By clearly separating:

  1. Organizational structure (hierarchy)
  2. Promotional control (local operation)

We created a system that:

  • Is coherent with the real world
  • Eliminates responsibility ambiguity
  • Scales organically
  • Facilitates onboarding of new clients

"Hierarchy doesn't complicate the system. It makes it coherent with the real world."


Continue Exploring

If you're modeling hierarchical or organizational domains:

Need consulting in domain modeling? Learn about our services.