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::InertiaProps;
36pub use kit_macros::redirect;
37pub use kit_macros::service;
38
39#[macro_export]
40macro_rules! json_response {
41    ($($json:tt)+) => {
42        Ok($crate::HttpResponse::json($crate::serde_json::json!($($json)+)))
43    };
44}
45
46#[macro_export]
47macro_rules! text_response {
48    ($text:expr) => {
49        Ok($crate::HttpResponse::text($text))
50    };
51}
52
53/// Testing utilities for the application container
54///
55/// Provides `TestContainer` for setting up isolated test environments with
56/// fake implementations.
57pub mod testing {
58    pub use crate::container::testing::{TestContainer, TestContainerGuard};
59}