Modern offline-first caching engine with predictive intelligence
Quick Start • Demo • Documentation • API Reference • Contributing
const cache = await ShadowCache.init({
cacheRules: [
{ pattern: '/api/**',
strategy: 'network-first',
priority: 8 }
]
}); |
|
|
const result = await cache.sync();
// Synced 42 items, 12.5 KB transferred |
| Feature | ShadowCache | Workbox | sw-toolbox | AppCache |
|---|---|---|---|---|
| Bundle Size | 1.78 KB | ~20 KB | ~15 KB | N/A |
| Predictive Caching | ✅ | ❌ | ❌ | ❌ |
| Delta Sync | ✅ | ❌ | ❌ | ❌ |
| Storage Fallback | ✅ | ❌ | ❌ | ❌ |
| TypeScript Native | ✅ | ✅ | ❌ | N/A |
| Zero Config | ✅ | ❌ | ❌ | ❌ |
| Security First | ✅ | ❌ | ||
| Active Development | ✅ | ✅ | ❌ | ❌ (Deprecated) |
npm install @shadowcache/sdkExperience ShadowCache in action with our stunning demo application:
npm run build
cd demo
npx serve . -p 3000Features:
- 🌐 Real-time connectivity status
- 📊 Cache metrics dashboard
- 🧠 Predictive caching visualization
- ⚡ Performance metrics
- 🎨 Beautiful Shadow Mode UI
- 🚀 Quick Start Guide - Get up and running in 5 minutes
- 📖 Full Documentation - Complete project documentation
- 🎮 Demo Application - Interactive demo with all features
- 📘 API Reference - Complete API documentation
- ⚙️ Configuration Guide - All configuration options
- 💡 Usage Examples - Common use cases
- 🏗️ Architecture - System design and internals
- 🤝 Contributing Guide - How to contribute
- 📋 Changelog - Version history
- 📊 Project Summary - Project overview
import { ShadowCache } from '@shadowcache/sdk';
const cache = await ShadowCache.init({
cacheRules: [
{
id: 'api-cache',
pattern: '/api/**',
strategy: 'network-first',
priority: 8,
maxAge: 3600000 // 1 hour
}
]
});
cache.on('ready', () => console.log('ShadowCache ready!'));const cache = await ShadowCache.init({
cacheRules: [...],
predictive: {
enabled: true,
learningRate: 0.8,
minConfidence: 0.6,
maxPrefetchSize: 5242880 // 5MB
}
});const cache = await ShadowCache.init({
cacheRules: [...],
sync: {
endpoint: 'https://api.example.com/sync',
batchSize: 50,
conflictResolution: 'server-wins'
}
});
const result = await cache.sync();
console.log(`Synced ${result.synced} changes`);Target: < 50 KB gzipped
Achieved: 1.78 KB gzipped
96.4% under target!
34 correctness properties
100+ iterations per property
80%+ test coverage
< 100ms initialization
< 10ms cache serving
< 5% CPU usage
| Browser | Minimum Version |
|---|---|
| Chrome | 40+ |
| Firefox | 44+ |
| Safari | 11.1+ |
| Edge | 17+ |
- 7 packages in monorepo
- ~8.96 KB total bundle size (gzipped)
- 34 correctness properties validated
- 13 documentation files
- 4 caching strategies
- 3 storage levels with fallback
- 2 UI frameworks supported
We welcome contributions! See our Contributing Guide for details.
- 🐛 Report bugs
- 💡 Suggest features
- 📝 Improve documentation
- 🔧 Submit pull requests
- ⭐ Star the repository
MIT © ShadowCache Contributors
- TypeScript for type safety
- Vitest for testing
- fast-check for property-based testing
- esbuild for bundling
- Web Crypto API for encryption
- Service Workers for offline capability
Built with ❤️ for the offline-first web