Skip to main content

Integration Builder v2 — Design Spec

Overview

Complete rewrite of the Integration Builder, replacing the current monolithic 1,530-line component with a no-code drag & drop canvas builder powered by React Flow. The builder lets developers visually compose API integration flows by dragging blocks onto a canvas, connecting them, configuring parameters inline, and generating executable code + markdown reports.

Key shift: The current builder is a form wizard. The v2 is a visual flow editor — closer to n8n, Langflow, or Retool than to a step-by-step form.

Design Decisions (Validated)

DecisionChoiceRationale
ArchitectureCanvas Livre (React Flow)Maximum freedom, no-code UX, supports branching and multi-operation flows
FallbackConversational WizardFor mobile/accessibility; same engine, different UI — future scope, not v2 launch
Interaction modelEverything is a blockLogin, KYC, Quote, Ticket — all draggable. Full freedom for the developer
ConfigInline on blocksClick block → expands on canvas showing selects (currency, chain, method, amount)
ConnectionsAuto-binding + manual overrideConnecting blocks auto-binds compatible outputs→inputs. Click connection to customize
OutputGenerate Flow button → modal with markdown + codeDisabled until flow is valid. Generates report as overlay
Config systemData-driven, modular filesOne JSON per currency/chain/method. Adding a currency = adding a file, zero code
Color paletteAurora Violet#A78BFA accent, #7C3AED dark, #F472B6 secondary. Brand base (#060607, #3C3C54, #E0DCD8)
ThemeDark + Light modeDark as default, toggle in top bar
IconsLucide React (stroke)Minimal, 1.5px stroke, monochrome. No emojis
Right panelNoneCanvas takes full width. Output only via Generate Flow modal
SidebarCollapsibleToggle to hide block palette, canvas goes full-screen
ExportMarkdown + SVG/PNGDownload report as .md, export canvas diagram as SVG or PNG
LinksVisible, high contrastEach block and report step links to Integration Guide. Color: #A78BFA (not dim)

Architecture

src/
├── pages/
│ └── integration-builder.tsx # Page shell, layout, theme provider
├── components/
│ └── builder/
│ ├── Canvas.tsx # React Flow canvas wrapper
│ ├── Sidebar.tsx # Collapsible block palette
│ ├── TopBar.tsx # Logo, controls, Generate Flow button
│ ├── nodes/
│ │ ├── BaseNode.tsx # Shared node chrome (header, handles, link)
│ │ ├── CollapsedNode.tsx # Default view: icon, title, method, endpoint
│ │ └── ExpandedNode.tsx # Config view: currency selects, inputs, chain picker
│ ├── edges/
│ │ └── AnimatedEdge.tsx # Animated connection with particle effect
│ ├── config/
│ │ └── NodeConfigPanel.tsx # Inline config form rendered inside ExpandedNode
│ ├── report/
│ │ ├── ReportModal.tsx # Overlay modal after Generate Flow
│ │ ├── ReportPreview.tsx # Rendered markdown preview
│ │ ├── CodeTab.tsx # cURL / Node / Python / Go tabs
│ │ └── ExportActions.tsx # Copy, Download .md, Export SVG/PNG
│ ├── validation/
│ │ └── FlowValidator.tsx # Real-time validation warnings on canvas
│ └── shared/
│ ├── MethodBadge.tsx # POST/GET/PUT/DELETE colored badge
│ ├── BindingBadge.tsx # Shows auto-bound data between blocks
│ └── GuideLink.tsx # High-contrast link to Integration Guide
├── engine/
│ ├── FlowEngine.ts # Core: resolves dependencies, validates flow, generates output
│ ├── CodeGenerator.ts # Transforms flow graph into code snippets (cURL, Node, Python, Go)
│ ├── MarkdownGenerator.ts # Transforms flow graph into markdown report
│ └── BindingResolver.ts # Auto-detects compatible output→input pairs between blocks
├── registry/
│ ├── BlockRegistry.ts # Loads and indexes all block definitions from config files
│ └── index.ts # Re-exports registry singleton
├── store/
│ └── useBuilderStore.ts # Zustand store: nodes, edges, config state, theme, sidebar visibility
├── hooks/
│ ├── useAutoBinding.ts # Auto-connects compatible ports when edges are created
│ ├── useFlowValidation.ts # Real-time validation: missing dependencies, invalid combos
│ ├── useCanvasExport.ts # Export canvas as SVG/PNG using html-to-image or react-flow utils
│ └── useTheme.ts # Dark/light mode toggle with CSS variable switching
└── configs/
├── currencies/
│ ├── brl.json
│ ├── usdc.json
│ ├── usdt.json
│ ├── eurc.json
│ ├── cop.json
│ └── ...
├── payment-methods/
│ ├── pix.json
│ ├── wire.json
│ ├── ach.json
│ └── ...
├── chains/
│ ├── polygon.json
│ ├── ethereum.json
│ ├── base.json
│ └── ...
└── blocks/
├── login.json
├── kyc-level1.json
├── kyb.json
├── account-info.json
├── balances.json
├── beneficiary-wallet.json
├── beneficiary-bank.json
├── get-quote.json
├── create-ticket.json
└── convert.json

