Praxis

The Full Plures Application Framework


πŸ“Š Project Dashboard

Project Status

Category Status
CI/CD βœ… Automated testing & builds
Version 1.0.2 (Stable)
Runtime Support Node.js 18+, Deno (experimental), .NET 8+
Package Registries npm βœ… / NuGet βœ… / JSR βœ…
Test Coverage 327 TypeScript + 95 C# tests passing
Documentation πŸ“š Comprehensive guides available

Language Support

Language Package Registry Status
TypeScript @plures/praxis npm βœ… Available
C# Plures.Praxis NuGet βœ… Available
PowerShell Praxis.psm1 GitHub βœ… Available

Integration Status

Integration Status Notes
Praxis Cloud βœ… Available Azure-hosted relay for sync & monetization
PluresDB βœ… Available Local-first reactive datastore with 32 tests
Unum βœ… Available Identity & channels integration
Svelte 5 βœ… Full Support Runes API, stores, history, time-travel
Tauri βœ… Available Cross-platform desktop runtime
CodeCanvas βœ… Available Visual schema editor & FSM enforcement
State-Docs βœ… Available Documentation generation from schemas

Overview

Praxis is not just a logic engineβ€”it's a complete framework for building modern, local-first, distributed applications. It provides:

  • Declarative Schemas: Define your data models, logic, and components in a unified schema format (PSF)
  • Logic/State Machines: Pure, functional application logic with facts, events, rules, and constraints
  • Component Generation: Automatically generate Svelte components from schemas
  • Local-First Data: Integrated PluresDB for reactive, offline-capable data storage
  • Documentation Generation: Automatic documentation generation from schemas with Mermaid diagrams
  • Visual Design: CodeCanvas integration for visual schema and logic editing
  • Real-Time Code ↔ Canvas Sync: Bidirectional synchronization between code and visual editor
  • Orchestration: DSC/MCP support for distributed system coordination
  • Cross-Platform Runtime: Web, desktop, and mobile via Svelte + Tauri

πŸš€ Praxis 1.0 Architecture

Praxis 1.0 introduces a schema-driven, modular architecture where the Praxis Schema Format (PSF) serves as the single source of truth.

Praxis Schema Format (PSF)

PSF is the canonical JSON/AST format that defines your entire application:

{
  "$version": "latest",
  "id": "my-app",
  "name": "My Application",
  "facts": [...],
  "events": [...],
  "rules": [...],
  "constraints": [...],
  "models": [...],
  "components": [...],
  "flows": [...]
}

From this schema, Praxis generates:

  • TypeScript types for facts, events, rules
  • Svelte components for UI
  • Markdown documentation with Mermaid diagrams
  • Database schemas for PluresDB
  • Canvas visualization for visual editing

Modular Folder Structure

/praxis
β”œβ”€β”€ core/                     # Core framework modules
β”‚   β”œβ”€β”€ schema-engine/        # PSF types, compiler, generator, validator
β”‚   β”œβ”€β”€ logic-engine/         # Rules, constraints, engine, PSF adapter
β”‚   β”œβ”€β”€ db-adapter/           # PluresDB sync engine
β”‚   └── codegen/              # Documentation and code generators
β”œβ”€β”€ ui/                       # UI modules
β”‚   β”œβ”€β”€ svelte-generator/     # PSF-aware Svelte component generation
β”‚   └── canvas/               # Visual canvas state and projection
β”œβ”€β”€ tools/                    # Developer tools
β”‚   β”œβ”€β”€ cli/                  # Command-line interface
β”‚   └── watcher/              # File watching and live sync
β”œβ”€β”€ extensions/               # Optional integrations
β”‚   β”œβ”€β”€ dsc/                  # DSC/MCP orchestration
β”‚   β”œβ”€β”€ azure/                # Azure integration
β”‚   └── devtools/             # Developer tools
└── examples/                 # Example applications
    β”œβ”€β”€ hero-shop/            # Full e-commerce example
    └── todo/                 # Minimal todo example

Framework Philosophy

Core Framework Components

