> ## Documentation Index
> Fetch the complete documentation index at: https://docs.signalium.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Development

> Monorepo layout and the day-to-day commands you'll actually run.

## Monorepo layout

```
.
├── apps/
│   ├── api/             Bun + Hono REST (X eval, markets, price feed, positions)
│   ├── web/             Next.js 15 + Reown AppKit + HeroUI v3
│   ├── judge-worker/    Bun cron — runs the judge in TEE + posts on-chain
│   └── documentation/   This Mintlify site
├── packages/
│   ├── contracts/       Solidity (Foundry) — 138 unit + 4 mainnet fork tests
│   ├── sdk/             Viem-based TypeScript SDK (incl. fetchMarketYield)
│   ├── ai-gatekeeper/   Gatekeeper / writer / judge prompts + OpenAI-style client
│   ├── shared/          Types + 0G network + contract constants
│   ├── graphql/         Goldsky subgraph client (typed queries)
│   ├── storage/         0G Storage SDK wrapper (judge prompt seal + retrieve)
│   └── subgraph/        Goldsky manifest + handlers
├── deploy/              pm2 ecosystem + nginx vhosts + bootstrap notes
└── turbo.json
```

## Common commands

```bash theme={null}
# Boot everything
pnpm dev              # api (3001) + web (3000) in parallel

# Per-package
pnpm --filter @signalium/web dev
pnpm --filter @signalium/api dev
pnpm --filter @signalium/judge-worker tick   # one-shot resolution sweep

# Quality gates
pnpm typecheck        # tsc --noEmit on every TS package
pnpm lint             # eslint + solhint + forge fmt across all 11 packages

# Contracts
pnpm --filter @signalium/contracts test
pnpm --filter @signalium/contracts test --fork-url https://evmrpc.0g.ai
```

## A note on networks

Signalium is **mainnet-only**. Gimo's `StakePool` (the per-market yield destination) only exists on 0G mainnet, so the whole stack assumes chain id `16661`. There's no testnet path — and no public faucet, since native 0G is a tradable asset.

Local `pnpm dev` connects you to the live mainnet contracts. To exercise the create/bet flow without real exposure, bridge a sub-cent amount of 0G into a fresh wallet — the 1% bet fee on a 0.001 0G stake is negligible.

If you want your own factory/resolver to play with, the deploy script is:

```bash theme={null}
cd packages/contracts
forge script script/Deploy.s.sol:Deploy \
  --rpc-url $OG_MAINNET_RPC_URL \
  --broadcast --legacy --with-gas-price 3000000000
# copy printed MarketFactory + AIResolver addresses into your .env as
# NEXT_PUBLIC_FACTORY_ADDRESS and NEXT_PUBLIC_RESOLVER_ADDRESS, then restart pnpm dev
```

## Editing these docs

The docs site uses [Mintlify](https://mintlify.com). Run a hot-reload preview:

```bash theme={null}
pnpm --filter @signalium/documentation dev
# opens at http://localhost:3000 (Mintlify dev port)
```

Pages are MDX — write in `apps/documentation/`, navigation lives in `docs.json`. Mint deploys are linked from the GitHub repo; pushes to `main` redeploy automatically.
