Datastar Documentation
repository·develop·Indexed 26 days ago
https://github.com/starfederation/datastarA lightweight hypermedia framework for building websites and real-time collaborative web applications using declarative attributes. It features a reactivity system based on signals, computed values, and effects, and utilizes data-* attributes for data binding, text updates, and event handling. The framework includes a plugin system for attributes, actions, and watchers, as well as official extensions for Visual Studio Code and JetBrains IDEs.
What's inside Datastar
- The Datastar Clojure SDK is no longer maintained in this repository. To use the SDK, visit the dedicated repository at https://github.com/starfederation/datastar-clojure.
Access the Datastar Ruby SDK
developThe Datastar Ruby SDK is no longer maintained in this repository. It has moved to a dedicated repository. To use or contribute to the Ruby SDK, visit the new repository at https://github.com/starfederation/datastar-ruby.Use the Datastar C# (.NET) SDK
developThe Datastar C# (.NET) SDK is no longer maintained in this repository. To use the SDK, you must use the dedicated repository at https://github.com/starfederation/datastar-dotnet.Access the Datastar Java SDK
developThe Datastar Java SDK is no longer maintained in this repository. It has moved to a dedicated repository. To use the Java SDK, visit the new repository at https://github.com/starfederation/datastar-java.Locate the Datastar Go SDK
developThe Datastar Go SDK is no longer maintained within this repository. It has moved to its own dedicated repository. To use or contribute to the Go SDK, visit the new repository at https://github.com/starfederation/datastar-go.Understand Datastar SDK Core Mechanics
developDatastar uses a Server-Sent Events (SSE) approach for communication between the server and the browser. The communication flow follows these rules:
- Server to Browser: Data is transmitted via SSE events.
- Browser to Server: Data is sent as JSON payloads under the
datastarnamespace.
Locate the Datastar TypeScript SDK
developThe Datastar TypeScript SDK is no longer maintained within this repository. It has moved to a dedicated repository. To use or contribute to the TypeScript SDK, visit the new repository at https://github.com/starfederation/datastar-typescript.Use the Datastar Rust SDK
developThe Datastar Rust SDK is no longer maintained in this repository. To use the SDK, visit the dedicated repository at https://github.com/starfederation/datastar-rust.Access the Datastar Python SDK
developThe Datastar Python SDK is no longer maintained in this repository. It has moved to a dedicated repository. To use or contribute to the Python SDK, visit the new repository at https://github.com/starfederation/datastar-python.Create a new Datastar SDK
developTo implement a new Datastar SDK, follow these steps:
- Review the Architecture Decision Record to understand the required SDK specifications.
- Use the constants defined in
datastar-sdk-config.jsonas your source of truth for event types, element patch modes, and other enums. - Implement the
ServerSentEventGeneratorinterface. - Validate your implementation by running the comprehensive test suite located in the
tests/directory.
Install Datastar via CDN
developTo use Datastar, add a single script tag to your HTML. This loads the framework as a module, enabling declarative reactivity through
data-*attributes.<script type="module" src="https://cdn.jsdelivr.net/gh/starfederation/datastar@v1.0.2/bundles/datastar.js"></script>Use Datastar Autocomplete and Documentation in IntelliJ
developThe plugin provides autocomplete for all Datastar custom
data-*attributes, as well as standard DOM attributes and events.To view documentation alongside autocomplete suggestions, enable the following setting:
<kbd>File</kbd> → <kbd>Settings</kbd> → <kbd>Editor</kbd> → <kbd>General</kbd> → <kbd>Code Completion</kbd> → Check the box: Show the documentation popup in .... ms.