kit_rs/
lib.rs

1pub mod config;
2pub mod container;
3pub mod http;
4pub mod inertia;
5pub mod middleware;
6pub mod routing;
7pub mod server;
8
9pub use config::{
10    env, env_optional, env_required, AppConfig, Config, Environment, ServerConfig,
11};
12pub use container::{App, Container};
13pub use http::{json, text, HttpResponse, Redirect, Request, Response, ResponseExt};
14pub use inertia::{InertiaConfig, InertiaContext, InertiaResponse};
15pub use middleware::{Middleware, MiddlewareFuture, MiddlewareRegistry, Next};
16pub use routing::{delete, get, post, put, route, GroupBuilder, GroupRouter, RouteBuilder, RouteDefBuilder, Router};
17pub use server::Server;
18
19// Re-export async_trait for middleware implementations
20pub use async_trait::async_trait;
21
22// Re-export inventory for #[service(ConcreteType)] macro
23#[doc(hidden)]
24pub use inventory;
25
26// Re-export for macro usage
27#[doc(hidden)]
28pub use serde_json;
29
30// Re-export serde for InertiaProps derive macro
31pub use serde;
32
33// Re-export the proc-macros for compile-time component validation and type safety
34pub use kit_macros::inertia_response;
35pub use kit_macros::injectable;
36pub use kit_macros::InertiaProps;
37pub use kit_macros::redirect;
38pub use kit_macros::service;
39
40#[macro_export]
41macro_rules! json_response {
42    ($($json:tt)+) => {
43        Ok($crate::HttpResponse::json($crate::serde_json::json!($($json)+)))
44    };
45}
46
47#[macro_export]
48macro_rules! text_response {
49    ($text:expr) => {
50        Ok($crate::HttpResponse::text($text))
51    };
52}
53
54/// Testing utilities for the application container
55///
56/// Provides `TestContainer` for setting up isolated test environments with
57/// fake implementations.
58pub mod testing {
59    pub use crate::container::testing::{TestContainer, TestContainerGuard};
60}