If you contribute, you'll get the Contributor rank on the Discord!
Welcome! We love contributors. This project is a monorepo setup to support multiple languages while keeping the core logic centralized.
- core: The heart of the project. Contains the server implementation and the native Node.js library (
pmxt-core). - sdks/python: The Python SDK. (Pip package
pmxt). - sdks/typescript: The TypeScript/Node.js SDK (
pmxtjs).
- Node.js >= 18 (20+ recommended; used in CI)
- npm (comes with Node.js)
This project uses npm workspaces. Run npm install from the root -- it installs dependencies for all packages. Root-level scripts delegate to the right workspace automatically:
npm run dev # builds core in watch mode + starts server
npm run server # starts the sidecar server (core workspace)
npm run generate # regenerates all SDK clients from the OpenAPI spec
npm test # runs the full verification suiteIf you need to run a script in a specific workspace directly:
npm run build --workspace=pmxt-core
npm test --workspace=pmxtjsThe server is the backbone of the SDKs. To develop on it or run it locally:
# From the root
npm run serverOr navigating manually:
cd core
npm install
npm run serverSee the Python SDK Development Guide for detailed instructions on generating and testing the Python client.
This project uses a Sidecar Server Architecture: the core logic is in TypeScript (core/), which SDKs spawn as a background process.
Exchange integrations use an Implicit API pattern: each exchange has an api.ts file (generated from the exchange's OpenAPI spec) that auto-generates callable methods. Unified exchange methods call these via callApi('OperationId', params). See Architecture Overview for a full explanation before touching exchange code.
When adding a public method to BaseExchange.ts:
- Add the method signature and JSDoc comment
- Regenerate the OpenAPI spec:
npm run generate:openapi --workspace=pmxt-core
- Commit both the method and the regenerated
openapi.yaml - A GitHub Actions workflow will verify the spec is in sync on your PR
The OpenAPI spec is auto-generated from BaseExchange.ts via TypeScript AST parsing, so no manual spec editing is needed.
From the root directory, run:
npm run devThis starts both the build watcher and the server concurrently. The SDKs will auto-restart on code changes via a version hash.
If you prefer to run things separately:
# Terminal 1: Build watcher
cd core && npm run build -- --watch
# Terminal 2: Server
npm run serverIf you need a guaranteed fresh server state:
export PMXT_ALWAYS_RESTART=1
# Run your SDK scriptIf the server doesn't shut down cleanly, use:
python3 -c "import sys; sys.path.insert(0, 'sdks/python'); import pmxt; pmxt.stop_server()"- Architecture Overview -- How the sidecar pattern works, request lifecycle, and where different types of changes go
- Adding an Exchange -- Step-by-step guide for implementing a new exchange integration
Thank you for helping us build the future of prediction markets!