Home Doh Ref
Dohballs
  • 📁 doh_chat
  • 📁 doh_modules
    • 📦 dataforge
    • 📦 express
    • 📁 sso
    • 📁 user

Architecture Overview

Doh.js is a unified execution environment built on a single composition algorithm. This page maps the full ecosystem - nine categories of capability, all governed by the same ordering and melding principles.

The Composition Algorithm

Every system in Doh relies on two primitives:

  1. Resolution Order - Topological sort that flattens any dependency graph into a deterministic ordered list. Used for pattern inheritance, module loading, pod configuration, and network routing.

  2. Melded Object Composition (MOC) - Per-property rules that control how values combine. Data properties get merge strategies (Override, Object, Array, Deep). Methods get execution strategies (Method, Chain, Blender, Funnel, Phase - each with async variants and pre_/post_ hooks).

These aren't separate systems. They're the same algorithm applied to different namespace types.

-> Resolution Order in depth -> MOC in depth


1. Core Framework

The foundation that everything else builds on.

Load System & Auto-Packager AST-level scanning understands your code - dependencies, exports, environment targets. Generates manifests at build time so runtime execution is instant. No transpilation. Your code runs as-is.

Modules & Packages Dependency-aware execution with Scoped Parameter Resolution (SPR). Module callback parameters resolve by name from load ancestry. Environment branching with browser?? and nodejs?? decorators splits a single codebase automatically.

DohPath Universal path resolution across Browser, Node, and Bun. Project-relative (/), module-relative (^/), and package-relative (^:pkg/) paths. Move files without breaking references.

Pods Hierarchical YAML configuration with deep melding. Sparse overrides layer cleanly. Environment-specific settings, removal operators (~~), and browser-safe subsets via browser_pod.

Dohballs Versioned portable distribution units. doh bake packages modules with compiled manifests. Install without source scanning. Share and deploy as self-contained units.

Manifests JSON metadata generated by the Auto-Packager that drives runtime loading, dependency resolution, and distribution. Public manifests for the load system, private manifests for development tooling.


2. Object System

Feature-driven composition through multiple inheritance.

Patterns Reusable composable blueprints. Single or multiple parent inheritance. Ad-hoc composition with New(['A', 'B', 'C']). Patterns define the shape; MOC defines how shapes combine.

MOC The type AND merge system. Data melders: Override, Array, Concat, Object, Deep. Method melders: Method, Chain, Blender, Funnel, Phase (+ async variants, + This_ variants). Validation tracks: IsString, IsNumber, IsFunction, etc. State tracks: USE_STATE, USE_STATE_DEFAULT, USE_URL_QUERY, USE_LOCAL_STORAGE.

Lifecycle Phases object_phase -> builder_phase -> control_phase -> on_phase -> html_phase. Each has pre_ and post_ hooks. All stack through inheritance (base -> derived). Destroy runs in reverse (derived -> base).

Sub-Object-Builder Properties with pattern: 'Name' auto-build as children during builder_phase. DOM hierarchy matches object hierarchy. Parent-child references maintained automatically.


3. UI & DOM

Browser rendering and interaction.

HTML Pattern jQuery-based element creation with observable property proxies. this.css, this.attr, this.classes sync with the DOM and can be observed/mimicked. Elements self-append during html_phase.

CSS Management Three layers: module stylesheets (via dependencies), Doh.css() for structural CSS, and pattern css property for composition-friendly styles. All reactive through proxies.

Events (.on) Declarative binding with on: { click() { ... } }. Handlers get this hoisted to the html element. Event methods participate in MOC melding through inheritance.

Controls Cross-tree communication. Controllers collect controls by name, eliminating deep this.builder.builder.builder drilling. Objects label as controls with a control property; controllers collect them automatically.

HTML Differ Structural DOM patching with visual change highlighting for development.


4. State & Reactivity

Observable state management from local properties to global singletons.

observe / mimic Reactive property watching on any object. Two-way sync between any two properties with Doh.mimic(). Lightweight, no framework lock-in.

USE State Singleton global state via Doh.use_state(). Deep proxy observation - nested property changes fire observers automatically. observe_use for path-based watching with bubbling. mimic_use for state-to-object sync.

Snapshots Time travel with undo/redo/goto. Configurable triggers, state capture, and timeline depth. Browser history integration via as_history: true - popstate handled automatically.

URL & localStorage Sync Doh.use_url_query() and Doh.use_local_storage() provide bidirectional persistence. State changes update the URL or localStorage; external changes update state.


5. Server & Networking

