JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 45
  • Score
    100M100P100Q86378F
  • License MIT

Embeddable workflow/orchestration engine for TypeScript: deterministic runs over a typed neuron graph (in-memory, zero dependencies).

Package Exports

  • @cnstra/core

Readme

@cnstra/core

Workflow / orchestration engine for TypeScript — deterministic, embeddable, in-memory.

📚 Full Documentation → | Quick Start | API Reference | Recipes

What is CNStra?

CNStra (Central Nervous System Orchestrator) models your app as a typed neuron graph. You explicitly start a run with cns.stimulate(...); CNStra then performs a deterministic, hop-bounded traversal from collateral → dendrite → returned signal, step by step.

Zero dependenciesNo pub/subCNS approach (Central Neural Network of your app)

Common backend use-cases:

  • Jobs (queues/workers), sync/integrations (webhooks), ETL/pipelines
  • Retries/timeouts/cancellation and saga-style compensations

👉 Read the full documentation →

Quick Start

npm install @cnstra/core
import { CNS, collateral, neuron } from '@cnstra/core';

// Define collaterals (communication channels)
const userCreated = collateral<{ id: string; name: string }>();
const userRegistered = collateral<{ userId: string; status: string }>();

// Create a neuron
const userService = neuron({
  userRegistered
})
.dendrite({
  collateral: userCreated,
  response: (payload, axon) => {
    return axon.userRegistered.createSignal({
      userId: payload.id,
      status: 'completed'
    });
  }
});

// Create the CNS system
const cns = new CNS([userService]);

// Stimulate the system
const stimulation = cns.stimulate(userCreated.createSignal({
  id: '123',
  name: 'John Doe'
}));
await stimulation.waitUntilComplete();

Documentation

  • Quick Start Guide — Get up and running in minutes
  • API Reference — Complete API documentation
  • Concepts — Neurons, collaterals, signals, and the CNS model (Central Neural Network of your app)
  • Recipes — Common patterns and use cases
  • Advanced Topics — Performance, context stores, integrations

CNStra provides deterministic, type-safe orchestration without the complexity of traditional event systems.