Config File Format

Block Definition (configs/blocks/get-quote.json)

{
"id": "get-quote",
"name": "Get Quote",
"category": "operations",
"icon": "arrow-left-right",
"description": "Get exchange rate and quote token",
"method": "GET",
"endpoint": "/v2/{scope}/quote/fixed-rate",
"guideLink": "/docs/Operations/quote",
"inputs": {
"authToken": { "type": "token", "required": true, "from": "login.authToken" }
},
"outputs": {
"quoteToken": { "type": "token", "description": "JWT quote token (expires in 5min)" },
"rate": { "type": "number", "description": "Exchange rate applied" },
"fees": { "type": "object", "description": "Fee breakdown" }
},
"configFields": [
{
"id": "inputCurrency",
"label": "Input Currency",
"type": "currency-select",
"required": true,
"filter": { "supportedAs": "input" }
},
{
"id": "outputCurrency",
"label": "Output Currency",
"type": "currency-select",
"required": true,
"filter": { "supportedAs": "output", "compatibleWith": "inputCurrency" }
},
{
"id": "inputAmount",
"label": "Amount",
"type": "number",
"required": true,
"placeholder": "1000.00"
},
{
"id": "inputPaymentMethod",
"label": "Pay In",
"type": "payment-method-select",
"required": true,
"filter": { "currency": "inputCurrency" }
},
{
"id": "chain",
"label": "Chain",
"type": "chain-select",
"required": true,
"filter": { "currency": "outputCurrency" }
},
{
"id": "blockchainSendMethod",
"label": "Send Method",
"type": "select",
"options": ["PERMIT", "TRANSFER"],
"default": "PERMIT"
}
]
}

Currency Definition (configs/currencies/brl.json)

{
"id": "brl",
"symbol": "BRL",
"name": "Brazilian Real",
"type": "fiat",
"flag": "br",
"supportedAs": ["input", "output"],
"paymentMethods": ["pix"],
"chains": [],
"minAmount": 10,
"decimalPlaces": 2
}

Adding a new currency

  1. Create configs/currencies/mxn.json
  2. Create configs/payment-methods/spei.json (if new method)
  3. Done. The BlockRegistry auto-discovers and the builder renders it.

Component Behavior

Canvas

  • React Flow canvas with custom node types (CollapsedNode, ExpandedNode)
  • Grid background: subtle Aurora Violet tint, 24px grid
  • Zoom/Pan: standard React Flow controls, bottom-right
  • Minimap: bottom-left, shows node positions with gradient dots matching block colors
  • Toolbar: center-top, floating with glassmorphism. Buttons: Select, Pan, Auto Layout, Clear All
  • Radial glow: subtle gradient blobs behind node clusters for depth

Nodes

  • Collapsed state (default): icon (Lucide, 1.5px stroke) + title + method badge + endpoint. Compact, ~185px wide
  • Expanded state (on click/double-click): shows inline config form below the header. Currency pair selector with flag icons, amount input, dropdowns for method/chain/send. ~280px wide
  • Selected state: accent border + outer glow ring (2px rgba accent)
  • Validation warning: yellow badge appears above/below node when dependencies are missing
  • Guide link: visible on every node, #A78BFA color, "↗ Integration Guide" — links to the relevant doc page. Must be legible (no dim colors)

Connections (Edges)

  • Animated edges: dashed line with particle dots traveling along the path
  • Gradient colors: source node color → target node color gradient along the edge
  • Auto-binding: when user connects two nodes, the engine checks output→input compatibility and creates bindings automatically. Shows binding badge on target node (e.g., "step2.quoteToken → body.quoteToken")
  • Manual override: click on edge or binding badge to open a mini-panel to remap fields
  • Bezier curves: smooth cubic bezier, not straight lines
  • Collapsible: toggle button (chevron) at the top-right of sidebar to collapse. Canvas expands to fill
  • Collapsed state: thin strip with just category icons, hoverable to see labels
  • Search: filters blocks by name/description as user types
  • Categories: Setup, Operations. Visually separated with category headers
  • Drag interaction: grab cursor on hover, grabbing on drag. Block appears as ghost on canvas while dragging
  • Block preview: icon (with gradient background) + name + endpoint in mono font

