11 releases
Uses new Rust 2024
| new 0.3.5 | Mar 20, 2026 |
|---|---|
| 0.3.4 | Mar 17, 2026 |
| 0.2.4 | Mar 14, 2026 |
| 0.1.1 | Mar 7, 2026 |
| 0.1.0 | Jan 8, 2025 |
#1198 in Database interfaces
190 downloads per month
145KB
2.5K
SLoC
For development rules, see DEVELOPMENT.md
mae
Opinionated async Rust framework for building Mae-Technologies micro-services.
Features
- App scaffolding —
app::build,app::configuration,app::run: opinionated Actix-Web server setup with session middleware, tracing, and Redis - Repository layer —
repo: typed async CRUD helpers over SQLx/Postgres - Middleware —
middleware: session extraction, service-to-service auth, request context injection - Telemetry —
telemetry: structured JSON logging viatracing-bunyan-formatter - Test utilities (
test-utilsfeature) — TestContainer helpers for Postgres, Neo4j, Redis, RabbitMQ;must::*assertion helpers; env helpers
Usage
Add to Cargo.toml:
[dependencies]
mae = "0.1"
For test utilities:
[dev-dependencies]
mae = { version = "0.1", features = ["test-utils"] }
Postgres test helper modes (test-utils)
Postgres test helpers support two modes:
- Container mode (
MAE_TESTCONTAINERS=1): startsghcr.io/mae-technologies/postgres-maevia testcontainers (existing behavior). - Fallback mode (default when
MAE_TESTCONTAINERSis unset/false): connects to an already-running Postgres.
Fallback mode uses safe defaults and allows env overrides:
MAE_TEST_PG_HOST(default127.0.0.1)MAE_TEST_PG_PORT(default5432)MAE_TEST_PG_DB(defaultmae_test)MAE_TEST_PG_USER(defaultapp)MAE_TEST_PG_PASSWORD(defaultsecret)MAE_TEST_PG_MIGRATOR_USER(defaultdb_migrator)MAE_TEST_PG_MIGRATOR_PASSWORD(defaultmigrator_secret)MAE_TEST_PG_SEARCH_PATH(defaultoptions=-csearch_path%3Dapp)
spawn_scoped_schema() and shared pool setup work in both modes.
For safety, fallback mode refuses database names that do not include _test.
License
MIT
test-utils quickstart
use mae::testing::{context::TestContext, must::Must};
use mae_macros::mae_test;
#[mae_test(docker, teardown = mae::testing::containers::teardown_all)]
async fn integration_test_insert_vendor() {
let ctx = TestContext::<()>::new().await.must();
// run queries against ctx.pool, namespaced by ctx.schema as needed
ctx.teardown().await.must();
}
Dependencies
~104MB
~2M SLoC