diff --git a/rustfs/src/admin/handlers.rs b/rustfs/src/admin/handlers.rs
index c48a820a0..195858c32 100644
--- a/rustfs/src/admin/handlers.rs
+++ b/rustfs/src/admin/handlers.rs
@@ -12,1409 +12,43 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use super::router::Operation;
-use crate::admin::auth::validate_admin_request;
-use crate::auth::check_key_valid;
-use crate::auth::get_condition_values;
-use crate::auth::get_session_token;
-use crate::error::ApiError;
-use crate::server::RemoteAddr;
-use bytes::Bytes;
-use futures::{Stream, StreamExt};
-use http::{HeaderMap, HeaderValue, Uri};
-use hyper::StatusCode;
-use matchit::Params;
-use rustfs_common::heal_channel::HealOpts;
-use rustfs_config::{MAX_ADMIN_REQUEST_BODY_SIZE, MAX_HEAL_REQUEST_SIZE};
-use rustfs_credentials::get_global_action_cred;
-use rustfs_ecstore::admin_server_info::get_server_info;
-use rustfs_ecstore::bucket::bucket_target_sys::BucketTargetSys;
-use rustfs_ecstore::bucket::metadata::BUCKET_TARGETS_FILE;
-use rustfs_ecstore::bucket::metadata_sys;
-use rustfs_ecstore::bucket::target::BucketTarget;
-use rustfs_ecstore::bucket::utils::is_valid_object_prefix;
-use rustfs_ecstore::bucket::versioning_sys::BucketVersioningSys;
-use rustfs_ecstore::data_usage::load_data_usage_from_backend;
-use rustfs_ecstore::error::StorageError;
-use rustfs_ecstore::global::global_rustfs_port;
-use rustfs_ecstore::metrics_realtime::{CollectMetricsOpts, MetricType, collect_local_metrics};
-use rustfs_ecstore::new_object_layer_fn;
-use rustfs_ecstore::pools::{get_total_usable_capacity, get_total_usable_capacity_free};
-use rustfs_ecstore::store_api::BucketOptions;
-use rustfs_ecstore::store_api::StorageAPI;
-use rustfs_ecstore::store_utils::is_reserved_or_invalid_bucket;
-use rustfs_iam::store::MappedPolicy;
-use rustfs_madmin::metrics::RealtimeMetrics;
-use rustfs_madmin::utils::parse_duration;
-use rustfs_policy::policy::Args;
-use rustfs_policy::policy::BucketPolicy;
-use rustfs_policy::policy::action::Action;
-use rustfs_policy::policy::action::AdminAction;
-use rustfs_policy::policy::action::S3Action;
-use rustfs_policy::policy::default::DEFAULT_POLICIES;
-use rustfs_utils::path::path_join;
-use s3s::header::CONTENT_TYPE;
-use s3s::stream::{ByteStream, DynByteStream};
-use s3s::{Body, S3Error, S3Request, S3Response, S3Result, s3_error};
-use s3s::{S3ErrorCode, StdError};
-use serde::{Deserialize, Serialize};
-use std::collections::{HashMap, HashSet};
-use std::path::PathBuf;
-use std::pin::Pin;
-use std::sync::Arc;
-use std::task::{Context, Poll};
-use std::time::Duration as std_Duration;
-use tokio::sync::mpsc::{self};
-use tokio::time::interval;
-use tokio::{select, spawn};
-use tokio_stream::wrappers::ReceiverStream;
-use tracing::debug;
-use tracing::{error, info, warn};
-use url::Host;
-
+pub mod account_info;
pub mod bucket_meta;
pub mod event;
pub mod group;
+pub mod heal;
pub mod health;
+pub mod is_admin;
pub mod kms;
pub mod kms_dynamic;
pub mod kms_keys;
+pub mod metrics;
pub mod policies;
pub mod pools;
pub mod profile;
+pub mod profile_admin;
pub mod quota;
pub mod rebalance;
+pub mod replication;
pub mod service_account;
pub mod sts;
+pub mod system;
pub mod tier;
pub mod trace;
pub mod user;
+
+pub use account_info::AccountInfoHandler;
+pub use heal::{BackgroundHealStatusHandler, HealHandler};
pub use health::HealthCheckHandler;
-
-#[derive(Debug, Serialize)]
-pub struct IsAdminResponse {
- pub is_admin: bool,
- pub access_key: String,
- pub message: String,
-}
-
-#[allow(dead_code)]
-#[derive(Debug, Serialize, Default)]
-#[serde(rename_all = "PascalCase", default)]
-pub struct AccountInfo {
- pub account_name: String,
- pub server: rustfs_madmin::BackendInfo,
- pub policy: BucketPolicy,
-}
-
-pub struct IsAdminHandler {}
-#[async_trait::async_trait]
-impl Operation for IsAdminHandler {
- async fn call(&self, req: S3Request
, _params: Params<'_, '_>) -> S3Result> {
- let Some(input_cred) = req.credentials else {
- return Err(s3_error!(InvalidRequest, "get cred failed"));
- };
-
- let (cred, _owner) =
- check_key_valid(get_session_token(&req.uri, &req.headers).unwrap_or_default(), &input_cred.access_key).await?;
-
- let access_key_to_check = input_cred.access_key.clone();
-
- // Check if the user is admin by comparing with global credentials
- let is_admin = if let Some(sys_cred) = get_global_action_cred() {
- crate::auth::constant_time_eq(&access_key_to_check, &sys_cred.access_key)
- || crate::auth::constant_time_eq(&cred.parent_user, &sys_cred.access_key)
- } else {
- false
- };
-
- let response = IsAdminResponse {
- is_admin,
- access_key: access_key_to_check,
- message: format!("User is {}an administrator", if is_admin { "" } else { "not " }),
- };
-
- let data = serde_json::to_vec(&response)
- .map_err(|_e| S3Error::with_message(S3ErrorCode::InternalError, "parse IsAdminResponse failed"))?;
-
- let mut header = HeaderMap::new();
- header.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
-
- Ok(S3Response::with_headers((StatusCode::OK, Body::from(data)), header))
- }
-}
-
-pub struct AccountInfoHandler {}
-#[async_trait::async_trait]
-impl Operation for AccountInfoHandler {
- async fn call(&self, req: S3Request, _params: Params<'_, '_>) -> S3Result> {
- let Some(store) = new_object_layer_fn() else {
- return Err(S3Error::with_message(S3ErrorCode::InternalError, "Not init".to_string()));
- };
-
- let Some(input_cred) = req.credentials else {
- return Err(s3_error!(InvalidRequest, "get cred failed"));
- };
-
- let (cred, owner) =
- check_key_valid(get_session_token(&req.uri, &req.headers).unwrap_or_default(), &input_cred.access_key).await?;
-
- let Ok(iam_store) = rustfs_iam::get() else {
- return Err(s3_error!(InvalidRequest, "iam not init"));
- };
-
- let default_claims = HashMap::new();
- let claims = cred.claims.as_ref().unwrap_or(&default_claims);
-
- let cred_clone = cred.clone();
- let remote_addr = req.extensions.get::