#routing #macro #axum #controller #applications #web-framework #handler

macro axum-folder-router

Helper macro for simple folder based routing of axum handlers

15 releases

0.3.9 Jun 4, 2025
0.3.8 Jun 2, 2025
0.3.6 Apr 17, 2025
0.2.3 Apr 14, 2025
0.1.0 Apr 14, 2025

#417 in Procedural macros

Download history 605/week @ 2025-04-13 60/week @ 2025-04-20 3/week @ 2025-04-27 28/week @ 2025-05-04 53/week @ 2025-05-11 71/week @ 2025-05-18 19/week @ 2025-05-25 345/week @ 2025-06-01 89/week @ 2025-06-08

533 downloads per month

MIT license

24KB
417 lines

Crates.io Documentation Maintenance License: MIT

axum-folder-router

#[folder_router(...)] is a procedural attribute macro for the Axum web framework that automatically generates router boilerplate based on your directory & file structure. Inspired by popular frameworks like next.js.

Features

  • File System-Based Routing: Define your API routes using intuitive folder structures
  • Reduced Boilerplate: Automatically generates route mapping code
  • IDE Support: Generates proper module imports for better rust-analyzer integration
  • Multiple Routers: Create separate folder-based routers in the same application

Usage

For detailed instructions see the examples or docs.rs.

License

This repository, is licensed permissively under the terms of the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.

Attribution

This macro is based on the build.rs template by @richardanaya

Dependencies

~2.4–4MB
~70K SLoC