关于 axum-rust-template
用于构建 Rust API 的 Axum 模板,适合采用 PostgreSQL 的开发项目。它结合 Diesel ORM 与 DDD 架构,并提供构建、数据库迁移和运行的基本步骤。
主要功能
- 01基于 Axum 构建 API
- 02使用 Rust 与 Diesel ORM
- 03采用 DDD 架构
- 04配置 PostgreSQL 数据库
适用场景
- 01启动 Rust API 项目
- 02创建使用 Diesel 的服务
- 03为 PostgreSQL 项目设置基础结构
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ rebyteai-template/ rebyte-skills --skill axum-rust-template安装后在 Claude Code 中输入/axum-rust-template确认已加载。
详细介绍
Axum Rust API
采用 Diesel ORM 和 DDD 架构的 Rust Axum API。
技术栈
- 框架:Axum
- 语言:Rust
- ORM:Diesel
- 架构:DDD
- 数据库:PostgreSQL
前置条件
- 已安装 Rust 工具链
- PostgreSQL
设置
1. 克隆模板
git clone --depth 1 https://github.com/Eng0AI/axum-rust-template.git .
如果目录不为空:
git clone --depth 1 https://github.com/Eng0AI/axum-rust-template.git _temp_template
mv _temp_template/* _temp_template/.* . 2>/dev/null || true
rm -rf _temp_template
2. 移除 Git 历史记录(可选)
rm -rf .git
git init
3. 构建项目
cargo build
4. 设置数据库
配置数据库并运行 Diesel 迁移。
开发
cargo run
评论
支持 Markdown