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