posted an update

The Evolution of Skeleton Crew Runtime (SCR)

From a simple event bus to a robust, type-safe plugin ecosystem, Skeleton Crew Runtime has undergone a significant transformation. This log captures the journey of building a modular foundation for modern JavaScript applications.


v0.1.x: The Core Foundation

"Break everything down into its smallest parts."

The objective was simple: build a runtime where features don't know about each other. We introduced the four pillars:

  • Plugins: The container for features.
  • Actions: Discrete units of business logic.
  • Events: Cross-plugin communication.
  • Screens: UI-agnostic view definitions.

Code Snapshot (v0.1)

The original syntax was minimal, relying on hostContext for all external data.

const runtime = new Runtime({
  hostContext: { config: myConfig }
});

const myPlugin = {
  name: 'auth',
  setup(ctx) {
    ctx.actions.registerAction({
      id: 'auth:login',
      handler: (params) => { /* logic */ }
    });
  }
};

v0.2.x: The Developer Experience Leap

"Type safety is not optional."

As the runtime grew, we realized that "any" was our enemy. v0.2.0 introduced a total overhaul of the internal types.

Key Innovations:

  1. Generic Runtime: Configuration became fully typed from the top down.
  2. Synchronous Config (ctx.config): No more async configuration fetching.
  3. Plugin Discovery (v0.2.1): We added pluginPaths and pluginPackages, allowing the runtime to auto-discover plugins on the filesystem.
  4. Topological Sorting: The runtime learned to resolve dependencies and initialize plugins in the correct order.

Code Snapshot (v0.2)

interface AppConfig { apiUrl: string; }

const runtime = new Runtime<AppConfig>({
  config: { apiUrl: 'https://api.v2.com' },
  pluginPaths: ['./plugins']
});

// ctx.config is now fully typed as AppConfig!

v0.3.x: Professionalization & Scaling

"Build for production, clean up for humans."

In v0.3.0, we shifted focus from "adding features" to "hardening the ecosystem."

Key Innovations:

  1. Config Validation: Plugins can now define a validateConfig callback. If the config is invalid, the runtime fails early with a detailed report.
  2. Service Locator API: We introduced ctx.services for high-performance inter-plugin communication without hard dependency coupling.
  3. Optimized Telemetry: Consolidated startup logs. Instead of 50 lines of "Loaded plugin...", you get a clean summary.

Code Snapshot (v0.3)

export const paymentPlugin: PluginDefinition<MyConfig> = {
  name: 'payments',
  validateConfig: (config) => {
    return config.stripeKey ? true : { valid: false, errors: ['Missing Stripe Key'] };
  },
  setup(ctx) {
    // Register a shared service
    ctx.services.register('payment-gate', {
      process: (amount) => { ... }
    });
  }
};

The Journey in Numbers

  • Total Tests: 0 → 706+ (Unit, Integration, and Property-based)
  • Bundle Size: Under 5KB (Zero dependencies)
  • Documentation: 30+ pages of guides and examples
  • Compatibility: 100% backward compatibility maintained through Every major release.

The future is modular. The future is Skeleton Crew.

Log in or sign up for Devpost to join the conversation.