Expand description
§ironflow-api
REST API crate for the ironflow workflow engine. Provides endpoints for querying workflow runs, managing their lifecycle, and viewing aggregate statistics.
§Architecture
entities/— DTOs and query parameter types (public API contract)routes/— One file per route handlererror.rs— Typed API errors mapped to HTTP status codesresponse.rs— Standard response envelopestate.rs— Shared application state
§API Endpoints
§Health check
GET /api/v1/health-check— Liveness probe, always returns 200 OK
§Runs
GET /api/v1/runs— List runs with optional filtering and paginationPOST /api/v1/runs— Trigger a workflowGET /api/v1/runs/:id— Get run details and stepsPOST /api/v1/runs/:id/cancel— Cancel a pending or running runPOST /api/v1/runs/:id/retry— Retry a failed run (creates new run)
§Workflows
GET /api/v1/workflows— List registered workflows
§Statistics
GET /api/v1/stats— Aggregate statistics (total runs, success rate, cost, etc.)
§Quick start
use ironflow_api::prelude::*;
use ironflow_api::routes::create_router;
use ironflow_store::prelude::*;
use ironflow_engine::engine::Engine;
use ironflow_core::providers::claude::ClaudeCodeProvider;
use ironflow_auth::jwt::JwtConfig;
use std::sync::Arc;
let store = Arc::new(InMemoryStore::new());
let user_store: Arc<dyn ironflow_store::user_store::UserStore> = Arc::new(InMemoryStore::new());
let provider = Arc::new(ClaudeCodeProvider::new());
let engine = Arc::new(Engine::new(store.clone(), provider));
let jwt_config = Arc::new(JwtConfig {
secret: "your-secret-key".to_string(),
access_token_ttl_secs: 900,
refresh_token_ttl_secs: 604800,
cookie_domain: None,
cookie_secure: false,
});
let state = AppState { store, user_store, engine, jwt_config, worker_token: "token".to_string() };
let app = create_router(state, None);
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000")
.await
.unwrap();
axum::serve(listener, app).await.unwrap();Re-exports§
pub use routes::create_router;pub use state::AppState;
Modules§
- entities
- API entities — DTOs and query parameter types.
- error
- REST API error types and responses.
- middleware
- Middleware for internal route protection and HTTP security hardening.
- prelude
- Convenience re-exports for common API usage.
- response
- Standard response types and helpers for the REST API.
- routes
- Router assembly — one module per route.
- state
- Application state and dependency injection.