Files
dao-os-docs/src/specifications/tech_overview.md
2025-06-11 10:43:22 +08:00

4.1 KiB

Technical Overview

This document provides a high-level overview of the architecture, core technologies, and guiding principles for developers looking to build on or contribute to the Dao OS ecosystem.

Guiding Technical Principles

Our engineering decisions are guided by a set of core principles to ensure the system is robust, portable, and open.

  • Web-Native & Portable: We leverage technologies born from the web (like WebAssembly and modern web UI frameworks) as the primary path for application development. This creates a single, portable core that can run anywhere.
  • Polyglotism via WASM: The core application logic (Service Module) is compiled to WebAssembly (WASM). This allows the logic to be written in languages like Rust, Go, etc.
  • API-First: The interaction between application logic and the user interface is defined by a strict, versioned API contract, enabling true decoupling.
  • Security-First: We employ best-in-class cryptographic protocols and a "principle of least privilege" design, with all third-party application logic running in a secure sandbox.
  • FOSS (Free and Open Source Software): The entire core protocol and reference implementations are open source to foster transparency, community trust, and collaborative innovation.

The Core Components: A Developer's View

From a developer's perspective, a Dao OS application consists of a backend "soul" and a frontend "skin" that interact via a well-defined boundary. We have designed the development path to be as accessible as possible.

1. The App Service Module (WASM Backend)

This is the portable, logical core of a third-party application. It is a stateful WASM module developed primarily in Rust (or other WASM-compatible languages). It contains all the business logic and is the only component that can request access to the user's Second Brain or other core Meta Unit services.

2. The App UI (The Frontend)

The Primary Path: Targeting the "Dao Web Avatar"

To maximize portability and lower the barrier to entry, the primary way to build a UI for a Dao OS application is by creating a standard Web Application (using React, Vue, Svelte, etc.).

This web UI runs inside our official, secure "Dao Web Avatar" container on all platforms (iOS, Android, Desktop). Communication with your WASM backend is handled via a secure dao.js JavaScript bridge that we provide. This means a developer can write one WASM backend and one Web UI frontend and have their application run everywhere.

The Advanced Path: Building a Native Avatar Skin

For developers who require deep platform integration or the absolute peak of native performance, it is still possible to build a fully native UI "skin." This native application would simply act as another host for the Meta Unit and would communicate with the same WASM backend service via the API contract. This is considered an optional enhancement, not a requirement.

The API Contract: The dao.js Bridge

For web-based UIs, the communication contract is exposed through the window.dao JavaScript object injected into the webview. Developers use this bridge to send Protobuf-serialized requests to their application's service module running in the Meta Unit and receive asynchronous responses.

Key Technologies & Protocols

Category Technology / Protocol Purpose
Backend Logic Rust / WebAssembly (WASM) Performance, safety, and ultimate portability.
Frontend UI Web Stack (HTML, CSS, JS/TS) Primary path for cross-platform UI development.
P2P Networking libp2p Modular peer discovery, transport, and secure channels.
Data Synchronization CRDTs (Conflict-Free Replicated Data Types) Ensuring eventual consistency across Avatars.
Identity DID & VC Sovereign identity and interoperable, cryptographic trust.
Data Serialization Protocol Buffers (Protobuf) Efficient, language-agnostic data structures for APIs.

This modular, web-centric, and open-protocol-based stack is designed for security, portability, and, most importantly, community contribution.