Overview
Canvas apps have two ways to access configuration:- Browser runtime —
window.__MIXPEEK__(injected into every HTML response) - Server functions —
ctx.env(available in your handler’s context)
Browser runtime variables
Canvas automatically injects awindow.__MIXPEEK__ object into every HTML page. This includes system variables and any custom environment variables you configure.
System variables (always available)
| Variable | Description |
|---|---|
window.__MIXPEEK__.apiBaseUrl | The API proxy URL (/api) |
window.__MIXPEEK__.appId | Your app’s ID |
window.__MIXPEEK__.slug | Your app’s slug |
window.__MIXPEEK__.environment | Current environment (production, staging, or preview-N) |
Accessing in your app
Use
window.__MIXPEEK__.apiBaseUrl (which resolves to /api) instead of hardcoding https://api.mixpeek.com. The Canvas proxy injects your API key and namespace header server-side, keeping credentials out of the browser.Custom environment variables
Set custom environment variables on your app via the API:- Injected into
window.__MIXPEEK__for browser access - Available as
ctx.envin server functions - Stored encrypted and never exposed in build logs
Server function environment
Server functions receive all environment variables throughctx.env:
MIXPEEK_API_KEY and MIXPEEK_NAMESPACE_ID — these are injected server-side and never reach the browser.

