Deployment

BazaarFi deploys as three services: Solana program, indexer (Node.js + WebSocket), and web app (Next.js). Postgres is shared between the indexer and web API.

Solana program

anchor build
pnpm test:program
anchor deploy --provider.cluster devnet   # ~2.5 SOL
anchor deploy --provider.cluster mainnet  # ~5 SOL

After deploy, run initialize_config once with the upgrade authority. Default fee: 50 bps (0.5%).

Environment

VariablePurpose
DATABASE_URLPostgres connection
HELIUS_API_KEYDAS metadata + portfolio
NEXT_PUBLIC_CLUSTERdevnet or mainnet-beta
NEXT_PUBLIC_RPC_URLSolana RPC endpoint
NEXT_PUBLIC_WS_URLIndexer WebSocket URL
INDEXER_WS_PORTWS listen port (8788)

Indexer

pnpm --filter @bazaarfi/indexer start

Run as a persistent process (systemd, Docker, VPS). Use a dedicated RPC with high rate limits — polling every 3s is RPC-intensive.

Web app

pnpm --filter @bazaarfi/web build
pnpm --filter @bazaarfi/web start

Deployable to Vercel with monorepo build config. The indexer must run separately.

Mainnet checklist

  • Deploy program to mainnet
  • Initialize config
  • Flip NEXT_PUBLIC_CLUSTER=mainnet-beta
  • Run migrations on production Postgres
  • Start indexer on mainnet RPC
  • Deploy web with updated env

Full deployment guide: docs/deployment.md