Rn
[氡-Rn] Rust Web开发脚手架
Install / Use
/learn @noble-gase/RnREADME
氡-Rn
<img alt="crates.io" src="https://img.shields.io/crates/v/rnx.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20"> <img alt="MIT" src="http://img.shields.io/badge/license-MIT-brightgreen.svg?style=for-the-badge" height="20">
[氡-Rn] Rust Web开发脚手架,支持 salvo 和 axum 框架,并支持「单应用」和「多应用」模式
安装
cargo install rnx
特点
- DB使用 sqlx
- Redis使用 redis-rs
- 日志使用 tracing
- 配置使用 config-rs
- 命令行使用 clap
- 异步运行时使用 tokio
- 参数验证器使用 validator
- 支持 Prometheus Metrics 和 Request 中间件
- 包含 TraceId、认证、请求日志、Panic捕获 中间件
- 简单好用的 API Result 统一输出方式
创建项目
单应用
# salvo
rnx new # 在当前目录初始化项目
rnx new --name demo # 创建demo项目
# axum
rnx new --axum # 在当前目录初始化项目
rnx new --name demo --axum # 创建demo项目
.
├── Cargo.toml
├── Dockerfile
├── app/
│ ├── Cargo.toml
│ ├── config.toml
│ └── src/
│ ├── cmd/
│ ├── handler/
│ ├── middleware/
│ ├── router/
│ ├── service/
│ └── main.rs
├── infra/
│ ├── Cargo.toml
│ └── src/
│ ├── core/
│ ├── middleware/
│ ├── status/
│ ├── util/
│ └── lib.rs
└── repo/
├── Cargo.toml
└── src/
├── dao/
├── schema/
└── lib.rs
多应用
# salvo
rnx new --app foo --app bar # 在当前目录初始化项目
rnx new --name demo --app foo --app bar # 创建demo项目
# axum
rnx new --app foo --app bar --axum # 在当前目录初始化项目
rnx new --name demo --app foo --app bar --axum # 创建demo项目
.
├── Cargo.toml
├── Dockerfile.foo
├── Dockerfile.bar
├── app/
│ ├── foo/
│ │ ├── Cargo.toml
│ │ ├── config.toml
│ │ └── src/
│ │ ├── cmd/
│ │ ├── handler/
│ │ ├── middleware/
│ │ ├── router/
│ │ ├── service/
│ │ └── main.rs
│ └── bar/
│ ├── Cargo.toml
│ ├── config.toml
│ └── src/
│ ├── ...
│ └── main.rs
├── infra/
│ ├── Cargo.toml
│ └── src/
│ ├── core/
│ ├── middleware/
│ ├── status/
│ ├── util/
│ └── lib.rs
└── repo/
├── Cargo.toml
└── src/
├── dao/
├── schema/
└── lib.rs
创建应用
多应用项目适用,需在项目根目录执行(即:
Cargo.toml所在目录)
# salvo
rnx app --name foo --name bar
# axum
rnx app --name foo --name bar --axum
.
├── Cargo.toml
├── Dockerfile.foo
├── Dockerfile.bar
├── app/
│ ├── foo/
│ │ ├── Cargo.toml
│ │ ├── config.toml
│ │ └── src/
│ │ ├── cmd/
│ │ ├── handler/
│ │ ├── middleware/
│ │ ├── router/
│ │ ├── service/
│ │ └── main.rs
│ └── bar/
│ ├── Cargo.toml
│ ├── config.toml
│ └── src/
│ ├── ...
│ └── main.rs
├── infra/
│ ├── Cargo.toml
│ └── src/
│ ├── ...
│ └── lib.rs
└── repo/
├── Cargo.toml
└── src/
├── ...
└── lib.rs
Enjoy 😊
Related Skills
gh-issues
347.0kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
himalaya
347.0kCLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
oracle
347.0kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
