Skip to main content

Crate footing

Crate footing 

Source
Expand description

Shared Rust service foundation for application backends.

footing is intentionally small and feature-gated. It collects reusable infrastructure concerns such as principal authorization, password storage, pagination, HTTP request context, RFC 9457 problem responses, database pool configuration, and tracing setup without depending on an application’s domain model.

§Feature layout

No features are enabled by default. Enable only the capabilities needed by your application; feature dependencies are enabled automatically.

For example, http-stack already includes http and http-metrics; password-tokio includes password and auth. Features make APIs available; applications explicitly install middleware, start workers, and initialize logs.

§HTTP

FeatureCapability and automatically enabled features
httpAxum request context, trusted proxies, safe extractors, problem responses, security headers, and endpoint contracts; enables auth and net.
http-metricsIndependent HTTP metrics, optional response-body observations, and Prometheus/OpenMetrics responses; enables http and observability.
http-stackMiddleware assembly, CORS, timeouts, concurrency, rate limiting, idempotency, metrics, and health responses; enables http-metrics, pagination, and settings.
http-cookieValidated cookie policies, credential reads, and issuance/removal; enables http, settings, and secrets.
http-localeExplicit language negotiation and response headers; enables http.
http-staticFilesystem-backed static sites and SPA fallback; enables http.
http-clientReqx TLS trust integration; enables tls, independently of http. Applications declare Reqx and explicitly select its TLS backend.
paginationCursor and offset pagination; HTTP extractors are available with http.
openapiSchemas, documented routes, and documentation pages; enables http. Renderer and asset source are selected explicitly.
redoc-embedded, rapidoc-embeddedBundled documentation assets; each enables openapi.

§Authentication and cryptography

FeatureCapability and automatically enabled features
authPrincipals, roles, scopes, permission guards, and explicit new-password admission checks; no password hashing or async runtime.
passwordArgon2id password storage and verification; enables auth. Admission rules remain an explicit, separate call.
password-commonBundled common-password list for explicit use by PasswordPolicy; enables auth, without Argon2 or Tokio.
password-tokioBounded Tokio scheduling for password work; enables password and secrets.
cryptoSecure tokens and cryptographic helpers; enables secrets.

§Storage

FeatureCapability and automatically enabled features
postgresSQLx PostgreSQL pools and startup helpers; enables settings and secrets.
postgres-adminDestructive PostgreSQL administration; enables postgres.
sqliteSQLx SQLite pools and startup helpers; enables settings.
presence-postgresShared heartbeat-based online user queries; enables postgres and time.
presence-sqliteOnline user queries in a local SQLite database; enables sqlite and time.

§Runtime and observability

FeatureCapability and automatically enabled features
runtimeOrdered application lifecycle orchestration.
workerBackground workers, leases, and outbox primitives; enables settings and observability.
eventIn-process domain event dispatch and hooks.
diagnosticsStartup resource probes and readiness diagnostics.
observabilityMetrics, health reports, structured event values, and trace identifiers; no log subscriber or timestamp formatter.
loggingLog formatting, filters, and explicit subscriber initialization in footing::logging; independent of observability.
testkitFixtures and test assertions; enables http and worker. Intended for development dependencies.

§Shared primitives and integrations

FeatureCapability
serdeSerialization support for the always-available result types. Enabled by higher-level capabilities as needed.
settingsHuman-readable durations and component settings validation.
tierTier configuration metadata and validation adapters; enables settings.
timeUTC wall-clock abstractions using the time crate.
netIP network parsing and matching.
secretsRedacted secret values and secret sources.
tlsTLS trust configuration and certificate loading, independently of HTTP clients and crypto providers.

§Examples

Principal checks:

use footing::auth::{Principal, PrincipalRequirement};

let principal = Principal::user("usr_01")
    .unwrap()
    .with_scopes(["users:*"])
    .unwrap();
PrincipalRequirement::scope("users:read")
    .unwrap()
    .check(&principal)
    .unwrap();

Password hashing:

use footing::auth::PasswordService;

let service = PasswordService::new();
let hash = service.hash_password("correct horse battery staple").unwrap();
let verification = service
    .verify_and_assess("correct horse battery staple", &hash)
    .unwrap();

assert!(verification.verified());
assert!(!verification.needs_rehash());

Modules§

authauth
Authentication and authorization primitives.
clock
Clock abstraction for runtime code and deterministic tests.
cryptocrypto
Small cryptographic building blocks for application glue code.
dbpostgres or sqlite
SQLx database integrations separated by backend-specific semantics.
diagnosticsdiagnostics
Startup and readiness diagnostics for service resources.
eventevent
In-process domain event dispatch.
httphttp
HTTP helpers for Axum services.
logginglogging
Application-owned log formatting, filtering, and subscriber initialization.
netnet
Network primitives shared by service configuration and transports.
observabilityobservability
Structured event values, trace identifiers, health reporting, and metrics.
paginationpagination
Pagination primitives for service APIs.
presencepresence-postgres or presence-sqlite
Shared online user queries based on recent authenticated heartbeats.
result
Lightweight result aliases and stable error classification.
runtimeruntime
Explicit application lifecycle orchestration.
secretsecrets
Secret and redaction primitives.
settingssettings
Settings primitives shared by Footing components.
testkittestkit
Fixtures, HTTP helpers, and collection assertions for tests.
tlstls
Outbound TLS trust configuration.
workerworker
Small worker runtime primitives.

Macros§

openapi_routehttp and openapi
Collects a handler’s route and schemas from its utoipa::path annotation.