Skip to content

Getting Started

Welcome to the AK Market developer documentation. This guide covers the platform architecture, setup, and how to get a local development environment running.

Prerequisites

  • Node.js >= 18
  • pnpm (recommended) or npm
  • Foundry (forge, cast, anvil) for smart contract development
  • PostgreSQL for the matcher and backend databases
  • Docker (optional, for containerized deployments)

Repository Structure

contracts-new/
├── packages/
│   ├── ctf-upstream/          # ConditionalTokens vendor package
│   ├── exchange-upstream/     # CTFExchange vendor package
│   └── polymarket-mvp/        # Deploy scripts, oracle adapter, wallets
├── backend/                   # NestJS app backend
├── clob/matcher/              # Fastify CLOB matching engine
├── frontend/dapp/             # Frontend dApp
├── scripts/                   # Market creation & utility scripts
└── docs-site/                 # This documentation site

Quick Start

1. Install Dependencies

bash
# Root monorepo
pnpm install

# Backend
cd backend && npm install

# Matcher
cd clob/matcher && npm install

2. Deploy Contracts (Local)

bash
cd packages/polymarket-mvp

# Start a local Anvil node
anvil &

# Deploy the full suite
make full-suite

This deploys ConditionalTokens, CTFExchange, collateral token, oracle adapter, wallet factories, and registers a test market.

3. Sync Environment

bash
# Auto-sync matcher .env with deployed addresses
make sync-matcher-env

4. Start Services

bash
# Terminal 1: Matcher
cd clob/matcher && npm run dev

# Terminal 2: Backend
cd backend && npm run start:dev

# Terminal 3: Frontend
cd frontend/dapp && npm run dev

5. Verify

Next Steps