Getting Started
Get up and running with Ultimo in minutes.
Installation
Add Ultimo to your Cargo.toml:
[dependencies]
ultimo = "0.1.2"
tokio = { version = "1.35", features = ["full"] }
serde = { version = "1.0", features = ["derive"] }Or install directly with cargo:
cargo add ultimo tokio serde
cargo add tokio --features full
cargo add serde --features deriveHello Ultimo
Create a simple API server:
use ultimo::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Serialize)]
struct Message {
text: String,
}
#[tokio::main]
async fn main() -> ultimo::Result<()> {
let mut app = Ultimo::new();
app.get("/", |ctx: Context| async move {
ctx.json(Message {
text: "Hello, Ultimo!".to_string(),
}).await
});
println!("🚀 Server running on http://127.0.0.1:3000");
app.listen("127.0.0.1:3000").await
}Run Your Server
cargo runTest it:
curl http://localhost:3000/
# {"text":"Hello, Ultimo!"}Next Steps
- Learn about Routing and path parameters
- Explore RPC for type-safe APIs
- Add Middleware for logging and CORS
- Generate TypeScript Clients automatically
- Create OpenAPI Specs for documentation
Project Structure
A typical Ultimo project looks like:
my-app/
├── Cargo.toml
├── src/
│ ├── main.rs # Application entry point
│ ├── handlers/ # Request handlers
│ ├── models/ # Data models
│ └── rpc/ # RPC procedures
└── frontend/
└── src/
└── lib/
└── client.ts # Auto-generated TypeScript client