HighGarden

Polymarket depth. Solana speed.

Full-stack engineerTeam projecthighgarden.trade

The HighGarden trading screen, with an open market and its price chart.

01What it does

HighGarden lets you trade YES and NO shares in Solana USDC. A Solana program holds the money, records every position and pays out. Services off the chain copy Polymarket's order book, price each trade, and place a matching hedge on Polymarket for every fill.

I owned the market data path: the service that mirrors Polymarket, the WebSocket layer that sends it to every open screen, and the trading screens that draw it.

Role
Full-stack engineer. Market data, the real-time layer and the trading screens
Team
A small team. The on-chain program and the trade router were led by teammates
Stack
Next.js, Express on Bun, Redis, Postgres and a Rust program on Solana
Status
Live at highgarden.trade

02The stack

Frontend
Next.js 16React 19Tailwind 4ZustandRechartsMotion
Backend
Express 5 on BunwsBullMQEmail OTP + JWT
Data
Postgres 16Prisma 7Redis 7
Chain
Solana program in RustEd25519 signed quotesPolymarket CLOB
Infra
PM2nginx

03Backend

What I solved on the backend

01

A mirror that keeps the book alive

Every price on the site comes from Polymarket's feed, and that feed drops.

A separate mirror service holds the upstream WebSocket. It sends heartbeats, reconnects with a growing wait, and publishes every book update to Redis. The API server tells it which tokens to follow, so only markets someone is watching get mirrored.

  • WebSocket
  • Redis Pub/Sub
  • Backoff
02

One upstream fetch for a crowd

When a market gets busy, many screens ask for the same book in the same instant.

A snapshot cache that lives for 1.5 seconds. Requests that arrive while a fetch is still running share that one promise, so a hundred subscribers cost one call.

  • Snapshot cache
  • Shared promises
03

Channels that count their listeners

The server should only listen to Redis for markets that are open on some screen.

Each Redis channel keeps a count. The first client to ask for a token opens the channel, and the last one to leave closes it. Token to client maps make the fan-out a direct lookup.

  • Reference counting
  • ioredis
  • ws
04

Limits at the socket door

An open WebSocket endpoint is an easy thing to flood.

The server checks the origin of every connection, caps connections per IP at 10 and caps subscriptions per socket at 50.

  • Origin check
  • Per-IP caps

04Design

What I solved on the design side

01

An order book that shows movement

A book that only swaps numbers looks frozen, even when it is busy.

Each row flashes green or red when its price moves, with a depth bar behind it. You can feel the market without reading a single number.

  • Price flashes
  • Depth bars
A HighGarden market page with the order book next to the price chart.
02

Corner-cut buttons and panels

Rounded cards made a trading screen look like any other app.

Buttons and panels get their cut corners from a clip path worked out in code, so the shape holds at any size. The YES and NO buttons on this page are built the same way.

  • clip-path
  • Component system