Introduction
The fastest way to ship a branded Partner API front end is to clone the example app that already speaks OAuth, demo/real wallets, charts, contracts, and webhooks. Reskin it, point it at your sandbox client, then deploy the same tree from GitHub to Vercel.
The example lives in this repo at packages/partner-example. It is a Vite React app plus same-origin /api/oauth/start and /api/oauth/token handlers so CLIENT_SECRET never reaches the browser.
Clone the repo
From GitHub, clone brian-kiplagat/indices and install from the monorepo root so the trading SDK resolves as a workspace package.
Clone and install
git clone https://github.com/brian-kiplagat/indices.git
cd indices
pnpm install
pnpm --filter @smartbet/trading-sdk build
cp packages/partner-example/.env.example packages/partner-example/.envIf your organization forks the repo, clone that fork instead. Keep the package path packages/partner-example unless you extract it into its own project.
Register redirect and env
In Referrals, open Apps and create a sandbox OAuth app (partner_test_*). Register the redirect URI exactly. Locally that is http://localhost:5174/callback. On Vercel it is https://<your-app>.vercel.app/callback.
Put these values in packages/partner-example/.env (local) and in the Vercel project env (Production + Preview). Never prefix CLIENT_SECRET with VITE_.
CLIENT_ID— sandbox or live OAuth client idCLIENT_SECRET— server-only; used by/api/oauth/tokenAPI_BASE_URL— Partner API origin, e.g.https://api.coinpes.comREDIRECT_URI— must match the registered URI character for characterOAUTH_SCOPE— includecontract:readandcontract:writeif you show or place timed contracts
Run locally
Dev server
pnpm --filter partner-example devOpen http://localhost:5174, connect a test Coinpes user, and place a demo contract. Confirm the wallet, chart ticks, and activity list before you change branding.
Reskin the UI
Keep the SDK calls and OAuth routes. Change look and copy in:
packages/partner-example/src/index.css— colors, type, layout tokenspackages/partner-example/public/ui— logos and icons (dark theme at the root, light theme underpublic/ui/light)- Header copy and product names in
src/App.tsxand the ticket/panels undersrc/components
Leave api/oauth/*.ts and PKCE in place. Those files exist so the secret stays on the server when you deploy.
Deploy from GitHub
In Vercel, import the GitHub repo. Set the project Root Directory to packages/partner-example. The package vercel.json already installs from the monorepo root, builds @smartbet/trading-sdk, then builds the Vite app.
- Connect the GitHub repo (or your fork) to Vercel.
- Root Directory:
packages/partner-example. - Add the same env vars as local, with
REDIRECT_URIset to the production callback URL. - Register that production callback on the OAuth client.
- Deploy. Connect from the live origin and complete one demo fill before you switch to a
partner_live_*client.
Preview deployments get their own origin. Either add each preview callback URI on the OAuth client, or restrict OAuth testing to Production until the URI list is stable.
