Skip to main content

reifydb_sub_server_http/
lib.rs

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