How OpenHiggsfield Scaled Next.js Server Actions: Request Coalescing, 38 AI Models, and Zero Queue Locks A developer analyzed the architecture of open-higgsfield, an open-source multi-model video and image generation studio, detailing how it bypasses Next.js Server Action client-side serialization through a single-flight fan-out polling design. The project pools pending generation IDs into a central state machine and dispatches one batched Server Action per interval, and it uses a declarative catalog translation layer to unify parameter validation and routing across roughly 38 heterogeneous AI provider APIs including Kling, ByteDance Seedance, Black Forest Labs Flux, and Minimax. When building production-grade Generative AI platforms, engineering teams face two core architectural hurdles: network execution bottlenecks caused by Next.js Server Action concurrency semantics, and schema fragmentation across dozens of heterogeneous AI provider APIs e.g., Kling, ByteDance Seedance, Black Forest Labs Flux, Minimax . In this deep dive, we will analyze the technical architecture of wide-trace/open-higgsfield https://github.com/wide-trace/open-higgsfield —a high-performance, open-source studio UI designed for multi-model video and image generation. We will examine how to bypass Next.js Server Action client locks through client-side request coalescing , and how to build a declarative multi-model catalog translation layer that unifies dynamic parameter validation and multi-modal platform routing. Next.js App Router Server Actions offer an elegant mental model for client-to-server mutations. However, their underlying runtime semantics introduce a major bottleneck for real-time applications: Next.js serializes Server Action dispatches per client connection . In a generative studio, multiple long-running asynchronous inference tasks run concurrently. A naive implementation attaches a setInterval hook to each active generation task, issuing an isolated Server Action poll getGenerationStatus requestId every few seconds. Client Execution Timeline - Naive Approach Task A Poll ────► | Server Action 1 In Flight | ────────────────────────► Done Task B Poll ────────► QUEUED in React Action Queue ──► | Server Action 2 | ──► Done Task C Poll ────────────► QUEUED behind A & B ─────────────────────────────► Stalled Because Next.js processes Server Actions sequentially per client, firing isolated actions for N jobs causes request queueing on the client. If three video generations are polling every 4 seconds, and a user clicks "Submit Generation", the submission Server Action is placed at the back of the queue. The UI stalls, user input freezes, and the application exhibits high latency despite the backend platform remaining idle. To bypass client-side Action serialization, open-higgsfield implements a single-flight fan-out polling architecture . Instead of permitting independent timers to dispatch isolated Server Actions, the client pools all pending generation IDs into a central state machine src/generation/poll.ts and dispatches a single batched Server Action per interval. +-----------------------------------------------------------------------------------+ | CLIENT-SIDE RUNTIME | | | | +-------------------+ watchRequest id 1 +----------------------------------+ | | | Active Job UI 1 | ------------------► | | | | +-------------------+ | Coalescing Engine poll.ts | | | +-------------------+ watchRequest id 2 | - waiting: Map