Getting Started
Lumber is an end-to-end encrypted logging SDK for Node.js. Logs are encrypted client-side with AES-256-GCM before they ever leave your server - the Lumber API stores only ciphertext.
Prerequisites
- Node.js 18 or later (requires built-in
fetch) - A Lumber account - you sign up in the Lumber mobile app for iOS and Android, which is coming soon to the App Store
Create an app in Lumber
Your plugin needs two values: an encryption key and an API key. Both come from the Lumber mobile app.
- In the Lumber app, open Apps, tap +, give your app a name, and tap Create App.
- Lumber generates the app's encryption key on your device and shows it once on the Your Encryption Key screen. Tap the copy button to copy it. You can copy it again later from the app's Secrets screen on any of your devices that holds the key.
- Tap Next: Create an API Key. On the app's Secrets screen, tap Add Key, optionally name it, and tap Create. Copy the API key right away - it's only shown once.
Keep both values in your environment - never commit them to source control.
# .env
LUMBER_API_KEY=your_api_key_here
LUMBER_ENCRYPTION_KEY=your_base64_encryption_key_here
The encryption key never reaches Lumber's servers in readable form. The app keeps it in your device's secure storage, and the only copies that leave the device are encrypted to the account key of each person who has access to the app. See Authentication for how keys are shared with your team.
Installation
npm install @infinitetoken/lumber
Configure the client
Call lumber.config() once at application startup before any logging:
import lumber from '@infinitetoken/lumber'
lumber.config({
apiKey: process.env.LUMBER_API_KEY!,
encryptionKey: process.env.LUMBER_ENCRYPTION_KEY!,
})
Send your first log
lumber.info('Server started', { port: 3000 })
lumber.debug('Database connected', { host: 'localhost' })
lumber.warn('Cache miss', { key: 'user:123' })
lumber.error('Request failed', { statusCode: 500, path: '/api/orders' })
Open the Lumber app to see your logs, decrypted on your device. On plans with realtime streaming (Dev and up), new logs appear as they arrive.
Enable console output
During development, mirror logs to the console with timestamps and color:
lumber.config({
apiKey: process.env.LUMBER_API_KEY!,
encryptionKey: process.env.LUMBER_ENCRYPTION_KEY!,
console: {
timestamp: 'time',
color: true,
data: true,
},
})
Flush on shutdown
The SDK uses an internal async queue. Call lumber.flush() during graceful shutdown to drain any pending logs:
process.on('SIGTERM', async () => {
await lumber.flush()
process.exit(0)
})
Next steps
- Authentication - API keys, encryption keys, and sharing apps with your team
- Log Ingestion - learn about log levels, structured data, and the async queue
- Configuration - full reference for all config options
- API Reference - REST endpoint documentation