### Install and Run Frontend Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/react-app-rest/README.md Install dependencies and start the development server on port 5173. ```bash # Install dependencies npm install # Start development server (runs on port 5173) npm run dev ``` -------------------------------- ### Install Fly CLI and Authenticate Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/deployment/fly-io.mdx Initial setup commands to install the Fly CLI and log into your account. ```bash # Install the Fly CLI curl -L https://fly.io/install.sh | sh # Sign up / login fly auth login ``` -------------------------------- ### Start RPC Client Example Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/REACT_EXAMPLES.md Commands to initialize and run the RPC-based React frontend and its corresponding backend. ```bash # Terminal 1: Start RPC backend cargo run --bin rpc-server # Terminal 2: Start React frontend cd examples/react-app-rpc npm install npm run dev ``` -------------------------------- ### Start the React Frontend Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/react-app/README.md Commands to install dependencies and launch the development server for the React application. ```bash cd examples/react-app npm install npm run dev ``` -------------------------------- ### Setup Development Environment Source: https://github.com/ultimo-rs/ultimo/blob/main/CONTRIBUTING.md Commands to clone the repository, install git hooks, build the project, and run tests. ```bash # Clone the repository git clone https://github.com/ultimo-rs/ultimo.git cd ultimo # Install git hooks (recommended) ./scripts/install-hooks.sh # Build the project cargo build # Run tests cargo test # Check coverage cargo coverage ``` -------------------------------- ### Setup Virtual Environment and Dependencies Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/benchmark/fastapi-server/README.md Commands to initialize a virtual environment and install required project dependencies. ```bash # Create virtual environment python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate # Install dependencies pip install -r requirements.txt ``` -------------------------------- ### Start REST API Example Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/REACT_EXAMPLES.md Commands to initialize and run the REST-based React frontend and its corresponding backend. ```bash # Terminal 1: Start REST backend cargo run --bin rest-server # Terminal 2: Start React frontend cd examples/react-app-rest npm install npm run dev ``` -------------------------------- ### Run Examples Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/MOONREPO.md Build or test project examples. ```bash # Build all examples moon run examples/*:build # Run specific example moon run database-sqlx:run # Test example moon run rpc-modes:test ``` -------------------------------- ### Local Development Commands Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/DEPLOYMENT.md Commands to install dependencies and start the development server for the documentation site. ```bash cd docs-site pnpm install pnpm dev ``` -------------------------------- ### Start Hono Server (Node.js) Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/benchmark/BENCHMARK.md Commands to install dependencies and start the Hono server using Node.js. ```bash cd hono-server npm install npm start ``` -------------------------------- ### Start Hono Server (Bun) Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/benchmark/BENCHMARK.md Commands to install dependencies and start the Hono server using the Bun runtime. ```bash cd hono-server bun install bun run start:bun ``` -------------------------------- ### Run Example Projects Source: https://github.com/ultimo-rs/ultimo/blob/main/README.md Executes a specific example project from the repository using cargo. ```bash cargo run -p jwt-auth-example ``` -------------------------------- ### Install Moonrepo Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/MOONREPO.md Use the official installation script to set up Moonrepo. ```bash curl -fsSL https://moonrepo.dev/install/moon.sh | bash ``` -------------------------------- ### Run Diesel example project Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/diesel.mdx Commands to navigate to the example directory and execute the application with a database URL. ```bash cd examples/database-diesel DATABASE_URL=postgres://postgres:postgres@localhost/ultimo_test cargo run ``` -------------------------------- ### Run SQLx database example Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/sqlx.mdx Commands to navigate to the SQLx example directory and execute it with a specified database URL. ```bash cd examples/database-sqlx DATABASE_URL=postgres://postgres:postgres@localhost/ultimo_test cargo run ``` -------------------------------- ### Start the Backend Server Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/react-app-rest/README.md Run the REST server from the project root before starting the frontend. ```bash cd ../../ cargo run --bin rest-server ``` -------------------------------- ### Diesel CLI Setup Commands Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/database-diesel/README.md Commands to install the Diesel CLI and initialize the database environment. ```bash # Install Diesel CLI cargo install diesel_cli --no-default-features --features postgres # Setup diesel diesel setup # Create migration diesel migration generate create_users # Run migrations diesel migration run ``` -------------------------------- ### Define SSE example dependencies Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/superpowers/plans/2026-08-16-typed-sse.md Configure the Cargo.toml for the SSE example crate. ```toml [package] name = "sse-example" version = "0.1.0" edition = "2021" publish = false [dependencies] ultimo = { path = "../../ultimo" } tokio = { version = "1", features = ["full"] } futures-util = "0.3" serde_json = "1" ``` -------------------------------- ### Start FastAPI server Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/benchmark/README.md Sets up a virtual environment and starts the FastAPI server on port 3003. ```bash cd fastapi-server python3 -m venv venv source venv/bin/activate pip install -r requirements.txt python server.py # Server runs on http://localhost:3003 ``` -------------------------------- ### Start HTTP Server Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/api-reference.mdx Bind the application to a specific address and start the server. ```rust app.listen("127.0.0.1:3000").await?; ``` -------------------------------- ### Run the WebSocket Chat Example Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/websocket-chat/README.md Commands to execute the chat application from the project root or the example directory. ```bash # From the project root cargo run -p websocket-chat # Or from the example directory cd examples/websocket-chat cargo run ``` -------------------------------- ### Install and Scaffold with Ultimo CLI Source: https://github.com/ultimo-rs/ultimo/blob/main/README.md Commands to install the CLI binary and initialize a new project or generate a TypeScript client. ```bash cargo install ultimo-cli # installs the `ultimo` binary ultimo new my-app --template fullstack # scaffold a new project ultimo generate --project ./backend --output ./client # generate the TypeScript client ``` -------------------------------- ### Database Connection Setup Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/database-sqlx/README.md Initialize the SQLx pool and attach it to the application. ```rust let pool = SqlxPool::connect(&database_url).await?; app.with_sqlx(pool); ``` -------------------------------- ### Install Ultimo CLI Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/cli.mdx Methods for installing the CLI tool via Cargo or the provided installation script. ```bash cargo install --path ultimo-cli ``` ```bash ./install-cli.sh ``` -------------------------------- ### Run Simple Chat Example Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/websocket.mdx Executes the basic HTML/JS chat application example. ```bash cargo run -p websocket-chat ``` -------------------------------- ### Commit Documentation and Examples Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/superpowers/plans/2026-08-16-typed-sse.md Git command to commit the newly created documentation and SSE example files. ```bash git add docs-site/docs/pages/api-reference.mdx docs-site/docs/pages/sse.mdx docs-site/vocs.config.ts docs-site/docs/pages/roadmap.mdx README.md examples/sse Cargo.toml git commit -m "docs: Server-Sent Events (api-reference, guide, roadmap, README, example)" ``` -------------------------------- ### Start the Benchmark Server Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/benchmark/fastapi-server/README.md Command to launch the FastAPI server on the default port. ```bash python server.py ``` -------------------------------- ### Run React Chat Example Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/websocket.mdx Executes the React and TypeScript chat application example. ```bash cargo run -p websocket-chat-react ``` -------------------------------- ### Commit streaming documentation and examples Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/superpowers/plans/2026-08-16-streaming-responses.md Git command to stage documentation and example files for the streaming feature. ```bash git add docs-site/docs/pages/api-reference.mdx docs-site/docs/pages/streaming.mdx docs-site/vocs.config.ts docs-site/docs/pages/roadmap.mdx README.md examples/streaming Cargo.toml git commit -m "docs: streaming responses (api-reference, guide, roadmap, README, example)" ``` -------------------------------- ### Manage Documentation Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/MOONREPO.md Commands for installing, developing, building, and previewing the documentation site. ```bash # Install dependencies moon run docs-site:install # Start dev server moon run docs-site:dev # Build docs moon run docs-site:build # Preview built docs moon run docs-site:preview ``` -------------------------------- ### Complete OpenAPI Integration Example Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/openapi.mdx A full example demonstrating the registration of multiple queries and mutations with complex TypeScript type definitions, followed by OpenAPI generation within a tokio runtime. ```rust use ultimo::prelude::*; use ultimo::rpc::RpcMode; use serde::{Deserialize, Serialize}; #[derive(Deserialize)] struct GetUserInput { id: u32, } #[derive(Serialize)] struct User { id: u32, name: String, email: String, created_at: String, } #[derive(Deserialize)] struct CreateUserInput { name: String, email: String, } #[derive(Deserialize)] struct ListUsersInput { page: Option, limit: Option, } #[tokio::main] async fn main() -> Result<()> { let mut app = Ultimo::new(); let rpc = RpcRegistry::new_with_mode(RpcMode::Rest); // Register queries (GET) rpc.query( "listUsers", |input: ListUsersInput| async move { Ok(json!({ "users": [], "total": 0, "page": input.page.unwrap_or(1) })) }, r#"{ page?: number; limit?: number; }"# .to_string(), r#"{ users: User[]; total: number; page: number; }"# .to_string(), ); rpc.query( "getUser", |input: GetUserInput| async move { Ok(User { id: input.id, name: "Alice".to_string(), email: "alice@example.com".to_string(), created_at: "2024-01-01T00:00:00Z".to_string(), }) }, "{ id: number }".to_string(), r#"{ id: number; name: string; email: string; created_at: string; }"# .to_string(), ); // Register mutations (POST) rpc.mutation( "createUser", |input: CreateUserInput| async move { Ok(User { id: 1, name: input.name, email: input.email, created_at: "2024-01-01T00:00:00Z".to_string(), }) }, r#"{ name: string; email: string; }"# .to_string(), "User".to_string(), ); rpc.mutation( "deleteUser", |input: GetUserInput| async move { Ok(json!({ "success": true })) }, "{ id: number }".to_string(), "{ success: boolean }".to_string(), ); // Generate OpenAPI specification let openapi = rpc.generate_openapi( "User Management API", "1.0.0", "/api" ); openapi.write_to_file("openapi.json")?; println!("✅ OpenAPI spec generated: openapi.json"); app.listen("127.0.0.1:3000").await } ``` -------------------------------- ### Run REST Server Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/openapi-demo/README.md Command to start the RESTful server implementation. ```bash cargo run --bin rest-server ``` -------------------------------- ### Run Development Server Source: https://github.com/ultimo-rs/ultimo/blob/main/README.md Starts the hot-reload development server on a specified port. ```bash ultimo dev --port 3000 # hot-reload dev server (watches src/, restarts on change) ``` -------------------------------- ### Run Example Infrastructure and Server Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/database-api-styles/README.md Commands to initialize the PostgreSQL database container and launch the server application. ```bash docker run --name postgres \ -e POSTGRES_PASSWORD=postgres \ -e POSTGRES_DB=ultimo_example \ -p 5432:5432 \ -d postgres:16 ``` ```bash cd examples/database-api-styles cargo run ``` ```bash open http://127.0.0.1:3003 ``` -------------------------------- ### Run Benchmark Suite Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/benchmark/BENCHMARK.md Install the oha load generator and execute the benchmark script. ```bash # Install oha (HTTP load generator) cargo install oha # Run the benchmark suite ./run-benchmarks.sh ``` -------------------------------- ### Basic JSON-RPC Server Setup Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/rpc.mdx Initialize an Ultimo application and register RPC methods using RpcRegistry. ```rust use ultimo::prelude::*; #[tokio::main] async fn main() -> Result<()> { let mut app = Ultimo::new(); let rpc = RpcRegistry::new(); rpc.register_with_types("add", |input: AddInput| async move { Ok(AddOutput { sum: input.a + input.b }) }, "{ a: number; b: number }".to_string(), "{ sum: number }".to_string()); // Use handle_request for full JSON-RPC 2.0 support app.post("/rpc", move |ctx: Context| { let rpc = rpc.clone(); async move { let body = ctx.req.bytes().await?; let output = rpc.handle_request(&body).await; match output.into_body() { Some(bytes) => { let value: serde_json::Value = serde_json::from_slice(&bytes)?; ctx.json(value).await } None => { ctx.status(204).await; ctx.text("").await } } } }); app.listen("127.0.0.1:3000").await } ``` -------------------------------- ### Create Custom Timing Middleware Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/middleware.mdx A complete example demonstrating custom middleware for response time tracking and application setup. ```rust use std::sync::Arc; use std::time::Instant; use hyper::header::{HeaderName, HeaderValue}; use ultimo::middleware::builtin::{cors, logger, security_headers}; use ultimo::middleware::{BoxedMiddleware, Next}; use ultimo::prelude::*; fn timing() -> BoxedMiddleware { Arc::new(|ctx: Context, next: Next| { Box::pin(async move { let start = Instant::now(); let mut res = next(ctx).await?; res.headers_mut().insert( HeaderName::from_static("x-response-time"), HeaderValue::from_str(&format!("{}ms", start.elapsed().as_millis())) .unwrap(), ); Ok(res) }) }) } #[tokio::main] async fn main() -> Result<()> { let mut app = Ultimo::new_without_defaults(); app.use_middleware(logger()); app.use_middleware(security_headers()); app.use_middleware(cors()); app.use_middleware(timing()); app.get("/", |ctx: Context| async move { ctx.json(json!({ "message": "Hello!" })).await }); app.listen("127.0.0.1:3000").await } ``` -------------------------------- ### Run Benchmark Servers and Test Script Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/benchmark/RESULTS.md Commands to start the respective servers and execute the benchmark script in the examples/benchmark directory. ```bash # Start servers cd examples/benchmark # Terminal 1: Ultimo cd ultimo-server && cargo run --release # Terminal 2: Hono (Node.js) cd hono-server && npm start # Terminal 3: Hono (Bun) cd hono-server && bun run start:bun # Terminal 4: Run benchmark ./run-benchmarks.sh ``` -------------------------------- ### Verify CLI Installation Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/cli.mdx Check the installed version of the Ultimo CLI. ```bash ultimo --version # ultimo 0.4.1 ``` -------------------------------- ### Run Both Examples Simultaneously Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/REACT_EXAMPLES.md Commands to manage both REST and RPC backend servers and their respective frontends concurrently. ```bash # Terminal 1: Start REST backend cargo run --bin rest-server # Terminal 2: REST frontend (port 5173) cd examples/react-app-rest && npm run dev # Terminal 3: Stop REST backend (Ctrl+C), start RPC backend cargo run --bin rpc-server # Terminal 4: RPC frontend (port 5174) cd examples/react-app-rpc && npm run dev ``` -------------------------------- ### Initialize a Basic Ultimo Server Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/index.mdx Sets up a simple HTTP server using the Ultimo framework with a single GET route. ```rust use ultimo::prelude::*; #[tokio::main] async fn main() -> ultimo::Result<()> { let mut app = Ultimo::new(); app.get("/", |ctx: Context| async move { ctx.json(json!({"message": "Hello, Ultimo!"})).await }); app.listen("127.0.0.1:3000").await } ``` -------------------------------- ### Define streaming example dependencies Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/superpowers/plans/2026-08-16-streaming-responses.md Cargo.toml configuration for the streaming example crate. ```toml [package] name = "streaming-example" version = "0.1.0" edition = "2021" publish = false [dependencies] ultimo = { path = "../../ultimo" } tokio = { version = "1", features = ["full"] } futures-util = "0.3" hyper = "1" ``` -------------------------------- ### Quick-start Rust Example Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/superpowers/plans/2026-06-08-readme-cleanup.md The official quick-start code block compatible with the 0.4.0 API, demonstrating basic routing and parameter parsing. ```rust use ultimo::prelude::*; #[derive(Serialize, Deserialize)] struct User { id: u32, name: String, } #[tokio::main] async fn main() -> ultimo::Result<()> { let mut app = Ultimo::new(); app.get("/users/:id", |ctx: Context| async move { let id: u32 = ctx .req .param("id")? .parse() .map_err(|_| UltimoError::BadRequest("invalid id".into()))?; ctx.json(User { id, name: format!("User {id}") }).await }); println!("→ http://127.0.0.1:3000"); app.listen("127.0.0.1:3000").await } ``` -------------------------------- ### Initialize Project Source: https://github.com/ultimo-rs/ultimo/blob/main/website/content/posts/build-realtime-chat-rust-websockets.mdx Commands to create a new Rust project directory. ```bash cargo init chat-server cd chat-server ``` -------------------------------- ### Commit example migration Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/superpowers/plans/2026-06-09-ts-client-codegen-phase1.md Commit the changes made to the rpc-modes example project. ```bash git add examples/rpc-modes/Cargo.toml examples/rpc-modes/src/main.rs git commit -m "example(rpc-modes): use derived TS types (client-gen)" ``` -------------------------------- ### Install Diesel CLI Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/diesel.mdx Install the Diesel CLI tool to manage database migrations. ```bash cargo install diesel_cli --no-default-features --features postgres ``` -------------------------------- ### Install cargo-llvm-cov Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/TESTING.md Commands to update Rust and install the llvm-tools-preview component required for cargo-llvm-cov. ```bash # Update Rust to latest stable rustup update stable # Ensure llvm-tools is installed rustup component add llvm-tools-preview # Try installation again cargo install cargo-llvm-cov ``` -------------------------------- ### SSE response method example Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/superpowers/plans/2026-08-16-typed-sse.md Example usage of the sse method within a handler function. ```rust use ultimo::SseEvent; async fn events(ctx: Context) -> Result { let evs = vec![SseEvent::new(&json!({ "tick": 1 }))?.event("tick")]; ctx.sse(futures_util::stream::iter(evs)).await } ``` -------------------------------- ### Run the Axum Benchmark Server Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/benchmark/axum-server/README.md Starts the server in release mode, accessible at http://localhost:3004. ```bash cargo run --release ``` -------------------------------- ### Migrate basic GET route Source: https://github.com/ultimo-rs/ultimo/blob/main/website/content/posts/migrating-from-axum-to-ultimo.mdx Compares a simple JSON-returning GET endpoint between Axum and Ultimo. ```rust use axum::{routing::get, Json, Router}; use serde::Serialize; #[derive(Serialize)] struct HealthResponse { status: String, version: String, } async fn health() -> Json { Json(HealthResponse { status: "ok".to_string(), version: "1.0.0".to_string(), }) } #[tokio::main] async fn main() { let app = Router::new().route("/health", get(health)); let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); axum::serve(listener, app).await.unwrap(); } ``` ```rust use ultimo::prelude::*; use serde::Serialize; #[derive(Serialize)] struct HealthResponse { status: String, version: String, } async fn health(ctx: Context) -> Result> { ctx.json(&HealthResponse { status: "ok".to_string(), version: "1.0.0".to_string(), }) } #[tokio::main] async fn main() -> Result<()> { Ultimo::new() .get("/health", health) .listen("0.0.0.0:3000") .await } ``` -------------------------------- ### Scaffold a new project Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/cli.mdx Initialize a new Ultimo project using a specified template. ```bash ultimo new my-app --template fullstack ``` -------------------------------- ### Quick start API-key implementation Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/api-keys.mdx Configure the middleware using StaticKeys and access the identity within a route handler. ```rust use ultimo::auth::api_key::{ApiKey, StaticKeys}; use ultimo::prelude::*; #[tokio::main] async fn main() -> Result<()> { // Load keys from the environment in production — never hardcode them. let store = StaticKeys::new() .insert("key-abc", "service-a") .with_scopes("key-def", "service-b", ["read", "write"]); let mut app = Ultimo::new_without_defaults(); app.use_middleware(ApiKey::new(store).build()); // header "x-api-key" by default app.get("/me", |ctx: Context| async move { match ctx.api_key().await { Some(id) => ctx.json(serde_json::json!({ "id": id.id, "scopes": id.scopes })).await, None => ctx.json(serde_json::json!({ "id": null })).await, } }); app.listen("127.0.0.1:3000").await } ``` -------------------------------- ### Document Commands in README Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/cli.mdx Provide instructions for developers to generate clients and start servers. ```markdown ## Development Generate TypeScript client: ```bash ultimo generate -p ./backend -o ./frontend/src/lib/client.ts ``` Start development servers: ```bash ./dev.sh ``` ``` -------------------------------- ### Commit JWT authentication example Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/superpowers/plans/2026-06-07-jwt-auth.md Git commands to stage and commit the JWT authentication example files. ```bash git add Cargo.toml examples/jwt-auth/ git commit -m "feat(auth): add jwt-auth full-stack example" ``` -------------------------------- ### Start Ultimo Server Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/benchmark/BENCHMARK.md Commands to navigate to the Ultimo server directory and run the server in release mode. ```bash cd ultimo-server cargo run --release ``` -------------------------------- ### Manual Build Commands Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/DEPLOYMENT.md Commands to build the documentation site and preview the production build locally. ```bash cd docs-site pnpm build pnpm preview ``` -------------------------------- ### Generated TypeScript Client Example Source: https://github.com/ultimo-rs/ultimo/blob/main/website/content/posts/how-typescript-codegen-works.mdx A complete example of a generated TypeScript client, including type definitions, configuration, and RPC call logic. ```typescript // Generated by ultimo-cli v0.5.0 — do not edit manually // Source: ./src // ═══════════════════════════════════════════ // Types // ═══════════════════════════════════════════ export interface CreateUserRequest { name: string; email: string; age: number; role: UserRole | null; } export type UserRole = "Admin" | "Member" | "Guest"; export interface User { id: string; name: string; email: string; age: number; role: UserRole | null; created_at: string; } export interface GetUserRequest { id: string; } export interface ListUsersRequest { page: number; per_page: number; filter: UserFilter | null; } export interface UserFilter { role: UserRole | null; min_age: number | null; max_age: number | null; } // ═══════════════════════════════════════════ // Client // ═══════════════════════════════════════════ export interface ClientConfig { baseUrl: string; headers?: Record; } let _config: ClientConfig = { baseUrl: "" }; export function configure(config: ClientConfig): void { _config = config; } async function rpcCall(method: string, params: unknown): Promise { const response = await fetch(`${_config.baseUrl}/rpc`, { method: "POST", headers: { "Content-Type": "application/json", ..._config.headers, }, body: JSON.stringify({ jsonrpc: "2.0", id: crypto.randomUUID(), method, params, }), }); const json = await response.json(); if (json.error) { throw new RpcError(json.error.code, json.error.message, json.error.data); } return json.result as T; } export class RpcError extends Error { constructor( public code: number, message: string, public data?: unknown, ) { super(message); this.name = "RpcError"; } } // ═══════════════════════════════════════════ // API Functions // ═══════════════════════════════════════════ /** Mutation: createUser */ export async function createUser(params: CreateUserRequest): Promise { return rpcCall("createUser", params); } /** Query: getUser */ export async function getUser(params: GetUserRequest): Promise { return rpcCall("getUser", params); } /** Query: listUsers */ export async function listUsers(params: ListUsersRequest): Promise { return rpcCall("listUsers", params); } ``` -------------------------------- ### Start the Rust Backend Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/react-app/README.md Commands to navigate to the backend directory and execute the Rust application. ```bash cd examples/react-backend cargo run --release ``` -------------------------------- ### Start Backend Server Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/openapi-demo/swagger-ui.html Command to initialize the backend server required for testing API endpoints via Swagger UI. ```bash cargo run --bin server ``` -------------------------------- ### GET /rpc-rest/listUsers Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/database-api-styles/index.html Retrieves a list of all users. ```APIDOC ## GET /rpc-rest/listUsers ### Description Retrieves a list of all users. ### Method GET ### Endpoint /rpc-rest/listUsers ``` -------------------------------- ### GET /rest/users Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/database-api-styles/index.html Retrieves a list of all users. ```APIDOC ## GET /rest/users ### Description Retrieves a list of all users in the system. ### Method GET ### Endpoint /rest/users ``` -------------------------------- ### Start PostgreSQL Container Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/database-sqlx/README.md Use Docker to spin up a PostgreSQL 16 instance for development. ```bash docker run --name postgres-ultimo \ -e POSTGRES_PASSWORD=postgres \ -e POSTGRES_DB=ultimo_example \ -p 5432:5432 \ -d postgres:16 ``` -------------------------------- ### GET /users Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/diesel.mdx Retrieves a list of all users. ```APIDOC ## GET /users ### Description Retrieves a list of all users from the database. ### Method GET ### Endpoint /users ### Response #### Success Response (200) - **users** (array) - List of user objects - **total** (integer) - Total count of users ``` -------------------------------- ### Commit Changes Source: https://github.com/ultimo-rs/ultimo/blob/main/CONTRIBUTING.md Examples of conventional commit messages. ```bash git commit -m "feat: add WebSocket support" git commit -m "fix: resolve routing edge case" git commit -m "docs: update RPC examples" git commit -m "test: add middleware tests" ``` -------------------------------- ### Initialize Diesel Project Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/diesel.mdx Commands to set up the Diesel environment and generate migrations. ```bash # Create diesel.toml and migrations directory diesel setup # Create a migration diesel migration generate create_users # Edit the migration files # migrations/TIMESTAMP_create_users/up.sql # migrations/TIMESTAMP_create_users/down.sql # Run migrations diesel migration run ``` -------------------------------- ### Create SPA HTML Entry Point Source: https://github.com/ultimo-rs/ultimo/blob/main/docs/superpowers/plans/2026-06-08-static-files-compression.md Define the index.html file for the SPA demo. ```html Ultimo SPA Demo
``` -------------------------------- ### GET /rpc-rest/getUser Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/database-api-styles/index.html Retrieves a specific user by their ID. ```APIDOC ## GET /rpc-rest/getUser ### Description Retrieves a specific user by their ID. ### Method GET ### Endpoint /rpc-rest/getUser ### Parameters #### Query Parameters - **id** (integer) - Required - The unique identifier of the user. ``` -------------------------------- ### View CLI Help Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/cli.mdx Access general or command-specific help documentation. ```bash # General help ultimo --help # Command-specific help ultimo generate --help ultimo dev --help ultimo build --help ``` -------------------------------- ### GET /search Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/diesel.mdx Searches for users by email or name. ```APIDOC ## GET /search ### Description Searches for users matching the provided query string in their email or name fields. ### Method GET ### Endpoint /search ### Parameters #### Query Parameters - **q** (string) - Required - The search term ``` -------------------------------- ### GET /listUsers Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/openapi.mdx Retrieves a paginated list of users. ```APIDOC ## GET /listUsers ### Description Retrieves a list of users from the system with support for pagination. ### Method GET ### Endpoint /listUsers ### Parameters #### Query Parameters - **page** (number) - Optional - The page number to retrieve. - **limit** (number) - Optional - The number of users to return per page. ### Response #### Success Response (200) - **users** (array) - A list of user objects. - **total** (number) - The total number of users. - **page** (number) - The current page number. ``` -------------------------------- ### Manage database migrations via CLI Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/sqlx.mdx Commands to initialize, create, and execute SQLx migrations. ```bash # Create migrations directory mkdir -p migrations # Create a migration sqlx migrate add create_users_table # Edit the generated SQL file echo "CREATE TABLE users ( id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, email VARCHAR(255) UNIQUE NOT NULL, created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP );" > migrations/$(ls migrations | tail -1) # Run migrations sqlx migrate run ``` -------------------------------- ### GET /with-headers Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/routing.mdx Sets custom response headers. ```APIDOC ## GET /with-headers ### Description Sets X-Custom-Header and Cache-Control headers on the response. ### Method GET ### Endpoint /with-headers ``` -------------------------------- ### Run RPC Server Source: https://github.com/ultimo-rs/ultimo/blob/main/examples/react-app-rpc/README.md Command to start the backend RPC server from the project root. ```bash cd ../../ cargo run --bin rpc-server ``` -------------------------------- ### GET /check-auth Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/routing.mdx Reads the Authorization header from the request. ```APIDOC ## GET /check-auth ### Description Retrieves the value of the Authorization header. ### Method GET ### Endpoint /check-auth ``` -------------------------------- ### Troubleshoot Client Generation Source: https://github.com/ultimo-rs/ultimo/blob/main/docs-site/docs/pages/cli.mdx Verify backend compilation, project structure, and file permissions if generation fails. ```bash # Ensure backend compiles cd backend && cargo check # Verify project structure ultimo generate --verbose # Check output path is writable touch ./frontend/src/lib/client.ts ```