Skip to content

NotMe22221/Kiroween1

Repository files navigation

🌑 ShadowCache

ShadowCache Banner

Modern offline-first caching engine with predictive intelligence

npm version License: MIT Bundle Size Test Coverage TypeScript

Quick StartDemoDocumentationAPI ReferenceContributing


✨ Features at a Glance

🚀 Zero Configuration

const cache = await ShadowCache.init({
  cacheRules: [
    { pattern: '/api/**', 
      strategy: 'network-first', 
      priority: 8 }
  ]
});

🧠 Predictive Intelligence

  • Learns navigation patterns
  • Predicts next resources
  • Prefetches during idle time
  • Confidence-based decisions

📡 Offline-First

  • Seamless online/offline transitions
  • Multiple caching strategies
  • Storage fallback chain
  • Service Worker integration

🔄 Delta Sync

const result = await cache.sync();
// Synced 42 items, 12.5 KB transferred

🎯 Why ShadowCache?

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)

📦 Installation

npm install @shadowcache/sdk

🎮 Try the Demo

Experience ShadowCache in action with our stunning demo application:

npm run build
cd demo
npx serve . -p 3000

Features:

  • 🌐 Real-time connectivity status
  • 📊 Cache metrics dashboard
  • 🧠 Predictive caching visualization
  • ⚡ Performance metrics
  • 🎨 Beautiful Shadow Mode UI

📚 Quick Links

Getting Started

Guides & References

Contributing

🎨 Code Examples

Basic Setup

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!'));

With Predictive Caching

const cache = await ShadowCache.init({
  cacheRules: [...],
  predictive: {
    enabled: true,
    learningRate: 0.8,
    minConfidence: 0.6,
    maxPrefetchSize: 5242880 // 5MB
  }
});

With Delta Sync

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`);

🏆 Achievements

Bundle Size Achievement 🎉

Target: < 50 KB gzipped
Achieved: 1.78 KB gzipped
96.4% under target!

Testing Coverage 🧪

34 correctness properties
100+ iterations per property
80%+ test coverage

Performance ⚡

< 100ms initialization
< 10ms cache serving
< 5% CPU usage

🌐 Browser Support

Browser Minimum Version
Chrome 40+
Firefox 44+
Safari 11.1+
Edge 17+

📊 Project Stats

  • 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

🤝 Contributing

We welcome contributions! See our Contributing Guide for details.

Ways to Contribute

  • 🐛 Report bugs
  • 💡 Suggest features
  • 📝 Improve documentation
  • 🔧 Submit pull requests
  • ⭐ Star the repository

📄 License

MIT © ShadowCache Contributors

🙏 Built With

  • 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

⬆ Back to Top

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors