
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
SensorCore SDK for JavaScript & TypeScript — logging, analytics, and remote config for browser and Node.js
TypeScript SDK for sending logs to your SensorCore server. Zero external dependencies, works in browser and Node.js 18+.
npm install sensorcore
import SensorCore from 'sensorcore';
// 1. Configure once at app startup
SensorCore.configure({
apiKey: 'sc_your_api_key',
host: 'https://api.sensorcore.dev',
});
// 2a. Fire-and-forget — no await needed, never throws (most common)
SensorCore.log('App launched');
SensorCore.log('User signed up', { level: 'info', userId: 'user-uuid-123' });
SensorCore.log('Payment failed', { level: 'error', metadata: { code: 'card_declined', amount: 99 } });
// 2b. Async/await — when you need delivery confirmation
try {
await SensorCore.logAsync('Critical error', { level: 'error' });
} catch (err) {
console.error('Log failed:', err);
}
| Parameter | Type | Default | Description |
|---|---|---|---|
apiKey | string | — | Your project API key |
host | string | — | Your SensorCore server URL |
defaultUserId | string? | undefined | Auto-attached user ID for every log |
enabled | boolean | true | Set false to silence all logs (e.g. in tests) |
timeout | number | 10000 | Network request timeout in milliseconds |
persistFailedLogs | boolean | true | Save failed logs for auto-retry |
maxPendingLogs | number | 500 | Max entries buffered offline |
pendingLogMaxAge | number | 86400 | Drop buffered entries older than this (seconds) |
SensorCore.configure({
apiKey: 'sc_abc123',
host: 'https://api.sensorcore.dev',
defaultUserId: currentUser?.id,
enabled: process.env.NODE_ENV !== 'test',
timeout: 15_000,
persistFailedLogs: true,
maxPendingLogs: 500,
pendingLogMaxAge: 86400,
});
| Level | Use case |
|---|---|
'info' | General events (default) |
'warning' | Recoverable issues |
'error' | Failures — triggers error indicator in dashboard |
'messages' | User-facing messages / chat events |
Pass a flat object with string, number, or boolean values.
Unsupported types (arrays, nested objects, null) are silently dropped.
SensorCore.log('Purchase completed', {
metadata: {
product_id: 'sku-42',
price: 9.99,
is_trial: false,
attempt: 1,
},
});
When using logAsync, you can catch typed SensorCoreError:
import { SensorCoreError } from 'sensorcore';
try {
await SensorCore.logAsync('Event');
} catch (err) {
if (err instanceof SensorCoreError) {
switch (err.code) {
case 'not_configured': break; // forgot to call configure()
case 'network_error': break; // no internet / timeout
case 'server_error': break; // server returned 4xx / 5xx
case 'encoding_failed': break; // metadata serialisation failed
case 'rate_limited': break; // server returned 429
}
}
}
If the server returns HTTP 429, the SDK activates a circuit breaker with exponential backoff (60s → 120s → 300s → 600s max). After the cooldown expires, logging is automatically resumed. A successful request resets the backoff timer.
When a log fails to send (e.g. no internet), the SDK automatically:
localStorage in browser, ~/.sensorcore/pending.json in Node.js)online event in browser)Each entry keeps its original timestamp from when log() was called.
Safeguards:
persistFailedLogs, maxPendingLogs, pendingLogMaxAgepersistFailedLogs: false to disable entirelyFetch feature flags from your SensorCore server at runtime — no app release needed.
const config = await SensorCore.remoteConfig();
// Typed accessors — always undefined-safe, never crash
if (config.bool('show_new_onboarding') === true) {
showNewOnboarding();
}
const timeout = config.number('api_timeout_seconds') ?? 30;
const variant = config.string('paywall_variant') ?? 'control';
const retries = config.int('max_retries') ?? 3;
remoteConfig() never throws — if the server is unreachable it returns an empty config.
| Accessor | Returns | Notes |
|---|---|---|
bool(key) | boolean | undefined | undefined if absent or wrong type |
string(key) | string | undefined | undefined if absent or wrong type |
number(key) | number | undefined | Any numeric value |
int(key) | number | undefined | Only exact integers |
get(key) | unknown | Raw value |
config.raw | Record<string, unknown> | Full decoded dictionary |
fetch supportfetch)MIT
FAQs
SensorCore SDK for JavaScript & TypeScript — logging, analytics, and remote config for browser and Node.js
The npm package sensorcore receives a total of 8 weekly downloads. As such, sensorcore popularity was classified as not popular.
We found that sensorcore demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.