HeliumTS is under active development. Expect bugs and breaking changes. If you find any issues, please report them in our GitHub
A stable release is planned for early 2026.
Configuration
Helium's configuration file lets you customize server behavior, RPC transport, security, payload limits, and proxy handling from one place. Create helium.config.ts, helium.config.js, or helium.config.mjs in your project root.
heliumts/client.Basic Configuration
1import type { HeliumConfig } from "heliumts/server";23const config: HeliumConfig = {4 // Your configuration here5};67export default config;
HTTP Security Headers
Control Helium's default headers, override specific values, or remove headers when needed.
1import type { HeliumConfig } from "heliumts/server";23const config: HeliumConfig = {4 security: {5 // Apply Helium defaults (X-Frame-Options, Referrer-Policy, etc.)6 defaultHeaders: true,78 // Final overrides applied last9 headerOverrides: {10 "X-Frame-Options": "SAMEORIGIN",11 "Permissions-Policy": null,12 "X-Custom-Security": "enabled",13 },1415 contentSecurityPolicy: "default-src 'self'; frame-ancestors 'self'",16 hsts: true,17 corsOrigins: ["https://app.example.com"],18 },19};2021export default config;
security.defaultHeaders: defaults totrue. Setfalsefor full manual control.security.headerOverrides: use strings to set/override headers andnullto remove a header.security.contentSecurityPolicy,security.hsts, andsecurity.corsOriginsremain supported.
RPC Configuration
Transport Mode
1const config: HeliumConfig = {2 rpc: {3 transport: "websocket", // "websocket" | "http" | "auto"4 autoHttpOnMobile: false,5 },6};
websocket(default): lowest latency after connection warm-up.http: stateless request/response transport per call.auto: chooses transport based on network and device conditions.autoHttpOnMobile: iftrue, mobile devices prefer HTTP even when connected to Wi-Fi.
Compression
1const config: HeliumConfig = {2 rpc: {3 compression: {4 enabled: true,5 threshold: 1024,6 },7 },8};
Compression uses WebSocket per-message deflate. Messages smaller than threshold are not compressed to avoid unnecessary overhead.
Security and Rate Limiting
1const config: HeliumConfig = {2 rpc: {3 security: {4 maxConnectionsPerIP: 10,5 maxMessagesPerWindow: 100,6 rateLimitWindowMs: 60000,7 tokenValidityMs: 30000,8 },9 },10};
maxConnectionsPerIPdefaults to10. Set0to disable.maxMessagesPerWindowdefaults to100. Set0to disable.rateLimitWindowMsdefaults to60000.tokenValidityMsdefaults to30000.
Payload Limits
1const config: HeliumConfig = {2 rpc: {3 maxWsPayload: 10_485_760,4 maxBodySize: 10_485_760,5 maxBatchSize: 50,6 },7};
maxWsPayloaddefault:1048576(1 MB).maxBodySizedefault:1048576(1 MB).maxBatchSizedefault:20.
Proxy Configuration
Set trustProxyDepth to match your proxy chain so IP-based limits work correctly.
1const config: HeliumConfig = {2 trustProxyDepth: 1,3};
0(default): trust no proxy headers.1: recommended for most managed platforms.2+: for multi-proxy setups.
Security note: setting this value too high can allow spoofed client IPs.
Complete Example
1import type { HeliumConfig } from "heliumts/server";23const config: HeliumConfig = {4 trustProxyDepth: 1,5 rpc: {6 transport: "websocket",7 autoHttpOnMobile: false,8 compression: {9 enabled: true,10 threshold: 1024,11 },12 security: {13 maxConnectionsPerIP: 10,14 maxMessagesPerWindow: 100,15 rateLimitWindowMs: 60000,16 tokenValidityMs: 30000,17 },18 maxWsPayload: 10_485_760,19 maxBodySize: 10_485_760,20 maxBatchSize: 50,21 },22};2324export default config;
Environment-Specific Configuration
1import type { HeliumConfig } from "heliumts/server";23const isDevelopment = process.env.NODE_ENV === "development";4const isProduction = process.env.NODE_ENV === "production";56const config: HeliumConfig = {7 trustProxyDepth: isProduction ? 1 : 0,8 rpc: {9 compression: {10 enabled: isProduction,11 threshold: 1024,12 },13 security: {14 maxConnectionsPerIP: isDevelopment ? 100 : 10,15 maxMessagesPerWindow: isDevelopment ? 1000 : 100,16 rateLimitWindowMs: 60000,17 tokenValidityMs: 30000,18 },19 },20};2122export default config;
Production Deployment Notes
- If
helium.config.tsexists,helium buildtranspiles it todist/helium.config.js. - If
helium.config.jsexists, it is copied todist/helium.config.js. - If
helium.config.mjsexists, it is copied todist/helium.config.mjs.
At runtime, helium start checks the dist directory first, then the project root.
Configuration Loading Order
- Checks the
HELIUM_CONFIG_DIRenvironment variable. - Resolves config files in this order:
helium.config.js,helium.config.mjs, thenhelium.config.ts(dev with Vite).