HTTP, WebSocket, authentication, and encrypted networking.

Express Router Protocol-agnostic routing. Same handler serves HTTP and WebSocket. Router.AddRoute(), Router.SendJSON(), Router.SendHTML(). File-based routing with middleware integration.

Users & Auth JWT authentication, registration, email verification, multi-device sessions, brute-force protection. Built-in routes for /api/login, /api/register, etc. Client-side Doh.user API.

Permission System Context-aware authorization with Doh.permit(user, 'action:context', runtimeObject). Hierarchical groups, dynamic permissions, runtime object evaluation.

SSO & Google Auth Single sign-on server and client modules. OAuth provider support. Identity federation across distributed Doh instances.

Greenlock SSL Automatic Let's Encrypt certificate management. Zero-config HTTPS for production deployments.

uNet VPU Trust-first encrypted networking. Ed25519 cryptography. Self-documenting addresses encode the full trust chain. Tree-based routing with self-healing topology. Address portability across VPU providers. Multi-VPU membership.


6. Data & Storage

Databases, pipelines, and persistence.

Dataforge Declarative data pipeline engine. Sync and async operation. Command sequences: SelectDB, CreateTableInDB, ReplaceIntoDB, SelectIdeaFromDB, QueryDB, RunInDB, SearchInDB, ParseIdeas.

Database Integration SQLite (server) and alasql (browser). Two table types: Idea Tables (flexible JSON document storage) and Structured Tables (custom columns, SQL queries, joins).

Handlebars Templating Template processing integrated into Dataforge pipelines. Dynamic content generation with live data injection.

Storage Manager LVM 3-tier storage with automated backups. Disk management for production deployments.

Server Polyfills IndexedDB and localStorage implementations for Node.js and Bun, enabling cross-environment code that uses browser storage APIs.


7. Tooling & Developer Experience

Development, debugging, and AI integration.

CLI Two-tier CLI. Runtime commands (doh run, doh update, doh upgrade) and project management (doh init, doh bake, doh install).

HMR Hot reload for CSS, HTML, JSON, and Patterns without page refresh. Pattern instance hot-patching with state preservation. Pod file watching with browser push.

ESBuild & Banal Bundling with interactive dependency visualization. Import map generation for browser-native ES module loading.

Testing Framework Full-stack testing with visual UI and auto-discovery. expect(), expectEqual(), resetTests(), summarizeTests(). Browser and server test modules load in sequence.

MCP Server AI assistant integration with AST-powered code search, documentation search, browser automation, and cloud instance management.

Browser IDE Monaco-based VS Code-like editor in the browser. File operations, terminal access via server-side PTY, Git integration, live filesystem.


8. Cloud & Operations

Distributed management and monitoring.

Cloud Manager 11-tab dashboard for distributed instance management. File synchronization, log aggregation, remote command execution, cross-instance sync.

Managed Site 70+ remote commands with smart file sync. Deploy, update, and manage production instances from a central dashboard.

Admin Dashboard Auto-discovering admin routes. Every module that registers admin endpoints appears automatically.

Security Audit 25 automated checks with letter grades. Autofix recommendations. Covers auth, headers, permissions, SSL, and configuration.

Analytics Dashboard Traffic, visitors, and performance metrics for production monitoring.


9. Communication & Media

Real-time collaboration, file transfer, and media production.

Real-Time Chat Multi-room messaging, direct messages, presence indicators, typing indicators. Socket.IO-based with persistence.

P2P File Transfer WebRTC data channels with Socket.IO signaling fallback. Direct browser-to-browser file transfer.

Collaborative Documents CRDT-based code editing with Yjs. Remote cursors, conflict-free merging, real-time sync.

Collaborative Richtext TinyMCE + Yjs integration for Google Docs-style collaborative editing.

Live Recording WebRTC multi-participant recording with FFmpeg post-processing. Audio/video capture and assembly.

Video Editor Multi-track timeline editor with effects, transitions, and export. Browser-based media production.


How It All Connects

Every system listed above participates in the same composition hierarchy:

  • Modules load through Resolution Order with SPR parameter injection
  • Patterns inherit through Resolution Order with MOC property melding
  • Pods cascade through Resolution Order with deep melding and removal operators
  • Dataforge pipelines chain commands through Resolution Order
  • uNet routes through tree-based Resolution Order with trust-chain validation

One algorithm. Nine categories. A single codebase that runs on the browser and server, secured by trust-first networking, managed through unified orchestration.

-> Start building: Modules guide -> Start building: Patterns guide -> Understand the network: uNet VPU

Last updated: 2/17/2026