Skip to main content

Module prelude

Module prelude 

Source
Expand description

Common imports for Forge applications.

Stability contract: all pub use items here are part of Forge’s stable surface. Removing or renaming an item is a breaking change.

Upstream crates: axum is re-exported so custom_routes factories compile against the same version the runtime uses. A breaking axum change requires a Forge minor or major bump.

Re-exports§

pub use crate::Forge;
pub use crate::ForgeBuilder;
pub use serde_json;
pub use axum;

Structs§

AuthContext
Authentication context available to all functions.
CronContext
Context available to cron handlers.
DaemonContext
Context available to daemon handlers.
DateTime
ISO 8601 combined date and time with time zone.
Delta
Delta format for subscription updates.
ForgeConfig
Root configuration. Loaded from forge.toml with ${ENV_VAR} / ${VAR-default} substitution. Only database.url is required.
JobContext
Context available to job handlers.
McpToolContext
Context for MCP tool execution.
MutationContext
Context for mutation functions (transactional database access).
QueryContext
Context for query functions (read-only database access).
TestCronContext
Test context for cron functions.
TestDaemonContext
Test context for daemon functions.
TestJobContext
Test context for job functions.
TestMcpToolContext
Test context for MCP tool functions.
TestMutationContext
Test context for mutation functions with mock dispatch and optional DB access.
TestQueryContext
Test context for query functions with optional DB access.
TestWebhookContext
Test context for webhook functions.
TestWorkflowContext
Test context for workflow functions.
TokenPair
An access token + refresh token pair.
Upload
A file upload from a multipart form.
Utc
The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).
Uuid
A Universally Unique Identifier (UUID).
WebhookContext
Context available to webhook handlers.
WebhookSignature
Helper for constructing signature configurations.
WorkflowContext
Context available to workflow handlers.

Enums§

DbConn
Abstraction over pool and transaction connections.
ForgeError
Core error type mapping variants to HTTP status codes.
JobPriority
Value
Represents any valid JSON value.
WebhookResult

Traits§

Deserialize
A data structure that can be deserialized from any data format supported by Serde.
EnvAccess
Extension methods for environment variable access on contexts.
ForgeCron
Trait for scheduled cron handlers.
ForgeDaemon
Trait for long-running daemon handlers.
ForgeJob
Trait for background job handlers.
ForgeMcpTool
Trait implemented by all MCP tools.
ForgeMutation
A transactional write function.
ForgeQuery
A read-only, cacheable, subscribable query function.
ForgeWebhook
Trait for inbound webhook handlers.
ForgeWorkflow
Trait for durable workflow handlers.
JsonSchema
A type which can be described as a JSON Schema document.
Serialize
A data structure that can be serialized into any data format supported by Serde.

Type Aliases§

Result
Result type alias using ForgeError.
Timestamp

Derive Macros§

Deserialize
JsonSchema
Serialize