reifydb_sub_server_admin/
lib.rs

1// Copyright (c) reifydb.com 2025
2// This file is licensed under the AGPL-3.0-or-later
3
4//! Admin server subsystem for ReifyDB.
5//!
6//! This crate provides an Axum-based HTTP server for web-based administration
7//! of ReifyDB. It integrates with the shared tokio runtime and implements the
8//! standard ReifyDB `Subsystem` trait for lifecycle management.
9//!
10//! # Features
11//!
12//! - REST API for configuration and metrics
13//! - Authentication support (optional)
14//! - Static file serving for admin UI
15//! - Health check endpoint
16//! - Graceful shutdown support
17//!
18//! # Endpoints
19//!
20//! - `GET /health` - Health check
21//! - `POST /v1/auth/login` - Login
22//! - `POST /v1/auth/logout` - Logout
23//! - `GET /v1/auth/status` - Auth status
24//! - `GET /v1/config` - Get configuration
25//! - `PUT /v1/config` - Update configuration
26//! - `POST /v1/execute` - Execute query
27//! - `GET /v1/metrics` - System metrics
28//! - `GET /` - Admin UI
29//!
30//! # Example
31//!
32//! ```ignore
33//! use reifydb_sub_server::SharedRuntime;
34//! use reifydb_sub_server_admin::{AdminConfig, AdminSubsystem, AdminState};
35//!
36//! // Create shared runtime
37//! let runtime = SharedRuntime::new(4);
38//!
39//! // Create application state
40//! let state = AdminState::new(engine, 1000, Duration::from_secs(30), false, None);
41//!
42//! // Create and start admin subsystem
43//! let mut admin = AdminSubsystem::with_runtime(
44//!     "127.0.0.1:9090".to_string(),
45//!     state,
46//!     Arc::new(runtime),
47//! );
48//! admin.start()?;
49//! ```
50
51#![cfg_attr(not(debug_assertions), deny(warnings))]
52
53mod assets;
54mod config;
55mod factory;
56mod handlers;
57mod routes;
58mod state;
59mod subsystem;
60
61pub use config::AdminConfig;
62pub use factory::AdminSubsystemFactory;
63pub use routes::router;
64pub use state::AdminState;
65pub use subsystem::AdminSubsystem;