Installation
Install Rapina and create your first API
Start Here
Four commands from zero to running API:
cargo install rapina-cli
rapina new my-app
cd my-app
rapina devYour API is now running at http://127.0.0.1:3000.
Try It
Hit the default endpoints:
curl http://127.0.0.1:3000/{"message": "Hello from Rapina!"}curl http://127.0.0.1:3000/__rapina/health{"status": "ok"}The health endpoint is enabled by .with_health_check(true) in main.rs. See Health Checks for database and custom checks.
Check what routes are available:
rapina routesGET / [public]What the CLI Created
The rapina new command scaffolded a complete project for you. See Project Structure for a full walkthrough of what each file does.
Prerequisites
Rapina is a Rust framework. If you don't have Rust installed yet, it takes about a minute.
Installing Rust
Install through rustup, the official Rust toolchain installer:
macOS / Linux:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shAfter installation, restart your terminal or run:
source $HOME/.cargo/envWindows:
Download and run rustup-init.exe from the official website, or use winget:
winget install Rustlang.RustupVerify Installation
rustc --version
cargo --versionYou should see version numbers for both. Rapina requires Rust 1.75 or later.
Platform Notes
macOS: Works out of the box. Xcode Command Line Tools will be installed automatically if needed.
Linux: You may need build essentials. On Ubuntu/Debian:
sudo apt install build-essential pkg-config libssl-devOn Fedora:
sudo dnf install gcc pkg-config openssl-develWindows: Visual Studio Build Tools are required. The rustup installer will guide you through this — select the "Desktop development with C++" workload.
Manual Setup
If you prefer not to use the CLI, add Rapina to an existing project:
[dependencies]
rapina = "0.10.0"
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }Then write your entry point:
use rapina::prelude::*;
#[derive(Serialize, JsonSchema)]
struct MessageResponse {
message: String,
}
#[public]
#[get("/")]
async fn hello() -> Json<MessageResponse> {
Json(MessageResponse {
message: "Hello from Rapina!".into(),
})
}
#[tokio::main]
async fn main() -> std::io::Result<()> {
Rapina::new()
.discover()
.listen("127.0.0.1:3000")
.await
}