forge/lib.rs
1//! FORGE - The Rust Full-Stack Framework
2//!
3//! A batteries-included framework for building full-stack web applications
4//! with a Rust backend and generated SvelteKit or Dioxus frontends.
5//!
6//! ## Features
7//!
8//! Cargo features control which subsystems are compiled in. The default
9//! feature set is `full` — every subsystem enabled. To shrink your binary,
10//! disable defaults and opt into a preset:
11//!
12//! ```toml
13//! # Worker-only binary (no HTTP gateway)
14//! forge = { version = "0.9", default-features = false, features = ["worker"] }
15//!
16//! # API server (no background workers)
17//! forge = { version = "0.9", default-features = false, features = ["api"] }
18//! ```
19//!
20//! Available presets: `full`, `worker`, `api`, `minimal`.
21//! Available subsystems: `gateway`, `jobs`, `workflows`, `cron`, `daemons`,
22//! `geoip`, `otel`.
23
24mod auto_register;
25#[cfg(feature = "embedded-frontend")]
26mod embedded;
27mod runtime;
28
29#[doc(hidden)]
30pub use forge_core;
31
32// The mcp_tool scaffold uses `#[schemars(crate = "forge::schemars")]` to point
33// the derive at this re-export.
34pub use forge_core::schemars;
35
36#[doc(hidden)]
37pub use inventory;
38
39pub use auto_register::{AutoHandler, HandlerRegistries, auto_register_all};
40
41#[cfg(feature = "embedded-frontend")]
42pub use embedded::serve_embedded_assets;
43
44pub use forge_macros::{
45 cron, daemon, forge_enum, job, mcp_tool, model, mutation, query, webhook, workflow,
46};
47
48pub use forge_runtime::pg::migration::Migration;
49
50pub use forge_core::testing;
51
52pub use forge_core::{
53 assert_err, assert_err_matches, assert_err_variant, assert_http_called, assert_http_not_called,
54 assert_job_dispatched, assert_job_not_dispatched, assert_ok, assert_workflow_not_started,
55 assert_workflow_started,
56};
57
58/// All internal FORGE schema SQL concatenated. Apply before user migrations in tests.
59pub fn get_internal_sql() -> String {
60 forge_runtime::pg::migration::get_all_system_sql()
61}
62
63pub use runtime::prelude;
64pub use runtime::{Forge, ForgeBuilder};