Praxis provides these integrated capabilities:

  • Schema Engine – PSF parser, compiler, generator, and validator
  • Logic Engine – Typed facts, events, rules, and constraints for application logic
  • Component Factory – Generate Svelte components from schemas with data bindings
  • Data Layer – PluresDB integration for reactive, local-first data storage
  • State Machines – Flows and scenarios for orchestrated behaviors
  • Actors – Effectful units for side effects and external system integration
  • Terminal Nodes – Execute commands and scripts within the Praxis framework
  • Documentation – Automatic documentation generation from schemas with Mermaid diagrams
  • Visual IDE – CodeCanvas integration for schema and logic editing
  • Orchestration – DSC/MCP support for distributed coordination
  • CLI Tools – Command-line interface for scaffolding and generation

Design Philosophy

  1. Schema-Driven Development

    • Define once, generate everywhere (models, components, docs, orchestration)
    • Single source of truth for your application structure
    • Type-safe by default across all layers
  2. Local-First Architecture

    • Offline-capable by default with PluresDB
    • Sync when connected, work always
    • Data ownership and privacy built-in
  3. Strong typing and functional programming

    • Core abstractions are strongly typed: Fact<Tag, Payload>, Event<Tag, Payload>, Rule<Context, InFact, OutFact>
    • Pure functions for testability and reasoning
    • Immutable state updates
  4. Visual and Code Workflows

    • CodeCanvas for visual schema and logic editing
    • Full code-level control when needed
    • Seamless transitions between visual and code
  5. Cross-Platform and Cross-Language

    • TypeScript-first with C# and PowerShell support
    • Web, desktop, mobile via Svelte + Tauri
    • Language-agnostic core protocol for maximum portability

Framework Features

πŸ—οΈ Full Application Framework

  • Schema-Driven: Define data models, logic, and UI in unified schemas
  • Component Generation: Auto-generate Svelte components from schemas
  • CLI Tools: praxis create, praxis generate, praxis canvas commands
  • Templates: Pre-built app templates (basic, fullstack, distributed)
  • Integrated Stack: PluresDB + Unum + ADP + State-Docs + Canvas

🎨 Visual Development

  • CodeCanvas Integration: Visual schema and logic editor
  • Component Preview: See generated components in real-time
  • Flow Visualization: Visualize state machines and orchestration
  • Interactive Docs: Navigate documentation with State-Docs

πŸ”Œ Ecosystem Integration

  • PluresDB: Local-first reactive data storage
  • Unum: Identity and channels for distributed systems
  • ADP: Architectural guardrails and decision tracking
  • State-Docs: Living documentation generation
  • Svelte 5: Full runes support with history and time-travel
  • Tauri: Cross-platform runtime (web/desktop/mobile)

⚑ Svelte 5 Integration

  • Runes API: Modern $state, $derived, $effect support
  • History States: Built-in undo/redo and time-travel debugging
  • Store API: Backward-compatible stores for Svelte 4/5
  • Type Safety: Full TypeScript support with composables
  • Zero Config: Works out of the box with Svelte 5

Logic Engine Features

  • 🎯 Logic-First Design: Build applications around facts, events, rules, and constraints
  • πŸ”„ Pure Functional Core: State transitions via pure step functions
  • πŸ“ Fluent DSL: Intuitive API for defining rules and constraints
  • πŸ—‚οΈ Registry System: Centralized management of rules and constraints
  • 🌊 Flows & Actors: Orchestrate complex state transitions
  • πŸ“¦ JSON-Friendly: All types are serializable for cross-platform use
  • πŸ”’ Type-Safe: Full TypeScript support with strict typing
  • πŸ” Introspection: Generate schemas, graphs, and visualizations of your logic
  • 🌐 Cross-Language: C#, PowerShell, and TypeScript implementations with protocol versioning
  • πŸ“Š Comprehensive Testing: 327 TypeScript and 95 C# tests covering all features
  • 🎭 Hero Example: Full e-commerce demo with auth, cart, features, and actors

Installation

