Expand description
§Bloom Framework
A lightweight backend framework that focuses on developer ergonomics by combining:
- Actix-Web for high‑performance HTTP
- SQLx (MySQL) for async, compile‑time checked database access
- Declarative macros to auto‑register controllers/routes, entities/migrations, and scheduled jobs
- Inventory-based discovery: drop in code, it self-registers
- Optional OpenAPI generation and Swagger UI via utoipa
- Simple, timestamped logging macro
- Config-first setup using a TOML file (config.toml)
§Quick Start
use bloom::prelude::*;
#[derive(Entity, Serialize, Deserialize)]
#[table("users")]
struct User {
#[id]
id: i32,
#[column("username")]
username: String,
#[column("email")]
email: String,
}
#[repository(User)]
pub struct UserRepository;
#[get_mapping("/users")]
pub async fn get_users() -> impl Responder {
HttpResponse::Ok().json("Hello from Bloom!")
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
bloom::application::run().await
}
Re-exports§
Modules§
- actix_
web - Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.
- anyhow
- github crates-io docs-rs
- application
- config
- controller_
registry - entity_
registry - log
- A lightweight logging facade.
- logger
- prelude
- Convenience module that re-exports the most commonly used items
- scheduler_
registry - serde
- Serde
- serde_
json - Serde JSON
- sqlx
- The async SQL toolkit for Rust, built with ❤️ by the LaunchBadge team.
- swagger_
registry - tokio
- A runtime for writing reliable network applications without compromising speed.
- web
- Essentials helper functions and types for application registration.
Macros§
Structs§
- Bloom
App - The main Bloom application that can be run to start the web server.
- Bloom
Application - Application builder for configuring and creating Bloom applications.
- Bloom
Config - Configuration settings for the Bloom application.
- Controller
- A controller registration entry provided by the #[controller] macro.
- Cors
Settings - Configuration settings for Cross-Origin Resource Sharing (CORS).
- Http
Response - An outgoing response.
- Migration
- A migration entry registered by each Entity derive.
- MySql
- MySQL database driver.
- Path
Operation - Registry for OpenAPI path operations with request schema detection.
- Scheduled
- A scheduled job registration entry provided by the #[scheduled] macro.
- Schema
Info - Registry for OpenAPI schemas.
- Server
Run - Settings
- Main application settings loaded from configuration file.
Traits§
- Deserialize
- A data structure that can be deserialized from any data format supported by Serde.
- Responder
- Trait implemented by types that can be converted to an HTTP response.
- Serialize
- A data structure that can be serialized into any data format supported by Serde.
Functions§
- _init
- Initializes the logger module to ensure proper compilation. This function ensures that the chrono dependency is properly linked even when the logger macro is not used directly in the code.
- configure_
all - Configures all registered controllers with the provided ServiceConfig.
- generate_
openapi - Generates OpenAPI document from collected inventory.
- run
- Creates a new ServerRun instance.
- run_all
- Runs all registered migrations in sequence.
- start_
all - Starts all registered scheduled jobs.
Type Aliases§
Attribute Macros§
- auto_
register - controller
- delete
- delete_
mapping - get
- get_
mapping - patch
- patch_
mapping - post
- post_
mapping - put
- put_
mapping - repository
- scheduled
Derive Macros§
- ApiSchema
- Deserialize
- Entity
- Derives Entity functionality for structs, generating database table creation and CRUD operations.
- Serialize