Skip to main content

hyperstack/
lib.rs

1//! # HyperStack
2//!
3//! Real-time streaming data pipelines for Solana - transform on-chain events
4//! into typed state projections.
5//!
6//! ## Features
7//!
8//! - **`interpreter`** (default) - AST transformation runtime and VM
9//! - **`macros`** (default) - Proc-macros for defining stream specifications
10//! - **`server`** (default) - WebSocket server and projection handlers
11//! - **`sdk`** - Rust client for connecting to HyperStack servers
12//!
13//! ## Quick Start
14//!
15//! ```toml
16//! [dependencies]
17//! hyperstack = "0.2"
18//! ```
19//!
20//! Or with specific features:
21//!
22//! ```toml
23//! [dependencies]
24//! hyperstack = { version = "0.1", features = ["full"] }
25//! ```
26//!
27//! ## Example
28//!
29//! ```rust,ignore
30//! use hyperstack::prelude::*;
31//!
32//! #[hyperstack(idl = "idl.json")]
33//! pub mod my_stream {
34//!     #[entity(name = "MyEntity")]
35//!     #[derive(Stream)]
36//!     struct Entity {
37//!         #[map(from = "MyAccount", field = "value")]
38//!         pub value: u64,
39//!     }
40//! }
41//! ```
42
43// Re-export interpreter (AST runtime and VM)
44#[cfg(feature = "interpreter")]
45pub use hyperstack_interpreter as interpreter;
46
47// Re-export macros
48#[cfg(feature = "macros")]
49pub use hyperstack_macros as macros;
50
51// Re-export server components
52#[cfg(feature = "server")]
53pub use hyperstack_server as server;
54
55// Re-export SDK client
56#[cfg(feature = "sdk")]
57pub use hyperstack_sdk as sdk;
58
59#[cfg(feature = "runtime")]
60#[doc(hidden)]
61pub mod runtime {
62    pub use ::anyhow;
63    pub use ::bs58;
64    pub use ::dotenvy;
65    pub use ::serde;
66    pub use ::serde_json;
67    pub use ::smallvec;
68    pub use ::tokio;
69    pub use ::tracing;
70    pub use ::yellowstone_vixen;
71    pub use ::yellowstone_vixen_core;
72    pub use ::yellowstone_vixen_yellowstone_grpc_source;
73    pub use hyperstack_interpreter;
74    pub use hyperstack_server;
75}
76
77/// Prelude module for convenient imports
78pub mod prelude {
79    // Re-export commonly used items from interpreter
80    #[cfg(feature = "interpreter")]
81    pub use hyperstack_interpreter::{
82        ast::{SerializableStreamSpec, TypedStreamSpec},
83        compiler::MultiEntityBytecode,
84        vm::VmContext,
85        Mutation, UpdateContext,
86    };
87
88    #[cfg(feature = "macros")]
89    pub use hyperstack_macros::{hyperstack, Stream};
90
91    // Re-export server components
92    #[cfg(feature = "server")]
93    pub use hyperstack_server::{bus::BusManager, config::ServerConfig, projector::Projector};
94
95    // Re-export SDK client
96    #[cfg(feature = "sdk")]
97    pub use hyperstack_sdk::HyperStack;
98}