A self-hosted, visual trading-bot builder on the Deriv WebSocket API. Drag-and-drop strategy building with Blockly, an interactive SmartCharts chart, automated strategy execution, and dashboard/tutorials.
Note: Unlike the other templates in this repo (Rise/Fall, Accumulators, Digits) which are Next.js apps, the bot is a Rsbuild + React Router single-page app. The commands, build output, and environment variables below differ accordingly.
- Node.js 18.18 or later
- Log in to your Deriv account and go to the API Token page to create a token with the required scopes.
- Navigate to App Registration and register a new application.
- Set the Redirect URI to the URL where you will host this app (e.g.
http://localhost:4003for local development). - Copy the App ID shown after registration — you will need it in the next step.
Copy .env.example to .env and fill in your values:
cp .env.example .env# Required: Deriv app id — drives OAuth login/sign-up and WebSocket connections.
NEXT_PUBLIC_DERIV_APP_ID=your_app_id_here
# Optional: environment + affiliate attribution.
NEXT_PUBLIC_DERIV_ENV=production
NEXT_PUBLIC_DERIV_REFERRAL_LINK=your_referral_link_here
# Optional: Google Drive integration (leave blank to disable).
GD_CLIENT_ID=
GD_APP_ID=
GD_API_KEY=| Variable | Description |
|---|---|
NEXT_PUBLIC_DERIV_APP_ID |
Deriv app id issued for your registered app. Drives OAuth login/sign-up and WebSocket connections. Without it, Log in / Sign up stay disabled. |
NEXT_PUBLIC_DERIV_ENV |
production for live Deriv endpoints; preview (or staging) for staging. Read by both the bot's URL resolver and @deriv/core for OAuth. |
NEXT_PUBLIC_DERIV_REFERRAL_LINK |
Affiliate referral link — appended as affiliate_token / utm_campaign on OAuth (optional). |
GD_CLIENT_ID / GD_APP_ID / GD_API_KEY |
Google Drive integration credentials for saving/loading strategies (optional). |
These variables are injected at build time via Rsbuild's
source.define(seersbuild.config.ts), so re-build after changing them.
npm install
npm run devThe app is available at http://localhost:4003. (npm install and npm run dev
also regenerate brand CSS — see Branding below.)
npm run buildThis produces a static build in the dist/ directory (Rsbuild output — there is no
.next/out). Serve the contents of dist/ from any web server or static host.
SmartCharts engine assets are copied into dist/js/smartcharts/ during the build.
Saving/loading strategies to Google Drive stays disabled unless GD_CLIENT_ID,
GD_APP_ID, and GD_API_KEY are all set. If it's not set up in your host
environment yet:
- Get the credentials — follow Google's Picker set-up guide:
enable the Google Picker API + Drive API, then create an OAuth 2.0
Client ID (Web application) and an API key. Use the project number as
GD_APP_ID. - Authorize your domain — add your deployed URL (e.g.
https://your-app.vercel.app) to the OAuth client's Authorized JavaScript origins (exact origin; no wildcards). - Set them in your host env — not in source — add the three vars to your host (Vercel → Settings → Environment Variables; Heroku → Settings → Config Vars). Don't commit them to the repo.
- Rebuild — they're baked in at build time (
source.define), so trigger a new build/deploy.
Deploying via Deriv App Builder? Open your app in Edit mode and enter these three values — App Builder injects them into your host environment for you (never into the app source).
Branding (logo, primary color, fonts, app name) is driven by brand.config.json,
not Next.js config:
- Colors / fonts / app name — edit
brand.config.json, then runnpm run generate:brand-cssto bake the values into the theme CSS variables. This runs automatically onnpm install,npm run dev, andnpm run build. - Logo — drop a
public/logo.<png|jpg|jpeg|webp>to set the header logo; it is also used as the favicon. Without it, a letter badge (the app name's first letter) is shown. - Theme — a light/dark toggle lives in the header; the chart re-themes with it.
When assembled by the App Builder, these are configured for you (logo upload, color, font, and app name are injected at deploy time).