Rohas is a modern event-driven application framework built with Rust. It provides a schema-driven development approach with support for multiple runtimes and event adapters.
Rohas consists of several core components that work together to provide a complete event-driven application framework:
TODO Drawing
rohas-parser)The parser is responsible for parsing Rohas schema files (.ro files) into an Abstract Syntax Tree (AST). It uses a Pest-based grammar to parse:
Key Features:
rohas-engine)The engine is the core orchestration component that:
Key Modules:
api.rs: HTTP API routing and request handlingevent.rs: Event bus implementationrouter.rs: Request routing logicengine.rs: Main engine orchestrationtelemetry.rs: Observability and tracingworkbench.rs: Development tools and UIrohas-runtime)The runtime executes handlers in different programming languages:
TypeScript Runtime:
deno_core)Python Runtime:
Features:
rohas-codegen)Generates type-safe code from schemas:
Supported Languages:
rohas-adapters)Event adapters provide different message broker backends:
Memory Adapter (Default):
Production Adapters:
rohas-cli)Command-line interface for development:
Commands:
init: Create new projectcodegen: Generate code from schemasvalidate: Validate schema filesdev: Start development serverlist: List handlers and eventsrohas-cron)Scheduled job execution:
rohas-telemetry)Observability and monitoring:
1. HTTP Request → Engine Router 2. Router → Executor 3. Executor → Runtime (TypeScript/Python) 4. Runtime → Handler Execution 5. Handler → Response 6. Response → HTTP Response 7. (Optional) Trigger Events
1. Event Triggered (API/Cron/Manual) 2. Event Bus → Adapter 3. Adapter → Publish to Topic 4. Subscribers → Event Handlers 5. Handlers → Execute Business Logic 6. (Optional) Trigger More Events
1. Schema Files (.ro) 2. Parser → AST 3. Codegen → Templates 4. Generated Code → src/generated/ 5. Developer → Implements Handlers
A typical Rohas project follows this structure:
project/ ├── schema/ # Schema definitions │ ├── models/ # Data models │ ├── api/ # API endpoints │ ├── events/ # Event definitions │ ├── cron/ # Cron jobs │ └── websockets/ # WebSocket endpoints ├── src/ │ ├── generated/ # Auto-generated code (DO NOT EDIT) │ │ ├── api/ # API types │ │ ├── events/ # Event types │ │ ├── models/ # Model types │ │ └── dto/ # DTO types │ └── handlers/ # Your implementations │ ├── api/ # API handlers │ ├── events/ # Event handlers │ ├── cron/ # Cron handlers │ └── websockets/ # WebSocket handlers ├── config/ │ └── rohas.toml # Configuration └── .rohas/ # Runtime data └── telemetry/ # Telemetry storage
The config/rohas.toml file configures:
.ro schema filesrohas codegenrohas validaterohas dev or rohas dev --workbench with hot reload