百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

rustfulapi

> 数据库
开源

在 Rust 中构建 REST Web 服务的可重复使用模板。使用 Axum HTTP Web 框架和 SeaORM

197 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

在 Rust 中构建 REST Web 服务的可重复使用模板。使用 Axum HTTP Web 框架和 SeaORM

RUSTfulapi

Reusable template for building REST Web Services in Rust. Uses Axum HTTP web framework and SeaORM ORM and PostgreSQL.

System Requirements

  • rust
  • docker
  • docker-compose

Required Docker Services

  • postgres
  • redis
  • mailhog
  • mockserver
  • pgAdmin

How to use this template

To use this template as your project starting point, click "Use this template" at the top of this page, or click here.

Feature highlights

  • Authentication. Based on jsonwebtoken
  • Layered configuration. Based on config-rs
  • Logs. Based on tracing
  • OpenAPI documentation utoipa
  • Error handling
  • Pagination
  • Profile base
  • E2E Tests
  • Postgres admin pgAdmin
  • CI based on Github actions
  • Sentry error tracking
  • Nginx as reverse proxy and secure connections with SSL certificates Nginx
  • Dependabot configuration

Running locally

bash
./run
# open swagger panel
xdg-open http://127.0.0.1:8080/swagger-ui/
# manually testing your API routes with curl commands
curl -X GET http://127.0.0.1:8080/api/v1/server/health_check

Running via docker

bash
cd ./docker/dev/ && ./up.sh

Running tests

Some of the integration tests use Docker to spin up dependencies on demand (e.g., a postgres db),so please ensure Docker is installed before running the tests.

./test.sh

Configuration

This project uses config-rs to manage configuration.

Configure with toml files

bash
settings
├── base.toml # default config file 
├── dev.toml # development config file 
├── prod.toml # production config file
└── test.toml # test config file

Configure with environment variables

bash
export PROD_APP__SERVER__PORT=8080
export PROD_APP__SERVER__ADDR=127.0.0.1

Switching profiles

Before running the application, export this variable:

bash
export APP_PROFILE=prod # Switch to production profile

Check code formatting and typo at commit time

cp ./scripts/git-hooks/* ./.git/hooks/

Migrate database

cargo run --bin migration -- up -u $DATABASE_URL

Update ERD (Entity-Relationship Diagram) use planter

bash
planter postgres://username:password@localhost:5432/database_name\?sslmode=disable -o docs/schema.puml

Run tests

bash
# Execute all test projects.
./test

License

Licensed under either of

  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

Contributing

Contributors are welcome! please fork and send pull requests, If you find a bug or have any ideas on how to improve this project please submit an issue.

See CONTRIBUTING.md.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustapiaxumjwtpostgres

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库