Generate Flow Button

  • Disabled state: grayed out when flow has zero blocks or has validation errors. Tooltip explains why
  • Enabled state: Aurora Violet gradient, subtle glow shadow, hover lifts 1px
  • On click: validates flow → resolves all bindings → generates output → opens Report Modal

Report Modal

  • Overlay: dark backdrop, centered modal with max-width ~800px
  • Tabs: Preview (rendered), Markdown (raw), cURL, Node.js, Python, Go
  • Preview tab: each step as a card with step number (gradient badge), method badge, description, code block, binding indicators, Guide link
  • Code tabs: full executable snippet with syntax highlighting. Copy button per block
  • Actions: Copy full content, Download as .md, Export canvas as SVG/PNG, Close
  • Keyboard: Escape to close, Tab to navigate

Color Palette — Aurora Violet

Dark Mode (Default)

RoleColorUsage
bg-deep#060607Page background, deep surfaces
bg-surface#0F0A1ASidebar, modals, panels
bg-card#130E20Node backgrounds, input backgrounds
border#2A1D45Active borders, hover states
border-subtle#1A1230Default borders, dividers
accent#A78BFAPrimary accent, links, highlights, Guide links
accent-dark#7C3AEDButtons, active states, selected borders
accent-bg#1E1035Accent surface tint (badges, code bg)
secondary#F472B6Secondary highlights, bindings, GET badges
success#4ADE80POST badges, success states
info#60A5FAGET badges, info callouts
warning#FBBF24Validation warnings
text-primary#E0DCD8Headings, node titles
text-secondary#BCB6B8Body text, descriptions
text-muted#827F9ASubtle labels, placeholders
text-dim#3C3C54Category headers, disabled text

Light Mode

Inverted palette maintaining the same accent colors:

RoleColor
bg-deep#F8F6F4
bg-surface#FFFFFF
bg-card#F0EDE8
border#D2CCCA
border-subtle#E0DCD8
accent#7C3AED
accent-dark#6D28D9
text-primary#1A1230
text-secondary#3C3C54
text-muted#827F9A

Icons — Lucide React Mapping

BlockIconLucide Name
LoginKey outlinelog-in
KYC Level 1User with checkmarkuser-check
KYBBuildingbuilding-2
Account InfoWalletwallet
BalancesCoinscoins
Beneficiary (wallet)Wallet arrowsend
Beneficiary (bank)Landmarklandmark
Get QuoteBidirectional arrowsarrow-left-right
Create TicketReceiptreceipt
ConvertRefresh arrowsrefresh-cw

All icons: 1.5px stroke weight, 18px size inside 26x26 gradient-filled rounded square.

Animations & Micro-interactions

Connection Flow Particles

  • Small circles (r=2.5) travel along edge paths using SVG animateMotion
  • Color matches the gradient of the edge (source → target)
  • Duration: 2-3s per cycle, infinite repeat
  • Subtle glow pulse animation on the particle (opacity 0.3 → 1.0)

Node Interactions

  • Hover: border brightens from border-subtleborder, soft box-shadow appears (0.2s ease)
  • Select: accent border + 2px outer ring in accent-glow, stronger shadow
  • Expand/Collapse: smooth height transition (0.25s ease-out) with content fade-in
  • Drag from sidebar: ghost preview follows cursor with 0.8 opacity, drop zone highlights on canvas

Canvas Ambient

  • Subtle radial gradients in the background that shift position slightly on mouse move (parallax, very subtle — 2-3px max)
  • Grid lines pulse faintly on node drop (single pulse, 0.3s)

Generate Flow Button

  • Disabled: flat gray, no shadow
  • Enabled: gradient shimmer animation (subtle, 3s cycle), glow shadow
  • Hover: lift 1px (translateY), shadow expands
  • Click: pressed state (scale 0.98), then modal slides up

Report Modal

  • Entry: backdrop fades in (0.2s), modal slides up from bottom (0.3s ease-out)
  • Exit: reverse animation on Escape/Close
  • Tab switch: content cross-fade (0.15s)
  • Width transitions from 230px → 48px (0.25s ease)
  • Block labels fade out, only icons remain in collapsed state
  • Canvas expands to fill the space smoothly

Validation System

Real-time validation runs on every node/edge change:

