Expand description
§Axtra
Opinionated helpers for Axum + Astro projects.
§Features
- AppError: Unified error type for Axum APIs.
- Error Macros: Ergonomic error construction with
app_error!. - TypeScript Type Generation: Rust error types exported via
ts-rs. - Error Notifications: Pluggable notification system with Slack, Discord, ntfy, and cmdline.io support.
- Wrapped JSON Responses:
WrappedJson<T>andResponseKeyderive macro. - Health Check Endpoint: Built-in Axum route for Postgres connectivity.
- Static File Serving: SPA and static file helpers for Axum.
- Bouncer (optional): Reject and ban IP’s hitting invalid endpoints.
§Notification System
The notification system uses a trait-based architecture allowing you to:
- Use built-in providers (Slack, Discord, ntfy, cmdline.io)
- Create custom providers by implementing [
notifier::ErrorNotifier] - Configure via builder pattern or environment variables
ⓘ
use axtra::notifier::NotificationManager;
use axtra::errors::notifiers::init_notification_manager;
// Auto-configure from environment variables
init_notification_manager(NotificationManager::from_env());
// Or use builder pattern
let manager = NotificationManager::builder()
.with_slack("https://hooks.slack.com/...")
.build();
init_notification_manager(manager);§See Also
Modules§
Macros§
- app_
error - Error macro - handles all error types with optional format
- error_
location - Macro to get the current module and line location.
Usage:
error_location!("something went wrong: {}", detail)