Building Full-Stack Plugins
Zirzir features a full-stack plugin architecture. You can write custom payment gateways in TypeScript on Bun with dynamic React dashboard extensions.
π Plugin IPC Communication Flow
Section titled βπ Plugin IPC Communication FlowβsequenceDiagram autonumber participant Engine as β‘ Zirzir Server (Rust) participant Worker as π Bun Plugin Worker (Node/TS) participant Gateway as π¦ Remote Payment API
Note over Engine,Worker: Server Startup: Discovery & Handshake Engine->>Worker: Spawn child process over stdio Engine->>Worker: JSON-RPC "info" Worker-->>Engine: Returns { code, name, currencies, config_fields } Engine->>Engine: Dynamically registers provider in ProviderRegistry
Note over Engine,Gateway: Transaction Execution (Zero Downtime) Engine->>Worker: JSON-RPC "charge" { config, reference, amount, phone } Worker->>Gateway: Direct HTTPS API request Gateway-->>Worker: { status: "success", checkout_url: "..." } Worker-->>Engine: Returns { provider_txn_id, payment_url, status }π Plugin Anatomy
Section titled βπ Plugin AnatomyβEvery plugin resides in its own folder inside plugins/:
plugins/my_gateway/βββ plugin.json # Manifest, permissions & sidebar navigationβββ index.ts # Bun backend payment driver (charge, verifyWebhook)βββ ui.tsx # React dashboard extension componentβββ dist/ui.js # Bundled standalone frontend viewπ§ͺ 3-Phase Automated Test Harness
Section titled βπ§ͺ 3-Phase Automated Test HarnessβThe Zirzir CLI includes an automated test harness to verify your pluginβs IPC contract:
graph LR P1[Phase 1: Manifest Inspection<br/>plugin.json valid schema] --> P2[Phase 2: RPC Handshake<br/>stdio JSON-RPC 'info' method] P2 --> P3[Phase 3: Mock Charge Execution<br/>stdio JSON-RPC 'charge' simulation] P3 --> PASS[β
Plugin Ready for Production]
style P1 fill:#1e293b,stroke:#38bdf8,color:#fff style P2 fill:#1e293b,stroke:#f59e0b,color:#fff style P3 fill:#1e293b,stroke:#10b981,color:#fff style PASS fill:#047857,stroke:#10b981,color:#fffzirzir plugin test plugins/santimpay