Modern TypeScript framework for building JavaScript SDKs
SDK Kit provides a composable, plugin-based architecture for building type-safe, tree-shakeable JavaScript SDKs. Built with TypeScript and designed for modern development workflows, it offers the flexibility of a minimal core with the power of capability-based plugins.
About: SDK Kit started as a personal learning project during winter break 2025, exploring production SDK architecture patterns. Now maintained at prosdevlab for continued development.
Building a JavaScript SDK shouldn't mean starting from scratch every time. SDK Kit provides the foundational patterns and architecture that successful SDKs need:
- Plugin Architecture - Functional, composable plugins with capability injection
- Type-Safe - Full TypeScript support with inference and strict types
- Tree-Shakeable - Build-time plugin exclusion for optimal bundle sizes
- Framework-Agnostic - Works in vanilla JS, React, Vue, Svelte, or any framework
- Event-Driven - Built-in event system with wildcard pattern matching
- Zero Dependencies - Minimal footprint, maximum flexibility
- Developer Experience - Intuitive API inspired by proven SDK patterns
π Phase 2 Complete! Essential plugins ready for production use.
Core Framework:
- β Core SDK with plugin system
- β 5 capabilities (Emitter, Config, Namespace, Expose, Requirer)
- β 550+ tests with 98%+ coverage
- β Full TypeScript support
Essential Plugins:
- β Storage (localStorage/sessionStorage/cookies/memory)
- β Context (browser/device detection)
- β Poll (async resource polling)
- β Queue (batching & persistence)
- β Transport (fetch/beacon/pixel/XHR)
- β Consent (OneTrust/CookieBot)
See ROADMAP.md for what's next.
sdk-kit/
βββ packages/
β βββ core/ # @prosdevlab/sdk-kit - Core SDK framework β
β βββ plugins/ # @prosdevlab/sdk-kit-plugins - Essential plugins β
β βββ testing/ # @prosdevlab/sdk-kit-testing - Testing utilities β
βββ examples/
β βββ minimal-sdk/ # Working example SDK β
βββ tests/
β βββ integration/ # Integration tests β
β βββ e2e/ # End-to-end tests β
βββ specs/ # Feature specifications
Install SDK Kit from npm:
npm install @prosdevlab/sdk-kit
# or
yarn add @prosdevlab/sdk-kit
# or
pnpm add @prosdevlab/sdk-kitInstall with plugins:
npm install @prosdevlab/sdk-kit @prosdevlab/sdk-kit-pluginsimport { SDK } from '@prosdevlab/sdk-kit';
import { storagePlugin } from '@prosdevlab/sdk-kit-plugins/storage';
const sdk = new SDK({
name: 'my-sdk',
version: '1.0.0'
});
sdk.use(storagePlugin);
await sdk.init();
// Use storage
sdk.storage.set('key', 'value');For contributing or building from source:
Prerequisites:
- Node.js (v22 LTS or higher)
- pnpm (v9 or higher) Prerequisites:
- Node.js (v22 LTS or higher)
- pnpm (v9 or higher)
Clone and build:
# Clone the repository
git clone https://github.com/prosdevlab/sdk-kit.git
cd sdk-kit
# Install dependencies
pnpm install
# Build all packages
pnpm build
## Usage Examples
### Basic SDK
See the [minimal-sdk example](./examples/minimal-sdk) for a complete working SDK.
```typescript
import { SDK } from '@prosdevlab/sdk-kit';
// Create a simple plugin
function myPlugin(plugin, instance, config) {
plugin.ns('my');
plugin.defaults({ my: { setting: 'value' } });
plugin.expose({
greet(name) {
plugin.emit('greeting', { name });
return `Hello, ${name}!`;
}
});
instance.on('sdk:ready', () => {
console.log('SDK ready!');
});
}
// Use the SDK
const sdk = new SDK({ my: { setting: 'custom' } });
sdk.use(myPlugin);
sdk.init();
sdk.greet('World'); // "Hello, World!"
Plugins are functions that receive capabilities and compose functionality:
export default function myPlugin(plugin, instance, config) {
plugin.ns('my.plugin');
plugin.defaults({ my: { setting: 'default' } });
plugin.expose({
myMethod() {
plugin.emit('my-event', { data: 'value' });
}
});
instance.on('sdk:ready', () => {
console.log('SDK initialized');
});
}Plugins receive only the capabilities they need, enabling explicit dependency management and better tree-shaking:
interface Plugin extends Emitter, Defaulter, Namespaced, Exposer {}Conditionally include plugins at build time for optimal bundle sizes:
// Only include what you need
if (!PLUGIN_EXCLUDED_STORAGE) {
sdk.use(storagePlugin);
}Comprehensive guide for building SDK Kit plugins, covering:
- Plugin Types - Storage-like, collectors, utilities, and orchestration plugins
- Design Patterns - Capability injection, lazy initialization, graceful degradation
- Testing Strategies - Unit tests, integration tests, and coverage targets
- Best Practices - From 6 production plugins in the essential plugins package
- Tier 1 vs Tier 2 - When to build generic vs. company-specific plugins
Perfect for developers building custom plugins or contributing to the core plugin library.
# Run all tests (unit + integration)
pnpm test
# Run only unit tests
pnpm test:unit
# Run only integration tests
pnpm test:integration
# Run tests in watch mode
pnpm test:watch
# Run with coverage
pnpm test:coverage# Lint all packages
pnpm lint
# Format all packages
pnpm format# Build all packages
pnpm build
# Build a specific package
pnpm -F "@prosdevlab/sdk-kit" build
# Watch mode for development
pnpm -F "@prosdevlab/sdk-kit" dev# Type check all packages
pnpm typecheck- Analytics SDKs - Event tracking, session management, user identification
- Personalization SDKs - A/B testing, feature flags, dynamic content
- Communication SDKs - Chat, notifications, webhooks
- Data Collection SDKs - Form handling, validation, submission
- Integration SDKs - Third-party API wrappers with local state
SDK Kit is designed with the following principles:
- Composable - Build complex SDKs from simple, focused plugins
- Type-Safe - Catch errors at compile time, not runtime
- Efficient - Ship only what's needed with automatic tree-shaking
- Flexible - Work with any framework or none at all
- Testable - Isolated plugins are easy to test and maintain
Core SDK framework with plugin system, event emitter, and configuration management.
Install: npm install @prosdevlab/sdk-kit
Status: β
Published - v0.1.0
Coverage: 98.97% (192 unit tests)
Essential plugins for common SDK functionality (storage, context, poll, queue, transport, consent).
Install: npm install @prosdevlab/sdk-kit-plugins
Status: β
Published - v0.1.0
Coverage: 95%+ (350+ unit tests)
Testing utilities and mocks for building robust tests.
Status: π§ In Development - Not yet published
Minimal SDK β
A complete working example demonstrating:
- Plugin registration and lifecycle
- Configuration management
- Event handling
- Public API exposure
- Runtime verification tests
See our ROADMAP.md for detailed development plans and timelines.
We welcome contributions! Here's how to get involved:
- Development Workflow - How we plan, track, and implement features
- Contributing Guide - Code style, PR process, and guidelines
- Plugin Development Guide - Building plugins for SDK Kit
- Code of Conduct - Community guidelines and standards
Our workflow follows a spec-driven approach where detailed specifications live in the specs/ directory, and GitHub issues are used for tracking progress.
-
Create a new branch
git checkout -b feature/my-feature
-
Make your changes
-
Commit your changes using conventional commits
git commit -m "feat: add new feature" -
Add a changeset to document your changes
pnpm changeset
-
Push your branch and create a pull request
MIT Β© prosdevlab