GrainConfig Interface
All available configuration options when creating a Grain client:Required Options
tenantId
Your unique tenant identifier from Grain. Use the alias shown on your dashboard (not the UUID). Get this from grainql.com/dashboard.Authentication Options
authStrategy
Choose your authentication method:'NONE'- No authentication (default)'SERVER_SIDE'- Secret key authentication'JWT'- JSON Web Token authentication
secretKey
Required forSERVER_SIDE authentication. Never expose in client code.
authProvider
Required forJWT authentication. Provides tokens for requests.
User Options
userId
Global user ID for all events. Can be changed withsetUserId().
API Options
apiUrl
Custom API endpoint. Defaults tohttps://api.grainql.com.
Batching Options
batchSize
Number of events to accumulate before sending. Default:50.
flushInterval
Milliseconds between automatic flushes. Default:5000 (5 seconds).
0 to disable automatic flushing (manual only).
Retry Options
retryAttempts
Number of retry attempts for failed requests. Default:3.
retryDelay
Base delay in milliseconds between retries. Uses exponential backoff. Default:1000 (1 second).
Remote Config Options
defaultConfigurations
Default values for configurations. Returns immediately, no API call needed.configCacheKey
Custom key for localStorage cache. Default:'grain_config'.
configRefreshInterval
Milliseconds between automatic config refreshes. Default:300000 (5 minutes).
0 to disable automatic refreshing.
enableConfigCache
Enable/disable configuration caching. Default:true.
Debug Options
debug
Enable console logging for debugging. Default:false.