npm (Node.js)

npm install @plures/praxis

NuGet (.NET / C#)

dotnet add package Plures.Praxis

Or add to your .csproj:

<PackageReference Include="Plures.Praxis" Version="0.2.1" />

See C# Documentation for detailed usage.

JSR (Deno)

# Coming soon - JSR publishing in progress
deno add @plures/praxis

For now, you can use Praxis with Deno via import maps:

// import_map.json
{
  "imports": {
    "@plures/praxis": "npm:@plures/praxis@^0.2.1"
  }
}

From Source

# Clone the repository
git clone https://github.com/plures/praxis.git
cd praxis

# TypeScript
npm install
npm run build
npm test

# C#
cd csharp
dotnet build
dotnet test

Quick Start

Using the Praxis CLI

The Praxis CLI provides commands for creating and managing applications.

# Install Praxis globally
npm install -g @plures/praxis

# Create a new application
praxis create app my-app
cd my-app
npm install

# Generate code from schemas
praxis generate --schema src/schemas/app.schema.ts

# Open CodeCanvas for visual editing
praxis canvas src/schemas/app.schema.ts

# Start development server
npm run dev

# Build for production
npm run build

Available CLI commands:

  • praxis login - Authenticate with GitHub (device flow or token)
  • praxis logout - Log out from Praxis Cloud
  • praxis whoami - Show current authenticated user
  • praxis create app [name] - Create new application
  • praxis create component [name] - Create new component
  • praxis generate - Generate code from schemas
  • praxis canvas [schema] - Open visual editor
  • praxis orchestrate - Manage distributed systems
  • praxis cloud init - Connect to Praxis Cloud
  • praxis cloud status - Check cloud connection
  • praxis cloud sync - Manually sync to cloud
  • praxis cloud usage - View cloud usage metrics
  • praxis dev - Start development server
  • praxis build - Build for production

See docs/guides/getting-started.md for detailed instructions.

Praxis Cloud

Connect your application to Praxis Cloud for automatic synchronization with GitHub-native authentication and billing:

# Authenticate with GitHub
npx praxis login

# Initialize cloud connection
npx praxis cloud init

# In your code
import { connectRelay } from "@plures/praxis/cloud";

const relay = await connectRelay("https://praxis-relay.azurewebsites.net", {
  appId: "my-app",
  authToken: process.env.GITHUB_TOKEN,
  autoSync: true
});

// Sync automatically handles CRDT merge
await relay.sync({
  type: "delta",
  appId: "my-app",
  clock: {},
  facts: [...],
  timestamp: Date.now()
});

See src/cloud/README.md and examples/cloud-sync for details.

Basic Example (Logic Engine)

import {
  createPraxisEngine,
  PraxisRegistry,
  defineFact,
  defineEvent,
  defineRule,
} from '@plures/praxis';

// Define the context type
interface AuthContext {
  currentUser: string | null;
}

// Define facts and events
const UserLoggedIn = defineFact<'UserLoggedIn', { userId: string }>('UserLoggedIn');
const Login = defineEvent<'LOGIN', { username: string }>('LOGIN');

// Define rules
const loginRule = defineRule<AuthContext>({
  id: 'auth.login',
  description: 'Process login event',
  impl: (state, events) => {
    const loginEvent = events.find(Login.is);
    if (loginEvent) {
      state.context.currentUser = loginEvent.payload.username;
      return [UserLoggedIn.create({ userId: loginEvent.payload.username })];
    }
    return [];
  },
});

// Create engine
const registry = new PraxisRegistry<AuthContext>();
registry.registerRule(loginRule);

const engine = createPraxisEngine({
  initialContext: { currentUser: null },
  registry,
});

// Dispatch events
const result = engine.step([Login.create({ username: 'alice' })]);
console.log(result.state.facts); // [{ tag: "UserLoggedIn", payload: { userId: "alice" } }]
console.log(engine.getContext()); // { currentUser: "alice" }

With Constraints

import { defineConstraint } from '@plures/praxis';

const maxSessionsConstraint = defineConstraint<AuthContext>({
  id: 'auth.maxSessions',
  description: 'Only one user can be logged in at a time',
  impl: (state) => {
    return state.context.currentUser === null || 'User already logged in';
  },
});

registry.registerConstraint(maxSessionsConstraint);

Svelte 5 Integration

Store API (Svelte 4/5 Compatible)

import { createPraxisStore, createDerivedStore } from '@plures/praxis/svelte';

const stateStore = createPraxisStore(engine);
const userStore = createDerivedStore(engine, (ctx) => ctx.currentUser);

// In Svelte component:
// $: currentUser = $userStore;
// <button on:click={() => stateStore.dispatch([Login.create({ username: "alice" })])}>
//   Login
// </button>

Runes API (Svelte 5 Only)

<script lang="ts">
  import { usePraxisEngine } from '@plures/praxis/svelte';
  import { createMyEngine, Login } from './my-engine';

  const engine = createMyEngine();
  const {
    context,      // Reactive context
    dispatch,     // Dispatch events
    undo,         // Undo last action
    redo,         // Redo action
    canUndo,      // Boolean: can undo?
    canRedo,      // Boolean: can redo?
  } = usePraxisEngine(engine, {
    enableHistory: true,    // Enable undo/redo
    maxHistorySize: 50,     // Keep last 50 snapshots
  });
</script>

<div>
  <p>User: {context.currentUser || 'Guest'}</p>

  <button onclick={() => dispatch([Login.create({ username: 'alice' })])}>
    Login
  </button>

  <button onclick={undo} disabled={!canUndo}>
    ⟲ Undo
  </button>

  <button onclick={redo} disabled={!canRedo}>
    ⟳ Redo
  </button>
</div>

See the Advanced Todo Example for a complete demo with:

  • Undo/redo functionality
  • Time-travel debugging
  • Keyboard shortcuts
  • Beautiful UI

For comprehensive guides:

Core Protocol

The language-neutral core protocol forms the foundation of Praxis:

// Facts and Events
interface PraxisFact {
  tag: string;
  payload: unknown;
}

interface PraxisEvent {
  tag: string;
  payload: unknown;
}

// State
interface PraxisState {
  context: unknown;
  facts: PraxisFact[];
  meta?: Record<string, unknown>;
}

// Step Function (the conceptual core)
type PraxisStepFn = (
  state: PraxisState,
  events: PraxisEvent[],
  config: PraxisStepConfig
) => PraxisStepResult;

This protocol is:

  • Pure and deterministic (data in β†’ data out)
  • No side effects, no global state
  • JSON-friendly for cross-language compatibility
  • The foundation for all higher-level TypeScript APIs

Framework Architecture

/praxis
β”œβ”€β”€ core/                          # Core framework
β”‚   β”œβ”€β”€ schema/                    # Schema system
β”‚   β”‚   └── types.ts              # Schema type definitions
β”‚   β”œβ”€β”€ logic/                     # Logic engine (existing src/core/)
β”‚   β”‚   β”œβ”€β”€ protocol.ts           # Language-neutral protocol
β”‚   β”‚   β”œβ”€β”€ rules.ts              # Rules, constraints, and registry
β”‚   β”‚   β”œβ”€β”€ engine.ts             # LogicEngine implementation
β”‚   β”‚   β”œβ”€β”€ actors.ts             # Actor system
β”‚   β”‚   └── introspection.ts      # Introspection and visualization
β”‚   β”œβ”€β”€ component/                 # Component generation
β”‚   β”‚   └── generator.ts          # Svelte component generator
β”‚   β”œβ”€β”€ pluresdb/                  # PluresDB integration core
β”‚   β”‚   β”œβ”€β”€ adapter.ts            # Database adapter interface
β”‚   β”‚   β”œβ”€β”€ store.ts              # Reactive store implementation
β”‚   β”‚   β”œβ”€β”€ schema-registry.ts    # Schema registry for PluresDB
β”‚   β”‚   └── generator.ts          # PluresDB config generator
β”‚   └── runtime/                   # Runtime abstractions
β”œβ”€β”€ cloud/                         # Praxis Cloud integration
β”‚   β”œβ”€β”€ auth.ts                   # GitHub OAuth authentication
β”‚   β”œβ”€β”€ billing.ts                # Tier-based billing
β”‚   β”œβ”€β”€ provisioning.ts           # Tenant provisioning
β”‚   └── relay/                    # Azure relay service
β”œβ”€β”€ integrations/                  # Ecosystem integrations
β”‚   β”œβ”€β”€ pluresdb.ts               # PluresDB integration exports
β”‚   β”œβ”€β”€ svelte.ts                 # Svelte 5 integration
β”‚   β”œβ”€β”€ unum/                     # Unum identity and channels
β”‚   β”œβ”€β”€ adp/                      # Architectural Decision Protocol
β”‚   β”œβ”€β”€ state-docs/               # State-Docs documentation
β”‚   └── canvas/                   # CodeCanvas visual editor
β”œβ”€β”€ components/                    # Svelte components
β”‚   └── TerminalNode.svelte       # Terminal node component
β”œβ”€β”€ cli/                          # Command-line interface
β”‚   β”œβ”€β”€ index.ts                  # CLI entry point
β”‚   └── commands/                 # Command implementations
β”œβ”€β”€ templates/                     # Project templates
β”‚   β”œβ”€β”€ basic-app/                # Basic application template
β”‚   └── fullstack-app/            # Full-stack template
β”œβ”€β”€ examples/                      # Example applications
β”‚   β”œβ”€β”€ offline-chat/             # Offline-first chat demo
β”‚   β”œβ”€β”€ knowledge-canvas/         # Knowledge management with Canvas
β”‚   β”œβ”€β”€ distributed-node/         # Self-orchestrating node demo
β”‚   β”œβ”€β”€ terminal-node/            # Terminal node demo
β”‚   β”œβ”€β”€ terminal-canvas/          # Terminal + canvas demo
β”‚   β”œβ”€β”€ cloud-sync/               # Cloud sync demo
β”‚   β”œβ”€β”€ github-monetization/      # GitHub monetization demo
β”‚   β”œβ”€β”€ simple-app/               # Simple app demo
β”‚   β”œβ”€β”€ auth-basic/               # Login/logout example
β”‚   β”œβ”€β”€ cart/                     # Shopping cart example
β”‚   β”œβ”€β”€ svelte-counter/           # Svelte integration example
β”‚   └── hero-ecommerce/           # Comprehensive e-commerce demo
└── docs/                         # Framework documentation
    β”œβ”€β”€ guides/                   # User guides
    β”‚   β”œβ”€β”€ getting-started.md   # Getting started guide
    β”‚   β”œβ”€β”€ canvas.md            # CodeCanvas guide
    β”‚   └── orchestration.md     # Orchestration guide
    β”œβ”€β”€ api/                      # API reference
    └── architecture/             # Architecture documentation

See FRAMEWORK.md for complete architecture documentation.

Examples

The repository includes multiple complete examples:

1. Hero E-Commerce (src/examples/hero-ecommerce)

Comprehensive example demonstrating all Praxis features in a single application:

  • Authentication with session management
  • Shopping cart with discount rules
  • Feature flags for A/B testing
  • Loyalty program with points
  • Actors for logging and analytics
  • Constraints enforcing business rules
npm run build
node dist/examples/hero-ecommerce/index.js

2. Offline-First Chat (examples/offline-chat)

Demonstrates local-first architecture with PluresDB:

  • Offline message composition and storage
  • Automatic sync when connected
  • Message queue for offline messages
  • Conflict resolution for concurrent edits
  • Real-time features (typing indicators, read receipts)

See examples/offline-chat/README.md

3. Knowledge Canvas (examples/knowledge-canvas)

Showcases CodeCanvas integration for visual knowledge management:

  • Visual knowledge graph editing
  • Schema-driven content types
  • Generated UI components
  • State-Docs integration
  • Collaborative editing

See examples/knowledge-canvas/README.md

4. Self-Orchestrating Node (examples/distributed-node)

Demonstrates distributed orchestration with DSC/MCP:

  • Automatic node discovery
  • Self-healing behavior
  • State synchronization across nodes
  • Health monitoring and auto-scaling
  • Failover and recovery

See examples/distributed-node/README.md

5. Terminal Node (examples/terminal-node)

Demonstrates the terminal node feature for command execution:

  • Terminal adapter creation and configuration
  • Command execution and history tracking
  • YAML schema loading with terminal nodes
  • PluresDB binding configuration (ready for integration)
  • Both text and widget input modes
npm run build
node examples/terminal-node/index.js

See examples/terminal-node/README.md and docs/TERMINAL_NODE.md

6. Auth Basic (src/examples/auth-basic)

Login/logout with facts, rules, and constraints.

npm run build
node dist/examples/auth-basic/index.js

7. Cart (src/examples/cart)

Shopping cart with multiple rules, constraints, and complex state management.

npm run build
node dist/examples/cart/index.js

8. Svelte Counter (src/examples/svelte-counter)

Counter example showing Svelte v5 integration with reactive stores.

npm run build
node dist/examples/svelte-counter/index.js

9. Terminal Canvas (examples/terminal-canvas)

Combines terminal nodes with visual canvas features in a Svelte app.

See examples/terminal-canvas/README.md

10. GitHub Monetization (examples/github-monetization)

Example of GitHub-based monetization integration with Praxis Cloud.

See examples/github-monetization/README.md

11. Simple App (examples/simple-app)

A minimal example demonstrating basic Praxis schema usage.

See examples/simple-app/README.md

12. Cloud Sync (examples/cloud-sync)

Demonstrates real-time synchronization with Praxis Cloud relay service.

See examples/cloud-sync/README.md

API Reference

Core Types

  • PraxisFact, PraxisEvent, PraxisState - Protocol types
  • LogicEngine<TContext> - Main engine class
  • PraxisRegistry<TContext> - Rule and constraint registry
  • Actor<TContext> - Actor interface
  • ActorManager<TContext> - Actor lifecycle management

DSL Functions

  • defineFact<TTag, TPayload>(tag) - Define a typed fact
  • defineEvent<TTag, TPayload>(tag) - Define a typed event
  • defineRule<TContext>(options) - Define a rule
  • defineConstraint<TContext>(options) - Define a constraint
  • defineModule<TContext>(options) - Bundle rules and constraints

Helpers

  • findEvent(events, definition) - Find first matching event
  • findFact(facts, definition) - Find first matching fact
  • filterEvents(events, definition) - Filter events by type
  • filterFacts(facts, definition) - Filter facts by type

Introspection & Visualization

Tools for examining and visualizing your Praxis logic:

import { createIntrospector, PRAXIS_PROTOCOL_VERSION } from '@plures/praxis';

const introspector = createIntrospector(registry);

// Get statistics
const stats = introspector.getStats();
console.log(`Rules: ${stats.ruleCount}, Constraints: ${stats.constraintCount}`);

// Generate JSON schema
const schema = introspector.generateSchema(PRAXIS_PROTOCOL_VERSION);

// Generate graph visualization
const graph = introspector.generateGraph();

// Export to Graphviz DOT format
const dot = introspector.exportDOT();
fs.writeFileSync('registry.dot', dot);

// Export to Mermaid format
const mermaid = introspector.exportMermaid();

// Search rules and constraints
const authRules = introspector.searchRules('auth');
const maxConstraints = introspector.searchConstraints('max');

Available methods:

  • getStats() - Get registry statistics
  • generateSchema(protocolVersion) - Generate JSON schema
  • generateGraph() - Generate graph representation
  • exportDOT() - Export to Graphviz DOT format
  • exportMermaid() - Export to Mermaid diagram format
  • getRuleInfo(id) - Get detailed rule information
  • getConstraintInfo(id) - Get detailed constraint information
  • searchRules(query) - Search rules by text
  • searchConstraints(query) - Search constraints by text

Ecosystem Integration

Praxis integrates with the full Plures ecosystem:

PluresDB Integration

Local-first reactive datastore for offline-capable applications. Now fully implemented with 32 tests covering all features.

import {
  createInMemoryDB,
  createPraxisDBStore,
  createPluresDBAdapter,
  attachToEngine,
} from '@plures/praxis/pluresdb';

// Create an in-memory database
const db = createInMemoryDB();

// Create a PraxisDB store for facts and events
const store = createPraxisDBStore({ db });

// Or create an adapter to attach to an engine
const adapter = createPluresDBAdapter({
  db,
  registry,
  initialContext: {},
});

// Attach adapter to engine for automatic persistence
adapter.attachEngine(engine);

// Persist facts and events
await adapter.persistFacts([{ tag: 'UserLoggedIn', payload: { userId: 'alice' } }]);
await adapter.persistEvents([{ tag: 'LOGIN', payload: { username: 'alice' } }]);

// Subscribe to changes
adapter.subscribeToEvents((events) => {
  console.log('New events:', events);
});

Features:

  • In-memory adapter: Ready-to-use implementation for development and testing
  • Reactive store: Watch for changes with callbacks
  • Schema registry: Store and retrieve schemas in PluresDB
  • Config generator: Generate PluresDB configuration from Praxis schemas
  • Engine integration: Automatic fact/event persistence

Status: βœ… Available (src/core/pluresdb/, src/integrations/pluresdb.ts)
Tests: 32 tests covering adapter, store, registry, and engine integration

Unum Integration

Identity and channels for distributed systems.

import { createUnumIdentity, createChannel } from '@plures/unum';

// Create identity
const identity = await createUnumIdentity({
  name: 'my-app-node',
  keys: await generateKeys(),
});

// Create channel for messaging
const channel = await createChannel({
  name: 'app-events',
  participants: [identity.id],
});

// Integrate with Praxis actors
const unumActor = createActor('unum-bridge', identity, async (event) => {
  // Bridge Praxis events to Unum channels
  await channel.publish(event);
});

Status: Planned
Use Cases: Distributed messaging, identity management, authentication

ADP Integration

Architectural Decision Protocol for guardrails and governance.

import { createADP } from '@plures/adp';

// Track architectural decisions from schemas
const adp = createADP({
  source: 'praxis-schema',
  decisions: [
    {
      id: 'ADR-001',
      title: 'Use PluresDB for local-first storage',
      context: 'Need offline-capable data storage',
      decision: 'Adopt PluresDB',
      consequences: ['Offline support', 'Sync complexity'],
    },
  ],
});

// Enforce guardrails
adp.enforce({
  rule: 'no-direct-database-access',
  check: (code) => !code.includes('direct-sql'),
});

Status: Planned
Use Cases: Architecture documentation, compliance checking, guardrails

State-Docs Integration

Living documentation generated from Praxis schemas.

import { generateStateDocs } from '@plures/state-docs';

// Generate documentation from schema
const docs = await generateStateDocs({
  schema: appSchema,
  logic: logicDefinitions,
  components: componentDefinitions,
  output: './docs',
  format: 'markdown', // or 'html', 'pdf'
});

// Documentation includes:
// - Data model diagrams
// - Logic flow diagrams
// - Component catalog
// - API reference
// - Usage examples

Status: Planned
Documentation: See examples for State-Docs integration patterns

CodeCanvas Integration

Visual IDE for schema and logic editing.

# Open Canvas for visual editing
praxis canvas src/schemas/app.schema.ts

# Features:
# - Visual schema design
# - Logic flow editor
# - Component preview
# - Real-time collaboration
# - Export to code

Status: Planned
Documentation: docs/guides/canvas.md

Svelte + Tauri Runtime

Cross-platform runtime for web, desktop, and mobile.

// Svelte v5 integration (available now)
import { createPraxisStore } from '@plures/praxis/svelte';

const stateStore = createPraxisStore(engine);
const userStore = createDerivedStore(engine, (ctx) => ctx.currentUser);

// In Svelte component:
// $: currentUser = $userStore;

// Desktop app with Tauri
npm run tauri:dev    // Development
npm run tauri:build  // Production

Status: Svelte integration available, Tauri templates planned
Platform Support: Web (now), Desktop (planned), Mobile (future)

Cross-Language Usage

PowerShell

Full PowerShell adapter for using Praxis from PowerShell scripts:

# Import module
Import-Module ./powershell/Praxis.psm1

# Initialize adapter
Initialize-PraxisAdapter -EnginePath "./dist/adapters/cli.js"

# Create state and events
$state = New-PraxisState -Context @{ count = 0 }
$event = New-PraxisEvent -Tag "INCREMENT" -Payload @{}

# Process step
$result = Invoke-PraxisStep -State $state -Events @($event) -ConfigPath "./config.json"

# Use result
Write-Host "Count: $($result.state.context.count)"

See powershell/README.md for complete documentation and examples.

C# (.NET 8+)

Full C# implementation with functional, immutable design:

using Praxis.Core;
using Praxis.Dsl;

// Define facts and events
var UserLoggedIn = PraxisDsl.DefineFact<UserPayload>("UserLoggedIn");
var Login = PraxisDsl.DefineEvent<LoginPayload>("LOGIN");

record UserPayload(string UserId);
record LoginPayload(string Username);

// Define rules
var loginRule = PraxisDsl.DefineRule<AuthContext>(
    id: "auth.login",
    description: "Process login event",
    impl: (state, context, events) =>
    {
        var loginEvent = events.FindEvent(Login);
        if (loginEvent != null)
        {
            var payload = Login.GetPayload(loginEvent);
            return [UserLoggedIn.Create(new UserPayload(payload?.Username ?? "unknown"))];
        }
        return [];
    });

// Create engine
var registry = new PraxisRegistry<AuthContext>();
registry.RegisterRule(loginRule);

var engine = PraxisEngine.Create(new PraxisEngineOptions<AuthContext>
{
    InitialContext = new AuthContext(null),
    Registry = registry
});

// Dispatch events
var result = engine.Step([Login.Create(new LoginPayload("alice"))]);
Console.WriteLine($"Facts: {result.State.Facts.Count}"); // Facts: 1

See csharp/Praxis/README.md for complete documentation.

Roadmap

Current Focus

  • Full CodeCanvas integration
  • Enhanced Unum identity support
  • Advanced State-Docs generation
  • Multi-language schema support
  • Real PluresDB sync with CRDT/offline-first capabilities

Long Term

  • Mobile templates (iOS, Android)
  • Enterprise features
  • Advanced orchestration
  • Performance optimizations
  • Plugin ecosystem

Cross-Language Support

The core protocol is implemented across multiple languages:

TypeScript (Primary, npm: @plures/praxis)

import { createPraxisEngine, PraxisRegistry } from '@plures/praxis';

const engine = createPraxisEngine({
  initialContext: {},
  registry: new PraxisRegistry(),
});
const result = engine.step(events);

C# (.NET 8+, NuGet: Plures.Praxis)

var engine = PraxisEngine.Create(new PraxisEngineOptions<TContext> { ... });
var result = engine.Step(events);

See csharp/Praxis/README.md for full documentation.

PowerShell (GitHub: Praxis.psm1)

$newState = Invoke-PraxisStep -State $state -Events $events

See powershell/README.md for full documentation.

All implementations share the same protocol version and JSON format for interoperability. See CROSS_LANGUAGE_SYNC.md for details on keeping implementations in sync.

Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Type check
npm run typecheck

Deno Development

# Run with Deno
deno task dev

# Run tests
deno task test

# Lint and format
deno task lint
deno task fmt

For more detailed development information, see CONTRIBUTING.md.

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please read our Contributing Guide to get started.

Please review our Code of Conduct before participating.

Support


Praxis – Because application logic should be practical, provable, and portable.


Built with ❀️ by the plures team

Top categories

Loading Svelte Themes