JSPM

  • Created
  • Published
  • Downloads 313
  • Score
    100M100P100Q74502F
  • License FSL-1.1-MIT

Composable typed tree engine — three primitives, everything else composes. Nodes, components, contexts.

Package Exports

  • @treenity/core
  • @treenity/core/chain
  • @treenity/core/client
  • @treenity/core/client/handle
  • @treenity/core/client/index
  • @treenity/core/client/trpc
  • @treenity/core/comp
  • @treenity/core/comp/handle
  • @treenity/core/comp/index
  • @treenity/core/comp/needs
  • @treenity/core/comp/validate
  • @treenity/core/contexts/service
  • @treenity/core/contexts/service/index
  • @treenity/core/contexts/telegram/index
  • @treenity/core/contexts/text
  • @treenity/core/contexts/text/index
  • @treenity/core/core
  • @treenity/core/core/component
  • @treenity/core/core/context
  • @treenity/core/core/index
  • @treenity/core/core/path
  • @treenity/core/core/registry
  • @treenity/core/errors
  • @treenity/core/glob
  • @treenity/core/index
  • @treenity/core/log
  • @treenity/core/mod
  • @treenity/core/mod/discover
  • @treenity/core/mod/examples/ticker/seed
  • @treenity/core/mod/examples/ticker/service
  • @treenity/core/mod/examples/ticker/types
  • @treenity/core/mod/examples/ticker/view
  • @treenity/core/mod/index
  • @treenity/core/mod/loader
  • @treenity/core/mod/optimistic
  • @treenity/core/mod/prefab
  • @treenity/core/mod/tracking
  • @treenity/core/mod/types
  • @treenity/core/mods/autostart/server
  • @treenity/core/mods/autostart/service
  • @treenity/core/mods/clients
  • @treenity/core/mods/llm/index
  • @treenity/core/mods/llm/server
  • @treenity/core/mods/servers
  • @treenity/core/mods/treenity/agent-port
  • @treenity/core/mods/treenity/builtins
  • @treenity/core/mods/treenity/groups
  • @treenity/core/mods/treenity/logs
  • @treenity/core/mods/treenity/mod-type
  • @treenity/core/mods/treenity/prefab-type
  • @treenity/core/mods/treenity/seed
  • @treenity/core/mods/treenity/server
  • @treenity/core/mods/treenity/system
  • @treenity/core/mods/treenity/user
  • @treenity/core/mods/uix/client
  • @treenity/core/mods/uix/compile
  • @treenity/core/mods/uix/jsx-parser
  • @treenity/core/mods/uix/verify
  • @treenity/core/protocol/treep
  • @treenity/core/schema/_import-fixtures/entries-alpha
  • @treenity/core/schema/_import-fixtures/entries-beta
  • @treenity/core/schema/_import-fixtures/widget-alpha
  • @treenity/core/schema/_import-fixtures/widget-beta
  • @treenity/core/schema/_test-fixture-oxc
  • @treenity/core/schema/action
  • @treenity/core/schema/catalog
  • @treenity/core/schema/extract-schemas-oxc
  • @treenity/core/schema/load
  • @treenity/core/schema/schema-test-widget
  • @treenity/core/schema/types
  • @treenity/core/server/actions
  • @treenity/core/server/agent
  • @treenity/core/server/auth
  • @treenity/core/server/auth-ops
  • @treenity/core/server/client
  • @treenity/core/server/cookies
  • @treenity/core/server/doc-index
  • @treenity/core/server/errors
  • @treenity/core/server/factory
  • @treenity/core/server/main
  • @treenity/core/server/migrate
  • @treenity/core/server/mod-catalog
  • @treenity/core/server/mods-mount
  • @treenity/core/server/mount
  • @treenity/core/server/mount-adapters
  • @treenity/core/server/prefab
  • @treenity/core/server/rate-limit
  • @treenity/core/server/refs
  • @treenity/core/server/seed/index
  • @treenity/core/server/server
  • @treenity/core/server/sub
  • @treenity/core/server/trpc
  • @treenity/core/server/types-mount
  • @treenity/core/server/validate
  • @treenity/core/server/volatile
  • @treenity/core/server/watch
  • @treenity/core/server/watch-filter
  • @treenity/core/tree
  • @treenity/core/tree-chain
  • @treenity/core/tree/cache
  • @treenity/core/tree/fs
  • @treenity/core/tree/index
  • @treenity/core/tree/inflight
  • @treenity/core/tree/json-codec
  • @treenity/core/tree/mimefs
  • @treenity/core/tree/patch
  • @treenity/core/tree/query
  • @treenity/core/tree/repath
  • @treenity/core/uri
  • @treenity/core/util/debounced-write
  • @treenity/core/util/path-lock
  • @treenity/core/util/safe-timers

Readme

@treenity/core

A spatial protocol for typed data. Three primitives. Everything else composes.

A single business concept — say, an Order — lives in five places: database schema, ORM, API DTO, frontend state, validation rules. Each copy drifts. Each sync layer adds bugs. Meanwhile, AI agents drown in infinite code grammar with no structural guardrails.

Treenity solves this with three primitives:

Node      = { $path, $type, ...components }
Component = { $type, ...data }
Context   = (Type, Context) → Handler

Install

npm install @treenity/core

Or scaffold a full project:

npx create-treenity my-app

Quick Example

import { registerType } from '@treenity/core/comp';

class TodoItem {
  title = '';
  done = false;

  toggle() {
    this.done = !this.done;
  }
}

registerType('todo.item', TodoItem);

Fields = data schema. Methods = server-side actions. toggle() runs inside an Immer draft — mutate this freely, patches are generated and broadcast to subscribers.

// React — one hook, fully typed
const item = usePath('/todo/list/1', TodoItem);
item.title;          // reactive read
await item.toggle(); // tRPC mutation → Immer patch → SSE broadcast

What You Get for Free

Feature How
Persistence Memory, filesystem, or MongoDB — composable store wrappers
Real-time sync SSE subscriptions, open two tabs and changes sync
Type validation JSON schemas auto-generated from classes
ACL Per-node bitmask permissions inherited down the tree
AI access Every node readable via MCP — Claude can query and mutate your data
Multi-surface Same type renders in React, Telegram, CLI — register context handlers
Mounts Mount MongoDB, REST APIs, other Treenity instances into one namespace

Packages

  • @treenity/core — primitives, store, server, schema, actions
  • @treenity/react — hooks, admin UI, reactive cache

License

Licensed under FSL-1.1-MIT. Free to use for any purpose. Converts to MIT automatically after two years from each release date.