Configuration Guide
Learn how to configure the SDK for your specific needs.
Basic Configuration
Initialize the client with your API key:
javascript
import { Client } from '@your-sdk/core';
const client = new Client({
apiKey: process.env.API_KEY
});
Environment Variables
Store sensitive information in environment variables:
bash
# .env
API_KEY=your_api_key_here
ENVIRONMENT=production
javascript
const client = new Client({
apiKey: process.env.API_KEY,
environment: process.env.ENVIRONMENT
});
Advanced Configuration
Custom Base URL
javascript
const client = new Client({
apiKey: process.env.API_KEY,
baseURL: 'https://api.custom-domain.com'
});
Request Timeout
javascript
const client = new Client({
apiKey: process.env.API_KEY,
timeout: 30000 // 30 seconds
});
Retry Configuration
javascript
const client = new Client({
apiKey: process.env.API_KEY,
retry: {
maxAttempts: 3,
delay: 1000
}
});
TypeScript Configuration
For TypeScript projects, enable strict type checking:
json
{
"compilerOptions": {
"strict": true,
"esModuleInterop": true
}
}
Best Practices
- Never commit API keys to version control
- Use environment variables for configuration
- Enable logging in development
- Set appropriate timeouts for your use case
Recommended production setup
Create environment-specific keys
Issue separate API keys for staging and production. Rotate keys if someone leaves the team or a key is exposed.
Load secrets from your host
Use your platform’s secret manager or encrypted env variables—never hard-code keys in the client bundle.
Tune timeouts and retries
Set timeouts and retry budgets that match your upstream SLAs so transient errors recover without overwhelming the API.
Verify before deploy
Run integration tests against a sandbox project and confirm logging redacts sensitive fields.
Is this page helpful?