Skip to main content

Advanced

1 min read

Advanced Features

Advanced features for production Directive applications – composition patterns, debugging tools, server rendering, and fault tolerance.


Features

FeaturePageWhen to Use
Multi-ModuleCompose multiple modules into one systemApps with distinct domains (auth, cart, UI)
Runtime DynamicsRegister, override, toggle, and remove definitions at runtimeFeature flags, A/B testing, plugins, lazy loading
Time-Travel & SnapshotsStep through state history, undo/redo, serialize and distribute stateDebugging, persistence, sharing
SSR & HydrationServer-render Directive state, hydrate on clientNext.js, Remix, SvelteKit
Error HandlingError boundaries, retry policies, circuit breakersProduction resilience

Multi-Module Composition

Combine modules with namespaced access:

import { createSystem } from '@directive-run/core';

// Compose multiple modules into a single system
const system = createSystem({
  modules: {
    auth: authModule,
    cart: cartModule,
  },
});

// Each module's facts live under its namespace
system.facts.auth.user;
system.facts.cart.items;

Time-Travel Debugging

Enable snapshots and navigate state history:

// Enable time-travel with history
const system = createSystem({
  module: myModule,
  history: true,
});

// Navigate backward and forward through state history
system.history.goBack();    // Undo
system.history.goForward(); // Redo

Next Steps

Previous
Explain & Debug

Stay in the loop. Sign up for our newsletter.

We care about your data. We'll never share your email.

Powered by Directive. This signup uses a Directive module with facts, derivations, constraints, and resolvers – zero useState, zero useEffect. Read how it works

Directive - Constraint-Driven Runtime for TypeScript | AI Guardrails & State Management