RuleBehavior
Missing dependencyYellow warning badge: "Requires [Block] before this"
Invalid currency comboRed warning: "BRL → BRL is not a valid combination"
Disconnected nodeSubtle dimming + dashed border
Circular dependencyRed warning: "Circular dependency detected"
Incomplete configOrange dot on node header: "Configure required fields"

Warnings are non-blocking — the developer can see them but isn't forced to fix before exploring. The Generate Flow button only enables when there are zero red/blocking errors.

Keyboard Shortcuts

KeyAction
Delete / BackspaceRemove selected node or edge
Ctrl+ZUndo
Ctrl+Shift+ZRedo
Ctrl+ASelect all nodes
Space (hold)Pan mode
Ctrl+GGenerate Flow (when enabled)
EscapeDeselect / Close modal
Ctrl+FFocus sidebar search
1-9Quick-add block by position in sidebar

Additional Features (My Suggestions)

Flow Templates

Pre-built flow templates that load a common pattern onto the canvas with one click. Accessible from an empty state or a "Templates" button in the toolbar.

  • Onramp BRL→USDC (PIX): Login → KYC → Beneficiary → Quote → Ticket
  • Offramp USDC→BRL: Login → Beneficiary (bank) → Quote → Ticket
  • Cross-border COP→USDC: Login → KYC → Beneficiary → Quote → Ticket
  • Full KYB Setup: Login → KYB → Account Info → Balances

Templates are also defined as JSON configs — easy to add new ones.

Empty State

When canvas is empty, show a welcoming state instead of a blank grid:

  • "Drag blocks from the sidebar or pick a template to get started"
  • 3-4 template cards (most common flows) as quick-start
  • Subtle animated gradient background

URL State Persistence

Encode the current flow as a compressed URL parameter. Developers can share their flow with teammates by sharing the URL. On page load, decode and restore the canvas state.

Snap-to-Grid

Nodes snap to the 24px grid when dropped or moved, keeping the canvas tidy. Can be toggled off in toolbar.

Auto Layout

"Auto Layout" button reorganizes all nodes into a clean top-to-bottom or left-to-right tree layout using dagre algorithm (React Flow has built-in support). Useful after building a complex flow.

Flow Validation Summary

A small floating indicator in the top-right of the canvas: "4 blocks · 3 connections · Ready to generate" or "4 blocks · 2 warnings". Clicking it scrolls/zooms to the first warning.

Dark/Light Mode Transition

Smooth CSS transition (0.3s) on theme toggle. No flash. CSS variables swap via a data-theme attribute on the root.

Tech Stack

LayerTechnologyWhy
CanvasReact Flow (xyflow)Industry standard for node editors. 30k+ stars, active maintenance
StateZustandLightweight, no boilerplate, perfect for React Flow integration
AnimationsFramer Motion + CSSFramer for layout animations, CSS for micro-interactions
IconsLucide ReactAlready in project, minimal stroke icons
StylingCSS ModulesAlready used in project, scoped by default
Code highlightPrism React RendererAlready in project (Docusaurus dependency)
Canvas exporthtml-to-imageLightweight, exports DOM to SVG/PNG
Auto layoutdagreStandard graph layout algorithm, React Flow compatible
URL statelz-stringCompresses flow state for URL sharing

Docusaurus Integration

The builder lives inside the Docusaurus site as a custom page (not a doc). Key integration points:

  • Theme: reads Docusaurus color mode and maps to builder dark/light theme
  • Navigation: accessible from main nav bar as "Builder" tab
  • Routing: /integration-builder path (same as current)
  • Guide links: relative links to /docs/... pages within the same site
  • Static: all logic is client-side, no server needed. Configs are imported at build time

Migration Path

The current integration-builder.tsx (1,530 lines) and flow-config.ts (752 lines) are replaced entirely. No incremental migration — this is a full rewrite. The current files serve as reference for:

  • All supported currency/chain/method combinations → migrated to config JSON files
  • Flow generation logic → migrated to FlowEngine.ts
  • Endpoint/body/header definitions → migrated to block JSON configs

Success Criteria

  • Developer can build a complete integration flow (login → KYC → quote → ticket) in under 60 seconds
  • Adding a new currency requires only creating a JSON file, zero TypeScript changes
  • All blocks link to relevant Integration Guide documentation
  • Canvas is responsive down to 1024px width (sidebar collapses automatically)
  • Dark and light modes work correctly with smooth transitions
  • Generated markdown/code is accurate and copy-pasteable
  • Canvas can be exported as SVG/PNG for documentation purposes
  • Flow state persists in URL for sharing