A minimal, well-commented skeleton application for the Hyperware platform using the Hyperapp framework. This skeleton provides a starting point for building peer-to-peer applications with a React/TypeScript frontend and Rust backend.
- ✅ Minimal working Hyperware app structure
- ✅ Well-commented code explaining key concepts
- ✅ Basic state management with counter example
- ✅ HTTP endpoints demonstration
- ✅ P2P messaging between nodes
- ✅ React/TypeScript UI with Zustand state management
- ✅ Error handling and loading states
- ✅ Automatic WIT generation via hyperprocess macro
- Hyperware development environment (
kitcommand) - Rust toolchain
- Node.js and npm
kit b --hyperapphyperapp-skeleton/
├── Cargo.toml # Workspace configuration
├── metadata.json # App metadata
├── todo/ # Main Rust process
│ ├── Cargo.toml # Process dependencies
│ └── src/
│ ├── lib.rs # Main app logic (well-commented)
│ └── icon # App icon file
├── ui/ # Frontend application
│ ├── package.json # Node dependencies
│ ├── index.html # Entry point (includes /our.js)
│ ├── vite.config.ts # Build configuration
│ └── src/
│ ├── App.tsx # Main React component
│ ├── store/ # Zustand state management
│ ├── types/ # TypeScript type definitions
│ └── utils/ # API utilities
├── api/ # Generated WIT files (after build)
├── pkg/ # Built package output
└── target/ # Target
The #[hyperprocess] macro is the core of the Hyperapp framework. It provides:
- Async/await support without tokio
- Automatic WIT generation
- State persistence
- HTTP/WebSocket endpoint configuration
You can handle FE <-> BE communication either through websockets or HTTP API. For detailed information about HTTP API patterns and WebSocket communication, consult development-docs.md. General guideliness are:
- Specifying a path and might cause issues in proper routing of your request. Setting a parameter and hitting the general
/apiendpoint is a suggested. - In other cases, unless strictly needed, communication with the front-end can be done over websockets, preventing any HTTP issues.
Parameters must be sent as tuples for multi-parameter methods:
// Single parameter
{ "MethodName": value }
// Multiple parameters
{ "MethodName": [param1, param2] }MUST be included in index.html:
<script src="/our.js"></script>For node-to-node communication:
let target_address = Address::new(node_name, process_id);
let result = Request::new()
.target(target_address)
.body(request_body)
.expects_response(30) // Always set timeout
.send_and_await_response(30);Edit AppState in skeleton-app/src/lib.rs:
#[derive(Default, Serialize, Deserialize)]
pub struct AppState {
// Add your fields here
my_data: Vec<MyType>,
}For UI interaction:
#[http]
async fn my_method(&mut self, request_body: String) -> Result<String, String> {
// Parse request, update state, return response
}For P2P features:
#[remote]
async fn handle_remote_call(&mut self, data: String) -> Result<String, String> {
// Handle calls from other nodes
}- Add types in
ui/src/types/skeleton.ts - Add API calls in
ui/src/utils/api.ts - Update store in
ui/src/store/skeleton.ts - Modify UI in
ui/src/App.tsx
- Ensure all HTTP methods have
_request_bodyparameter - Check parameter format (tuple vs object)
- Verify
/our.jsis included in index.html - Check that the app is running in Hyperware environment
- Use simple types or return JSON strings
- No HashMap (use Vec<(K,V)>)
- No fixed arrays (use Vec)
- Add #[derive(PartialEq)] to structs
- Don't add
hyperware_process_libto Cargo.toml - Use imports from
hyperprocess_macro
-
Run two Hyperware nodes:
# Terminal 1 kit s --fake-node alice.os # Terminal 2 kit s --fake-node bob.os
-
Install the app on both nodes
-
Use the P2P messaging feature to send messages between nodes
- Study the Code: Read through the well-commented
lib.rsfile - Experiment: Try modifying the counter logic or adding new endpoints
- Build Features: Add your own functionality following the patterns
- Test P2P: Run multiple nodes and test node-to-node communication
- Development Guides: See
resources/guides/for comprehensive documentation- Manifest & Deployment - Understanding manifest.json
- Capabilities Guide - System permissions reference
- Complete Guide Index - All available guides
- Example Apps: Check the
example-appsfolder for working implementations - Hyperware Documentation: [Coming Soon]
- Community: [Coming Soon]
[Your License Here]