How bnb-chain/canonical-bridge works
Project type and purpose
• This is a monorepo for a full-stack, modular token-bridge solution on BNB Chain, comprised of:
• a NestJS-based data service (“canonical-bridge-server”)
• a Next.js/React UI (“canonical-bridge-ui”)
• a reusable TypeScript SDK (“canonical-bridge-sdk”)
• an embeddable React widget (“canonical-bridge-widget”)
• The purpose is to let end-users and integrators perform and display cross-chain token transfers via multiple bridge protocols (cBridge, deBridge, Stargate, LayerZero, Meson).
File structure
• Top-level directories:
• apps/ – contains two runnable services: server (NestJS + Prisma + Redis) and UI (Next.js)
• packages/ – two libraries: sdk (core adapters & aggregator) and widget (React component + UI modules)
• common/ – monorepo tooling, Rush config, git hooks, CI scripts
• Server structure follows NestJS modules (bridge, token, health), shared services (database, Prisma, ioredis, web3) and background processors/schedulers.
• UI is a Next.js project with pages, core components, theme, wallet integration, and static assets.
• SDK contains adapters per protocol, core logic, and aggregator.
• Widget wraps the SDK + React components, hooks, providers, and contract abstractions for easy integration.
README for additional insights
• Confirms multi-bridge support and cross-chain transfer features.
• Describes the data service (server), the example UI, the SDK, and the widget.
• Points to GitHub Actions for CI/CD and Rush for monorepo management.