← Back to Case Studies

Replicable Architecture with Strategic Decoupling

•7 min
architecturewhite-labeldecouplinginfrastructureAWS

Designing a replicable white-label architecture requires balance between controlled centralization and strategic decoupling. In this case, we explore how we structured Loyaltify — a loyalty platform for restaurant chains — to be deployed in isolation per client, maintaining operational predictability and removing bottlenecks from the application core.


The Problem: Replicability with Isolation

Loyaltify is a white-label loyalty platform aimed at restaurant chains. It allows gastronomic groups to publish their own applications, manage units, menus, promotions, and loyalty programs — maintaining their own identity and operational control.

The challenge wasn't just building a functional system, but making it repeatedly deployable for different clients, each with their own operational, regulatory, and infrastructure requirements.

The Architectural Challenge

How to design a structure that could be replicated per client, maintaining:

  • Complete isolation between instances
  • Operational predictability in each deployment
  • Control over bottlenecks without compromising the core
  • Predictable infrastructure costs

The answer wasn't in maximizing distribution, nor in concentrating everything. It was in clearly defining what should remain under direct application control and what should be strategically decoupled.


The Solution: Controlled Centralization + Strategic Decoupling

Structural Principles

From the start, we adopted several criteria:

  • Each client would have their own instance
  • The deployment process should be repeatable
  • Operations should be understandable
  • Infrastructure costs should be predictable
  • Potential bottleneck points couldn't compromise the application core

These principles shaped all technical decisions.


Centralized Core: What Remains in the Instance

The system core was organized into three main components:

  • Backend (Next.js)
  • Frontend application (React, distributed via WebView)
  • Administrative backoffice

All dockerized.

Deployment occurs on EC2 instances, with an automated Bash process that:

  • Provisions the environment
  • Configures variables
  • Initializes containers
  • Standardizes application structure

Processes such as:

  • Menu import via spreadsheet
  • File processing
  • Internal validation rules

occur within the instance itself.

This centralization maintains execution predictability and reduces operational variables between deployments.


Strategic Decoupling: What Was Externalized

At the same time, services that could become structural bottlenecks were deliberately externalized.

Examples:

  • Email sending via Amazon SES
  • File storage via S3
  • Receipt reading via Rekognition

These services have their own characteristics:

  • Independent usage peaks
  • Specific availability requirements
  • Specialized technical requirements
  • Potential to impact main instance resources

If internalized, they could compete for CPU, memory, or I/O, amplifying the risk of unwanted coupling.

By delegating these responsibilities to managed services, Loyaltify:

  • Removed core bottleneck points from the application
  • Reduced internal operational surface
  • Isolated peripheral failures
  • Kept the core focused on business logic

Client Isolation: Configuration Flexibility

Each deployment can be adjusted according to the served network's profile:

  • Dedicated database in Multi-AZ RDS
  • Isolated databases in a single RDS instance

This flexibility allows adapting cost, compliance, and robustness without changing the central architecture.

The structure remains stable.
Variation occurs in configuration.


Impact and Measurable Results

Loyaltify's architecture became:

  • ✅ Repeatedly deployable — automated process via Bash with zero manual intervention
  • ✅ Isolatable per client — each network operates on dedicated infrastructure
  • ✅ Operationally controllable — reduction of variables between deployments
  • ✅ Flexible for different requirements — adaptable configuration without code changes
  • ✅ Commercially sustainable — predictable infrastructure costs per client

It doesn't seek architectural maximalism. It seeks coherence with the business model.


Relevant Technical Decisions

1. Why EC2 instead of Serverless?

Loyaltify has critical synchronous operations (menu import, business rule processing) that require predictable execution and resource control. Serverless would introduce variable latency and orchestration complexity.

2. Why Docker instead of direct deployment?

Docker guarantees environment parity. The same container tested locally is the same deployed in production, eliminating "works on my machine".

3. Why Bash instead of IaC (Terraform/CloudFormation)?

Operational simplicity. The Bash script is readable, versionable, and doesn't introduce external dependencies. For a structure that changes little and is repeatable, Bash offers direct control without overhead.


Architectural Learnings

Deployability isn't simplification. It's boundary clarity.

In Loyaltify, we centralized what belongs to the product domain. We decoupled what could become a bottleneck or unnecessary responsibility.

This combination allowed the platform to be replicable without becoming fragile.

When to apply this approach?

This architecture is suitable when:

  • You need to sell/deploy the same solution for multiple clients
  • Isolation and compliance require dedicated infrastructure
  • The product has synchronous and predictable operations
  • Infrastructure cost needs to be easily calculable

When NOT to apply:

  • SaaS product with shared multi-tenancy
  • Highly asynchronous and event-driven workloads
  • Need for aggressive auto-scaling

Strategic Conclusion

Loyaltify demonstrates that architecture should serve the business model, not the other way around.

By combining controlled centralization with strategic decoupling, we created a structure that:

  1. Scales commercially (sellable to multiple clients)
  2. Is operationally sustainable (low variability between deployments)
  3. Maintains technical and financial predictability

This approach may seem less "modern" than fully distributed architectures, but offers something more valuable: clarity, predictability, and alignment with product reality.


Continue Exploring

If you're designing replicable or white-label systems, these cases may help:

Need architectural support for your platform? Learn about our software architecture consulting services.