npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

mycelia-kernel

v1.1.0

Published

Production-ready message-driven architecture framework with composable hooks, built-in security, and multi-backend support

Readme

Mycelia Kernel

License: MIT Tests Code Quality Documentation

A sophisticated message-driven architecture framework with composable hooks, built-in security, and multi-backend support.


🎯 What is Mycelia Kernel?

Mycelia Kernel is a production-ready framework for building message-driven systems with:

  • 🔌 Hook-based composition - Extend subsystems without modification
  • 📨 Pure message-driven - Zero direct references between components
  • 🔒 Built-in security - PKR-based identity and fine-grained permissions
  • 🔄 Multi-backend - SQLite, IndexedDB, Memory with identical API
  • 🌐 Web server adapters - Fastify, Express, Hono support
  • 📊 Production features - Observability, tracing, health checks
  • 🚀 High performance - 50k+ queue ops/sec with circular buffer

⚡ Quick Start

# Install
npm install mycelia-kernel

# Create your first subsystem
import { MessageSystem, BaseSubsystem } from 'mycelia-kernel';

// Bootstrap the system
const messageSystem = new MessageSystem('my-app');
await messageSystem.bootstrap();

// Create a subsystem with hooks
class MySubsystem extends BaseSubsystem {
  constructor(name, ms) {
    super(name, { ms });
    this.use(useRouter);
    this.use(useQueue);
  }
}

// Register and use
const subsystem = new MySubsystem('api', messageSystem);
await subsystem.build();
await messageSystem.registerSubsystem(subsystem);

// Register routes
subsystem.router.registerRoute('users/{id}', async (message, params) => {
  return { user: { id: params.id } };
});

// Send messages
const message = new Message('api://users/123', {});
const result = await messageSystem.send(message);

🌟 Key Features

Message-Driven Architecture

  • Path-based routing: subsystem://path/to/resource
  • Loose coupling between components
  • Async-first design
  • Built for distributed systems

Hook-Based Composition

subsystem
  .use(useRouter)           // Add routing
  .use(useQueue)            // Add message queue
  .use(useAuthStrategies)   // Add authentication
  .use(useSQLiteStorage)    // Add SQLite storage
  .build();

Security System

  • PKR-based identity management
  • Reader-Writer-Set (RWS) permissions
  • Scope-based access control
  • Protected messaging with caller authentication

Multi-Backend Storage

// Use SQLite
subsystem.use(useSQLiteStorage, {
  config: { storage: { dbPath: './data.db' } }
});

// Or IndexedDB (browser)
subsystem.use(useIndexedDBStorage, {
  config: { storage: { dbName: 'myapp' } }
});

// Or Memory (testing)
subsystem.use(useMemoryStorage);

HTTP Server Adapters

// Choose your server
subsystem.use(useFastifyServer);  // Fastify
// OR
subsystem.use(useExpressServer);  // Express
// OR
subsystem.use(useHonoServer);     // Hono

📚 Documentation

Extensive documentation with 151+ markdown files:


🧪 Testing

Comprehensive test suite with 713 tests (99.8% pass rate):

# Run all tests
npm test

# Watch mode
npm run test:watch

# Run benchmarks
npm run bench

🚀 Performance

Queue Performance:

  • 50,000+ operations/sec with circular buffer
  • 16x faster than array-based implementation for large queues
  • <1ms latency at p95

Benchmarks:

npm run bench:queue

See Performance Optimization Plan for details.


🎨 Design Patterns

Mycelia implements 20+ design patterns:

  • Hook Pattern (composable extensions)
  • Strategy Pattern (pluggable algorithms)
  • Factory Pattern (object creation)
  • Observer Pattern (events/listeners)
  • Repository Pattern (storage abstraction)
  • Adapter Pattern (multi-backend support)
  • And 14 more...

🏗️ Architecture

┌─────────────────────────────────────────────────┐
│              MessageSystem                      │
│        (Central Coordinator)                    │
└─────────────────────────────────────────────────┘
                     │
        ┌────────────┼────────────┐
        │            │            │
        ▼            ▼            ▼
   ┌────────┐  ┌────────┐  ┌────────┐
   │ Kernel │  │  API   │  │  DB    │
   │Subsystem  │Subsystem  │Subsystem
   └────────┘  └────────┘  └────────┘
        │            │            │
     Messages    Messages    Messages

🔧 Use Cases

Perfect for:

  • Canvas/Drawing Applications - Layer management, tool coordination
  • Workflow Systems - Task orchestration, state machines
  • Microservices - Service coordination, message-based communication
  • Real-Time Apps - WebSocket, event broadcasting
  • Modular Backends - Plugin-based architecture, multi-tenant systems

Already Used In:

  • Math Whiteboard - Collaborative tutoring application

🤝 Contributing

We welcome contributions! See CONTRIBUTING.md for:

  • Code of conduct
  • Development setup
  • Pull request process
  • Coding standards

📄 License

MIT License - see LICENSE for details.


🌐 Links

  • GitHub: https://github.com/lesfleursdelanuitdev/mycelia-kernel
  • Documentation: Comprehensive docs
  • Issues: https://github.com/lesfleursdelanuitdev/mycelia-kernel/issues

📊 Stats

  • 301 JavaScript files
  • 713 tests (99.8% pass rate)
  • 151+ documentation files
  • 20+ design patterns
  • 8.5/10 code quality rating

🙏 Acknowledgments

Built with modern tools:

  • Vite for build system
  • Vitest for testing
  • ESLint for code quality

Made with ❤️ by @lesfleursdelanuitdev