Skip to main content

reifydb_sub_server_http/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3#![cfg_attr(not(debug_assertions), deny(clippy::disallowed_methods))]
4#![cfg_attr(debug_assertions, warn(clippy::disallowed_methods))]
5#![cfg_attr(not(debug_assertions), deny(warnings))]
6#![allow(clippy::tabs_in_doc_comments)]
7
8//! HTTP server subsystem for ReifyDB.
9//!
10//! This crate provides an Axum-based HTTP server for handling query and command
11//! requests. It integrates with the shared tokio runtime and implements the
12//! transaction ReifyDB `Subsystem` trait for lifecycle management.
13//!
14//! # Features
15//!
16//! - REST API for query and command execution
17//! - Bearer token and auth token authentication
18//! - Request timeouts and connection limits
19//! - Graceful shutdown support
20//! - Health check endpoint
21//!
22//! # Endpoints
23//!
24//! - `GET /health` - Health check (no authentication required)
25//! - `POST /v1/query` - Execute read-only queries
26//! - `POST /v1/command` - Execute write commands
27//!
28//! # Example
29//!
30//! ```ignore
31//! use reifydb_core::SharedRuntime;
32//! use reifydb_sub_server::{AppState, QueryConfig};
33//! use reifydb_sub_server_http::HttpSubsystem;
34//!
35//! // Create shared runtime
36//! let runtime = SharedRuntime::new(4);
37//!
38//! // Create application state
39//! let state = AppState::new(pool, engine, QueryConfig::default(), RequestInterceptorChain::empty());
40//!
41//! // Create and start HTTP subsystem
42//! let mut http = HttpSubsystem::new(
43//!     "0.0.0.0:8090".to_string(),
44//!     state,
45//!     runtime.handle(),
46//! );
47//! http.start()?;
48//! ```
49
50pub mod error;
51pub mod factory;
52pub mod handlers;
53pub mod routes;
54pub mod subsystem;