Skip to main content

Crate shared_framework

Crate shared_framework 

Source
Expand description

Reusable building blocks for HTTP services: routing and controllers on Hyper, a SeaORM data layer with repositories and explicit relation hydration, request validation, live OpenAPI 3.1 docs with a bundled Swagger UI, background jobs, RabbitMQ consumers, Redis/in-memory caching, and resilience helpers (retries, circuit breakers, rate limiting).

Start with AppEnvironment + ConfigurationRegistrant for a single controller, or app::GenericStartup to boot a whole service. See README.md for a guided tour. Keep every public item documented.

Re-exports§

pub use data::seed::entity as seeder_entity;
pub use data::seed::DatabaseSeeder;
pub use data::seed::DatabaseSeederRunner;
pub use config::ConfigurationRegistrant;
pub use env::AppEnvironment;
pub use response::ErrorResult;
pub use response::ServiceResult;
pub use response::TypedServiceResult;
pub use data::BaseEntity;
pub use data::BaseAuditableEntity;
pub use basilisk_rust_client as basilisk;

Modules§

app
Application startup and service wiring.
config
HTTP routing and server bootstrap.
controller
HTTP routing and controllers built on Hyper.
data
Data persistence layer built on SeaORM 2.
doc
Documentation registry and OpenAPI 3.1 specification generator.
env
Process-wide service configuration loaded from dotenv files and the environment.
gateway
Basilisk gateway registration and service-bus connection.
job
Background jobs: periodic tasks, daily schedules, or both.
logging
Logging and per-request correlation.
middleware
Request middlewares: reusable pre-handler hooks for the router.
monitoring
Log monitoring events and sinks.
queue
RabbitMQ messaging over lapin: durable queues with optional retry and dead-letter queues.
response
Typed HTTP responses: success payloads, errors, and content types.
retry
Exponential-backoff retry for async operations.
service
Selectable service providers guarded by per-provider circuit breakers.
types
Shared value types.
utils
Utility helpers.
validation
DTO validation.

Macros§

active_enum
A macro to define an enum that can be used as a SeaORM ActiveEnum with string values. This is done this way precisely because SeaORM does not support enums with string values out of the box, and this macro provides a convenient way to define such enums with the necessary traits and methods for working with them in a SeaORM context.