2 releases

0.1.2 May 30, 2025
0.1.1 May 30, 2025

#6 in #static-file-serving

Download history 481/week @ 2026-01-15 344/week @ 2026-01-22 211/week @ 2026-01-29 215/week @ 2026-02-05 231/week @ 2026-02-12 401/week @ 2026-02-19 365/week @ 2026-02-26 362/week @ 2026-03-05 631/week @ 2026-03-12 732/week @ 2026-03-19 638/week @ 2026-03-26 575/week @ 2026-04-02 613/week @ 2026-04-09 462/week @ 2026-04-16 368/week @ 2026-04-23 514/week @ 2026-04-30

2,077 downloads per month

MIT license

24KB
323 lines

Rust Axum S3 Static

Easily serve S3 content from an Axum Route.

use axum::{Router, routing::get};
use axum_static_s3::S3OriginBuilder;

let s3_origin = S3OriginBuilder::new()
    .bucket("my-bucket")
    .prefix("deploy/")
    .max_size(1024 * 1024 * 12) // 12 MiB
    .build()

let Router = Router::new()
    .nest_service("/static", s3_origin)

Description

In modern webapp development, the back-end may be hosted on a local workstation during development, and a serverless compute environment during deployment. This crate makes it easy to serve S3 resources as a path in an Axum router.

Features

  • Serves static files from AWS S3
  • Compatible with API Gateway -> Lambda back-end, serving front-end resources from S3
    • Can specify response size limits for proper Payload Too Large responses if origin exceeds serverless compute response size
  • Built with Axum web framework
  • Efficient file handling (streams body)
  • Configurable through environment variables

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request or contact author directly.

Acknowledgments

Dependencies

~48MB
~676K SLoC