Back to Blog Hub

Architecting Enterprise Super Apps: Scaling High-Concurrency Systems in Pharmaceutical Operations

Lessons learned architecting a production digital office ecosystem at PT. Royal Medicalink Pharmalab: automated authorization pipelines, database indexing, and offline-first mobile sync.

In large pharmaceutical manufacturing operations like PT. Royal Medicalink Pharmalab, disconnected legacy tools create severe administrative drag. When procurement approvals, quality control sign-offs, and warehouse dispatch receipts are spread across separate silos, operational turnaround slows down exponentially.

As Lead Engineer and System Analyst, I led the architectural overhaul that consolidated these fragmented workflows into an integrated Enterprise Super App ecosystem. The goal was straightforward: a unified interface with real-time transactional integrity, sub-second latency, and seamless offline functionality for floor staff.

Enterprise Super App Architecture Diagram
Click to Zoom
Published in KONSTELASI 2024: Architecture breakdown of the Enterprise Super App implementing role-based state machines, optimistic concurrency control, and automated approval pipelines.

Unified Micro-Service Core & Optimistic Locking

When multiple supervisors review purchase orders and inventory manifests simultaneously, database race conditions and double-approvals are catastrophic. We resolved this by implementing optimistic locking with monotonic sequence versioning across our transactional endpoints.

ApprovalPipelineService.php (Concurrency Guard)
public function approveTransaction(string $orderId, int $expectedVersion, User $approver): TransactionResult
{
    return DB::transaction(function () use ($orderId, $expectedVersion, $approver) {
        $order = PurchaseOrder::where('id', $orderId)
            ->where('version', $expectedVersion)
            ->lockForUpdate()
            ->first();

        if (!$order) {
            throw new ConcurrencyException("Record state modified by another supervisor. Please refresh.");
        }

        $order->status = OrderStatus::APPROVED;
        $order->version += 1;
        $order->approved_by = $approver->id;
        $order->save();

        Event::dispatch(new OrderApprovedEvent($order));
        return new TransactionResult(success: true, order: $order);
    });
}

Offline-First Warehouse Synchronization

Pharmaceutical warehouses with heavy cold-storage insulation frequently suffer from intermittent Wi-Fi coverage. Floor workers cannot afford dropped forms while logging temperature-sensitive vaccine batches.

We engineered an offline-first indexed client queue with idempotent background sync. When network reconnects, transactions replay in exact chronological batches with UUID reconciliation, guaranteeing zero duplicate inventory adjustments.

Empirical Production Impact

Following deployment across corporate headquarters and pharmaceutical logistics facilities:

  • Approval turnaround dropped by 68%: Routine document sign-offs shrank from 2.5 business days to under 4 hours.
  • 100% paperless auditing: Complete immutable audit logs satisfying regulatory compliance standards.
  • Zero data loss in low-connectivity zones: Handled over 50,000 monthly warehouse scans reliably.
“Enterprise software architecture is not about choosing the trendiest framework; it is about engineering dependable, fault-tolerant pipelines that never fail under production pressure.”
Yehezkiel David Setiawan
Written by

Yehezkiel David Setiawan

Enterprise System Architect & AI Engineer

Master of Computer Science • Enterprise system architect. Specializing in mission-critical high-concurrency architectures, offline-first sync protocols, and automated corporate workflow pipelines.