Skip to main content

rullst_core/
lib.rs

1//! Rullst Core Library
2#![allow(
3    clippy::collapsible_if,
4    clippy::unnecessary_map_or,
5    clippy::redundant_async_block
6)]
7#![deny(clippy::unwrap_used, clippy::expect_used)]
8#![warn(missing_docs)]
9extern crate self as rullst;
10
11/// Rullst application and server configuration models.
12pub mod config;
13pub mod db;
14pub mod edge;
15
16#[cfg(all(not(target_arch = "wasm32"), feature = "orm"))]
17/// Artisan command-line migrations and seed execution helpers.
18pub mod artisan;
19#[cfg(not(target_arch = "wasm32"))]
20pub mod cache;
21/// Edge client components rendering module.
22pub mod client;
23/// Portable, versioned wire contract shared by web and platform clients.
24pub mod client_contract;
25#[cfg(not(target_arch = "wasm32"))]
26/// Agentic DevOps Engine & Infrastructure Tuning (Milestone 20).
27pub mod devops;
28#[cfg(not(target_arch = "wasm32"))]
29/// Type-indexed dependency injection container.
30pub mod di;
31#[cfg(not(target_arch = "wasm32"))]
32mod error_buffer;
33#[cfg(not(target_arch = "wasm32"))]
34/// HTML visual logging and runtime console for development mode.
35pub mod error_console;
36#[cfg(not(target_arch = "wasm32"))]
37/// Feature flagging management and drivers.
38pub mod feature;
39#[cfg(not(target_arch = "wasm32"))]
40/// Hybrid Frontend SSR Adapters (Leptos, Dioxus, HTMX).
41pub mod frontend;
42#[cfg(not(target_arch = "wasm32"))]
43/// Kubernetes and Cloud-Native Health Probes.
44pub mod health;
45#[cfg(not(target_arch = "wasm32"))]
46/// Fast compile-time HTML rendering utilities.
47pub mod html;
48#[cfg(not(target_arch = "wasm32"))]
49/// HTMX helpers for rapid reactive UI design.
50pub mod htmx;
51#[cfg(not(target_arch = "wasm32"))]
52/// Process readiness and graceful request-drain coordination.
53pub mod lifecycle;
54#[cfg(not(target_arch = "wasm32"))]
55/// Live state synchronization and server-push connection handlers.
56pub mod live;
57#[cfg(not(target_arch = "wasm32"))]
58/// Multitenancy request routing and tenant state isolation layers.
59pub mod multitenant;
60#[cfg(all(not(target_arch = "wasm32"), feature = "offline-sync"))]
61/// Encrypted, bounded offline synchronization foundations for platform clients.
62pub mod offline_sync;
63#[cfg(not(target_arch = "wasm32"))]
64/// Canonical production middleware ordering contract.
65pub mod production;
66#[cfg(not(target_arch = "wasm32"))]
67pub mod queue;
68#[cfg(not(target_arch = "wasm32"))]
69/// Rullst Radar Kernel-Level Telemetry & Tokio runtime visualizer.
70pub mod radar;
71#[cfg(not(target_arch = "wasm32"))]
72/// Native Real-Time Engine (Channels, Broadcast, Presence).
73pub mod realtime;
74#[cfg(all(
75    not(target_arch = "wasm32"),
76    any(feature = "cache-redis", feature = "queue-redis")
77))]
78mod redis_connection;
79#[cfg(not(target_arch = "wasm32"))]
80/// Network and service resilience (rate limits, traffic shield, load shedding).
81pub mod resilience;
82#[cfg(not(target_arch = "wasm32"))]
83/// High-performance application routers built on Axum.
84pub mod routing;
85/// Typed, versioned browser-to-server function transport.
86pub mod rpc;
87#[cfg(not(target_arch = "wasm32"))]
88/// Interactive Scalar API documentation UI.
89pub mod scalar;
90#[cfg(not(target_arch = "wasm32"))]
91pub mod scheduler;
92#[cfg(not(target_arch = "wasm32"))]
93/// CSRF tokens, CORS, and response headers security policies.
94pub mod security;
95#[cfg(not(target_arch = "wasm32"))]
96/// Rullst HTTP web server core engine.
97pub mod server;
98#[cfg(not(target_arch = "wasm32"))]
99/// File and cloud storage abstraction layer.
100pub mod storage;
101#[cfg(not(target_arch = "wasm32"))]
102/// Rullst OpenTelemetry and Tracing.
103pub mod telemetry;
104#[cfg(not(target_arch = "wasm32"))]
105/// Distributed Tracing Spans Collector.
106pub mod telemetry_spans;
107#[cfg(not(target_arch = "wasm32"))]
108/// Scaffolding tools for robust integration testing.
109pub mod testing;
110#[cfg(not(target_arch = "wasm32"))]
111pub mod uploads;
112#[cfg(not(target_arch = "wasm32"))]
113/// Strongly-typed request validation extractors.
114pub mod validation;
115#[cfg(not(target_arch = "wasm32"))]
116/// WebSocket live connection and messaging system.
117pub mod ws;
118
119#[cfg(all(not(target_arch = "wasm32"), feature = "orm"))]
120#[macro_export]
121/// Standard migration and seeding bootstrap macro for Rullst.
122macro_rules! artisan {
123    ($migrations:expr) => {
124        let _ = $crate::artisan::check_and_run_artisan($migrations, vec![]).await;
125    };
126    ($migrations:expr, $seeders:expr) => {
127        let _ = $crate::artisan::check_and_run_artisan($migrations, $seeders).await;
128    };
129}
130
131// Re-export procedural macros
132pub use rullst_macros::{
133    html, island, live_component, live_event, memoize, route, server_function,
134};
135
136// Re-export core structs for public consumption
137#[cfg(not(target_arch = "wasm32"))]
138pub use routing::Router;
139
140#[cfg(not(target_arch = "wasm32"))]
141pub use server::{Server, ServerError};
142
143// Re-export rullst-orm for applications using the ORM feature.
144#[cfg(all(not(target_arch = "wasm32"), feature = "orm"))]
145pub use rullst_orm::{Orm, RullstModel};
146
147// Re-export Configuration types
148pub use config::{AppConfig, DatabaseConfig, RullstConfig, SecurityConfig};
149
150// Re-export HTTP primitives for convenience
151#[cfg(not(target_arch = "wasm32"))]
152pub use axum::http;
153
154// Re-export axum response types for convenience
155#[cfg(not(target_arch = "wasm32"))]
156/// Standard HTTP response types and helpers.
157pub mod response {
158    pub use axum::response::{Html, IntoResponse, Redirect, Response};
159}
160
161// Re-export HTMX primitives for convenience
162#[cfg(not(target_arch = "wasm32"))]
163pub use htmx::{HtmxRequest, HtmxResponse, render_page};
164#[cfg(not(target_arch = "wasm32"))]
165pub use lifecycle::{
166    ApplicationLifecycle, ApplicationLifecycleError, ApplicationPhase, ReadinessSnapshot,
167    apply_lifecycle,
168};
169
170// Re-export Milestone 5: Production Utilities
171#[cfg(not(target_arch = "wasm32"))]
172pub use cache::{Cache, TenantCache};
173#[cfg(not(target_arch = "wasm32"))]
174pub use di::{Container, DiError, Inject, Injectable};
175#[cfg(not(target_arch = "wasm32"))]
176pub use queue::{Queue, QueuedJobDetail, Worker, WorkerHandle};
177#[cfg(not(target_arch = "wasm32"))]
178pub use realtime::{
179    BroadcastManager, Channel, RealtimeError, RealtimeMessage, TenantPresence, TenantRealtime,
180};
181#[cfg(not(target_arch = "wasm32"))]
182pub use scheduler::{Scheduler, SchedulerError, SchedulerFailurePolicy, SchedulerHandle};
183
184// Re-export Milestone 6: Enterprise Features
185#[cfg(not(target_arch = "wasm32"))]
186pub use storage::{LocalDriver, Storage, StorageDriver, StorageError, TenantStorage};
187#[cfg(not(target_arch = "wasm32"))]
188pub use uploads::{
189    OfflineMockScanner, QuarantinedUpload, ReleasedUpload, ScanVerdict, UploadError, UploadKind,
190    UploadPolicy, UploadScanner,
191};
192#[cfg(not(target_arch = "wasm32"))]
193pub use validation::{Validate, ValidatedForm, ValidatedJson, ValidationError};
194#[cfg(not(target_arch = "wasm32"))]
195pub use ws::{WebSocket, WsError};
196
197// Re-export Milestone 6 Resilience Features
198#[cfg(not(target_arch = "wasm32"))]
199pub use production::{
200    AcademyBoundaryAssessment, AcademyCheckStatus, AcademyPresetError, AcademyProductionPreset,
201    AcademyProductionRequirement, ProductionMiddlewareStage, ProductionPreset,
202};
203#[cfg(not(target_arch = "wasm32"))]
204pub use resilience::{
205    RateLimitConfig, RateLimiter, TrafficShield, TrafficShieldConfig, TrafficShieldError,
206    backpressure_middleware, rate_limit_middleware,
207};
208#[cfg(not(target_arch = "wasm32"))]
209pub use security::{SecurityBaselineError, apply_security_baseline};
210
211#[cfg(not(target_arch = "wasm32"))]
212pub use async_trait::async_trait;
213#[cfg(all(not(target_arch = "wasm32"), feature = "orm"))]
214pub use feature::DbFeatureDriver;
215#[cfg(not(target_arch = "wasm32"))]
216pub use feature::{
217    EnvFeatureDriver, FeatureDriver, FeatureManager, MemoryFeatureDriver, TomlFeatureDriver,
218};
219#[cfg(not(target_arch = "wasm32"))]
220pub use multitenant::{TenantConfig, TenantLayer, TenantService, TenantStrategy, tenant_layer};
221
222#[cfg(not(target_arch = "wasm32"))]
223pub use testing::{TestApp, TestRequestBuilder, TestResponse};
224
225// ─────────── Dependency Shielding cascades (Roadmap Milestone 8) ────────────────────
226
227#[cfg(not(target_arch = "wasm32"))]
228/// Internal asynchronous runtime wrappers.
229pub mod runtime {
230    pub use async_trait::async_trait;
231    pub use tokio::{main, spawn, task, time};
232}
233
234/// Web server engine re-exports (Axum, Tower, Tower-HTTP).
235pub mod web {
236    #[cfg(not(target_arch = "wasm32"))]
237    pub use axum;
238    #[cfg(not(target_arch = "wasm32"))]
239    pub use tower;
240    #[cfg(not(target_arch = "wasm32"))]
241    pub use tower_http;
242}
243
244/// Re-exported underlying asynchronous engine (Tokio).
245pub mod async_runtime {
246    #[cfg(not(target_arch = "wasm32"))]
247    pub use tokio;
248}