Skip to main content

haystack_server/
lib.rs

1//! Haystack HTTP API server with SCRAM auth, WebSocket watches, and federation.
2//!
3//! Provides [`HaystackServer`] — an Actix Web-based HTTP server implementing
4//! the full Project Haystack REST API with 30+ standard operations.
5//!
6//! ## Features
7//!
8//! - **30+ Haystack ops** — about, read, nav, hisRead, hisWrite, pointWrite,
9//!   watchSub, watchPoll, watchUnsub, invokeAction, defs, libs, formats, and more
10//! - **SCRAM SHA-256 auth** — Token-based authentication with configurable TTL
11//! - **WebSocket watches** — Real-time entity change subscriptions with compression
12//! - **Federation** — Hub-and-spoke topology with automatic entity routing,
13//!   delta sync, and adaptive intervals
14//! - **History store** — In-memory time-series storage for his-tagged points
15//! - **Content negotiation** — Zinc, JSON, JSON v3, CSV via Accept header
16//!
17//! ## Quick Start
18//!
19//! ```rust,no_run
20//! use haystack_core::graph::{EntityGraph, SharedGraph};
21//! use haystack_server::HaystackServer;
22//!
23//! # async fn example() -> std::io::Result<()> {
24//! let graph = SharedGraph::new(EntityGraph::new());
25//! HaystackServer::new(graph)
26//!     .port(8080)
27//!     .host("0.0.0.0")
28//!     .run()
29//!     .await
30//! # }
31//! ```
32
33pub mod actions;
34pub mod app;
35pub mod auth;
36pub mod connector;
37pub mod content;
38pub mod demo;
39pub mod error;
40pub mod federation;
41pub mod his_store;
42pub mod ops;
43pub mod state;
44pub mod ws;
45
46pub use app::HaystackServer;
47pub use federation::Federation;