| Crates.io | rvy |
| lib.rs | rvy |
| version | 0.1.2 |
| created_at | 2025-12-18 09:28:11.601012+00 |
| updated_at | 2025-12-24 08:18:53.246037+00 |
| description | A modular Rust CLI framework for generating services, tools, and project scaffolds. |
| homepage | https://github.com/reverny/rvy |
| repository | https://github.com/reverny/rvy |
| max_upload_size | |
| id | 1992027 |
| size | 75,134 |
A powerful CLI tool for scaffolding production-ready Rust projects with Clean Architecture, REST APIs, OpenAPI/Swagger documentation, and multiple database support.
cargo install rvy
git clone https://github.com/rvy-reverny/rvy.git
cd rvy
cargo install --path .
rvy --help
rvy new project my_app
This creates a new project with the following structure:
my_app/
โโโ Cargo.toml
โโโ src/
โ โโโ main.rs
โ โโโ service/
โ โโโ usecase/
โ โโโ repository/
โ โโโ data/
# Generate complete entity with all layers, database adapters, and REST API
rvy new-all user
This generates:
src/service/user_service.rssrc/usecase/user_usecase.rssrc/repository/user.rssrc/data/user_data.rssrc/handler/user_handler.rs with OpenAPI annotationssrc/adapter/user_{postgres,mysql,mongodb,sqlite}.rssrc/factory/user_factory.rssrc/config/database.rsexamples/user_example.rs and docs/user_USAGE.mdmain.rs with routes and Swagger UI# Generate specific layers
rvy gen service user
rvy gen usecase user
rvy gen repository user
rvy gen data user
# Generate REST API handler with OpenAPI docs
rvy gen handler user
# Generate database adapters
rvy gen adapter user
# Generate factory for runtime DB selection
rvy gen factory user
rvy new project my_api
cd my_api
rvy new-all product
Create a .env file:
DATABASE_URL=postgres://user:password@localhost:5432/mydb
# Or use other databases:
# DATABASE_URL=mysql://user:password@localhost:3306/mydb
# DATABASE_URL=sqlite://data.db
# DATABASE_URL=mongodb://localhost:27017/mydb
cargo run
Open your browser: http://127.0.0.1:3000/swagger-ui
You'll see:
my_api/
โโโ Cargo.toml
โโโ .env
โโโ src/
โ โโโ main.rs # Auto-configured with routes & Swagger
โ โโโ lib.rs
โ โโโ service/ # Business logic
โ โ โโโ mod.rs
โ โ โโโ product_service.rs
โ โโโ usecase/ # Application use cases
โ โ โโโ mod.rs
โ โ โโโ product_usecase.rs
โ โโโ repository/ # Data access traits
โ โ โโโ mod.rs
โ โ โโโ product.rs
โ โโโ data/ # DTOs with OpenAPI schemas
โ โ โโโ mod.rs
โ โ โโโ product_data.rs
โ โโโ handler/ # REST API with OpenAPI annotations
โ โ โโโ mod.rs
โ โ โโโ product_handler.rs
โ โโโ adapter/ # Database implementations
โ โ โโโ mod.rs
โ โ โโโ product_postgres.rs
โ โ โโโ product_mysql.rs
โ โ โโโ product_mongodb.rs
โ โ โโโ product_sqlite.rs
โ โโโ factory/ # Runtime DB selection
โ โ โโโ mod.rs
โ โ โโโ product_factory.rs
โ โโโ config/
โ โโโ mod.rs
โ โโโ database.rs # DB configuration
โโโ examples/
โ โโโ product_example.rs
โโโ docs/
โโโ product_USAGE.md
--dry-run: Preview what will be generated without writing files--force: Overwrite existing files# Preview generation
rvy new-all user --dry-run
# Force overwrite existing files
rvy gen handler user --force
# Generate multiple entities
rvy new-all product
rvy new-all user
rvy new-all order
RVY follows Clean Architecture principles with clear separation of concerns:
Handler (REST API)
โ
Service (Business Logic)
โ
Usecase (Application Logic)
โ
Repository (Data Access Interface)
โ
Adapter (Database Implementation)
โ
Database (PostgreSQL/MySQL/SQLite/MongoDB)
Generated APIs include:
GET /{entity}s - Get all recordsGET /{entity}s/{id} - Get record by IDPOST /{entity}s - Create new recordPUT /{entity}s/{id} - Update recordDELETE /{entity}s/{id} - Delete record| Database | Connection String Example |
|---|---|
| PostgreSQL | postgres://user:pass@localhost:5432/db |
| MySQL | mysql://user:pass@localhost:3306/db |
| SQLite | sqlite://data.db |
| MongoDB | mongodb://localhost:27017/db |
The database adapter is selected at runtime based on the DATABASE_URL environment variable. No need to recompile for different databases!
// Automatically detected from DATABASE_URL
let config = DatabaseConfig::from_env();
let repository = create_product_repository(&config).await?;
All generated endpoints include Bearer token authentication:
#[utoipa::path(
get,
path = "/products",
responses(/* ... */),
security(("bearer_auth" = [])) // ๐ Requires authentication
)]
To test with Swagger UI:
Bearer your-token-hereContributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)This project is licensed under the MIT License - see the LICENSE file for details.
Made with ๐ฆ Rust