Skip to content

Infrastructure

CloudBank uses a pnpm monorepo with Turborepo for build orchestration, GitHub Actions for CI/CD, and a multi-target deployment strategy spanning Cloudflare Pages, EC2, and Goldsky.

Monorepo Structure

cloudbank/
├── contracts/        # Solidity contracts (Foundry)
├── services/         # Go backend services
├── apps/
│   ├── web/          # Trading UI (React + Vite)
│   ├── admin/        # Admin panel (React + Vite)
│   ├── node-presale/ # Node sale site (Next.js)
│   └── docs/         # Documentation (VitePress)
├── packages/
│   ├── subgraph/     # GraphQL queries & types
│   └── contracts/    # Generated ABIs & types
├── turbo.json        # Turborepo pipeline config
├── pnpm-workspace.yaml
└── package.json

Build Orchestration

Turborepo manages the build dependency graph across all packages and apps:

  • turbo run build builds all packages in dependency order.
  • turbo run test runs tests across the monorepo with caching.
  • Package outputs are cached locally and in remote cache, so unchanged packages skip rebuilding.
  • The pipeline is configured in turbo.json with explicit dependsOn relationships ensuring packages/* build before apps/*.

CI/CD Pipeline

CloudBank maintains 31+ GitHub Actions workflows covering the full lifecycle of every component.

Contracts Workflows

WorkflowTriggerAction
contracts-buildPR to mainCompile contracts, run static analysis
contracts-testPR to mainRun Foundry test suite (forge test)
contracts-deploy-testnetManual dispatchDeploy to BSC Chapel via Foundry scripts
contracts-deploy-mainnetManual dispatch + approvalDeploy to BSC Mainnet with multi-sig verification

Services Workflows

WorkflowTriggerAction
services-buildPR to mainBuild Go binary, lint
services-testPR to mainRun Go test suite with race detector
services-deployPush to mainBuild Docker image, deploy to EC2 via SSH

Apps Workflows

WorkflowTriggerAction
apps-buildPR to mainBuild all frontend apps
apps-deployPush to mainDeploy to Cloudflare Pages

Subgraph Workflows

WorkflowTriggerAction
subgraph-buildPR to mainCompile AssemblyScript mappings
subgraph-deployPush to mainDeploy to Goldsky hosted service

Documentation Workflows

WorkflowTriggerAction
deploy-docs-testPush to mainAuto-deploy docs to test environment
deploy-docs-liveManual dispatchDeploy docs to production

Deployment Targets

Frontend — Cloudflare Pages

All frontend applications deploy to Cloudflare Pages with automatic preview deployments for pull requests. Production deployments trigger on push to the main branch. Cloudflare's edge network provides global CDN distribution with sub-50ms TTFB in most regions.

Backend — EC2 + Docker Compose

The Go backend runs on an EC2 instance orchestrated with Docker Compose. The composition includes:

  • API server — The Gin-based HTTP service.
  • MySQL — Primary data store.
  • Redis — Cache, rate limiting, and session storage.

Deployments are executed via SSH from GitHub Actions, pulling the latest Docker image and performing a rolling restart.

Subgraph — Goldsky

The Graph subgraph is deployed to Goldsky's hosted service, which handles indexing infrastructure, query serving, and monitoring. Deployments use the Goldsky CLI integrated into the CI pipeline.

Contracts — Foundry Scripts

Smart contract deployments use Foundry's forge script command with:

  • Testnet (BSC Chapel) — Triggered manually, uses a dedicated deployer wallet.
  • Mainnet (BSC) — Requires manual dispatch plus environment approval gates.

Environment Management

GitHub Environments with protection rules gate sensitive deployments:

  • testnet — No approval required, accessible to all maintainers.
  • mainnet — Requires approval from at least one designated reviewer.
  • production — Backend production deploys require approval.

Each environment stores its own set of secrets (RPC URLs, deployer keys, API tokens) isolated from other environments. Secrets are injected into workflows at runtime and never persisted in artifacts or logs.