Introduction
Astrid SDK is the official JavaScript and TypeScript SDK for building capsules — self-contained applications that run on Astrid OS. It provides APIs for state management, identity, inter-capsule communication, and lifecycle hooks, enabling developers to build decentralized applications using familiar web technologies.
What Astrid SDK Does
- Provides typed APIs for capsule lifecycle management (init, suspend, resume, destroy)
- Handles state persistence and synchronization across capsule instances
- Manages user identity and authentication through the Astrid OS identity layer
- Enables inter-capsule messaging and data sharing through structured protocols
- Offers development tooling including a local emulator and hot-reload server
Architecture Overview
The SDK is a TypeScript library that abstracts the Astrid OS runtime APIs behind a developer-friendly interface. Capsules are packaged as standard JavaScript bundles that the Astrid OS runtime loads and sandboxes. The SDK communicates with the host runtime through a message-passing bridge, handling serialization, state checkpointing, and capability negotiation transparently. A companion Rust SDK (sdk-rust) provides equivalent APIs for performance-critical capsules.
Self-Hosting & Configuration
- Install via npm or yarn into any Node.js or browser-based project
- Use the local emulator for development without a full Astrid OS installation
- Configure capsule manifest (permissions, capabilities, resource limits) in astrid.json
- Deploy capsules to Astrid OS instances using the CLI publish command
- TypeScript definitions are included for full IDE autocompletion and type safety
Key Features
- First-class TypeScript support with complete type definitions
- Local development emulator for testing capsules without a running Astrid OS node
- Built-in state persistence API that handles serialization and conflict resolution
- Identity integration for user authentication and capability-based access control
- Hot module replacement during development for rapid iteration
Comparison with Similar Tools
- Electron — builds standalone desktop apps; Astrid SDK targets the Astrid OS capsule runtime
- React Native — cross-platform mobile framework; Astrid capsules are platform-agnostic runtime units
- WASI/WASM — low-level portable binary format; Astrid SDK is a higher-level application SDK
- Deno Deploy — serverless JavaScript platform; Astrid OS is a decentralized runtime, not a cloud service
FAQ
Q: Do I need Astrid OS to develop capsules? A: No. The SDK includes a local emulator for development and testing. You only need Astrid OS for deployment.
Q: Can I use existing npm packages in a capsule? A: Yes, with some limitations. Capsules run in a sandboxed environment, so packages that require native bindings or unrestricted filesystem access may not work.
Q: Is there a Rust SDK as well? A: Yes. The companion sdk-rust provides equivalent APIs for capsules that need native performance.
Q: What platforms does Astrid OS run on? A: Astrid OS runs on Linux, macOS, and Windows. Capsules themselves are platform-independent.