Documentation

Documentation

2. Configuring Providers & API Keys

Created
Jun 5, 2026
Updated
Jun 17, 2026

Provider configuration lives under the Data provider tab of Chart Settings: the default provider, the connection mode, each equity provider's credentials, and the streaming feed. Binance and OKX need no configuration.

Frontend vs. backend mode

The connection mode decides where provider requests run:

ModeWhere requests runCredentials used
Frontend (default)Directly from your browser to the providerBrowser-exposed keys (NEXT_PUBLIC_*, or keys you enter in Settings)
BackendThrough the app's own /api/tickers/... routesServer-side keys (MASSIVE_API_KEY, ALPACA_API_KEY_ID / ALPACA_API_SECRET_KEY)

Use Backend mode when you want to keep your provider secrets on the server instead of shipping them to the browser. On the server, Alpaca requests use the official @alpacahq/alpaca-trade-api SDK; in the browser they use native fetch and WebSocket (the SDK is never bundled for the browser).

[!NOTE]

If you are an end user, you cannot use backend mode. You must use the frontend to source data from your own data provider. For the US stock market, you need a Massive key or an Alpaca key id + secret. For the crypto market, no action is needed — Binance and OKX both use public endpoints.

Environment variables

When running the app from source, configure keys in a .env.local file:

# --- Massive (US equities) ---
# Backend / server-side key (used in Backend mode)
MASSIVE_API_KEY=your_massive_api_key_here
MASSIVE_STOCKS_WS_FEED=delayed
# Frontend / browser-exposed key (used in Frontend mode)
NEXT_PUBLIC_MASSIVE_API_KEY=your_massive_api_key_here
NEXT_PUBLIC_MASSIVE_STOCKS_WS_FEED=delayed

# --- Alpaca (US equities) ---
# Frontend / browser-exposed key id + secret (used in Frontend mode)
NEXT_PUBLIC_ALPACA_API_KEY_ID=your_alpaca_key_id_here
NEXT_PUBLIC_ALPACA_API_SECRET_KEY=your_alpaca_secret_key_here
NEXT_PUBLIC_ALPACA_DATA_FEED=iex
# Backend / server-side key id + secret (used in Backend mode)
ALPACA_API_KEY_ID=your_alpaca_key_id_here
ALPACA_API_SECRET_KEY=your_alpaca_secret_key_here
ALPACA_DATA_FEED=iex

# --- Binance and OKX (crypto) ---
# No keys required — both providers use public market-data endpoints.
  • MASSIVE_API_KEY / ALPACA_API_KEY_ID + ALPACA_API_SECRET_KEY are used by backend chart routes.
  • The NEXT_PUBLIC_* keys are bundled for the browser and used when that provider is active in Frontend mode.
  • *_STOCKS_WS_FEED sets the Massive websocket feed (realtime or delayed). *_ALPACA_DATA_FEED sets the Alpaca equity feed (iex — free, default — or sip — paid).

Alpaca authenticates with a key id and a secret, and offers no browser-safe publishable credential. In Frontend mode the secret is stored in and exposed to the browser — a deliberate bring-your-own-credential tradeoff, identical to how NEXT_PUBLIC_MASSIVE_API_KEY exposes a browser key. In public deployments, prefer Backend mode so secrets stay on the server.

Alpaca paper keys (id prefixed PK) are automatically routed to the paper trading host; live keys (AK) use the live host. Market-data requests work the same on either.

Entering keys in the app

Settings → Data provider lets you set, per browser (local storage, not synced across devices):

  • the Default provider (Massive, Binance, OKX, or Alpaca),
  • the Massive browser API key and streaming feed,
  • the Alpaca key id, secret key, and data feed (IEX / SIP).

Binance

Binance crypto data uses public Spot REST and websocket endpoints, so it needs no API key and no configuration — opening a pair like BTCUSDT just works.

OKX

OKX crypto data uses public v5 REST and websocket endpoints for both spot pairs and perpetual swaps, so it also needs no API key and no configuration. Open a spot pair like BTC-USDT or a perpetual swap like BTC-USDT-SWAP directly, or use the OK: prefix (e.g. OK:BTC-USDT). See Symbols & Ticker Formats for OKX's dash-separated instId format and how to force OKX when both Binance and OKX cover the same underlying pair.

Next steps

Learn how symbols are typed and resolved.

Next: Symbols & Ticker Formats