Pred Leverage is a leveraged prediction-market stack built around five main pieces:
client/is the Next.js frontend where users browse markets, trade, deposit, withdraw, and manage LP positions.server/is the Express API that serves market data, authenticates users, talks to MongoDB, integrates with Polymarket, and submits on-chain actions.contracts/contains the Solidity contracts for margin, LP liquidity, netting, fee distribution, recovery, and circuit breaking.cre/contains Chainlink CRE workflows that automate syncing and recovery.scripts/contains small Python operator utilities for Polymarket credentials and position inspection.
At a high level, the system works like this:
- The frontend in
client/calls the backend inserver/usingNEXT_PUBLIC_API_URL. - The backend serves public market data, verifies wallet-linked user requests with Privy identity tokens, and stores application state in MongoDB.
- When blockchain features are enabled, the backend initializes
etherscontract clients using deployed addresses and ABIs copied fromcontracts/. - Contract-aware services in
server/services/manage vault deposits, trading, LP state, recovery, swaps, and netting. - CRE workflows in
cre/run off-chain automation. They can call protected backend endpoints, read chain state, and submit CRE reports to on-chain receiver contracts. - Operational scripts in
scripts/help with Polymarket API setup and manual inspection tasks.
client/: Next.js frontend, wallet/auth integration, trading and LP UI.server/: Express API, MongoDB, Socket.IO, Privy auth, Polymarket, and contract integrations.contracts/: Hardhat project for deploying and testing the Solidity contracts.cre/: Chainlink CRE workflows for market sync, recovery, circuit breaker, and rebalancing.scripts/: Python utilities for Polymarket credentials and position lookup.
For normal product development, you usually only need the frontend and backend:
- Install dependencies in
client/andserver/. - Copy
client/.env.templateandserver/.env.templateinto local env files and fill in the required values. - Start the backend from
server/. - Start the frontend from
client/.
The other folders are used when you need contract deployments, CRE automation, or Polymarket operator tooling.
contracts/andserver/are linked by ABI files and deployed contract addresses.cre/depends on both backend routes and deployed contracts.scripts/is standalone and intended for manual/operator use.