Hero - the sovereign everything app
|
All checks were successful
Build and Test / build (push) Successful in 5m25s
Reviewed-on: #7 |
||
|---|---|---|
| .cargo | ||
| .forgejo/workflows | ||
| _archive/mock | ||
| data/mock | ||
| docs | ||
| examples/rust | ||
| scripts | ||
| sdk | ||
| specs | ||
| src | ||
| static | ||
| tests | ||
| .DS_Store | ||
| .env.example | ||
| .gitignore | ||
| build.rs | ||
| Cargo.toml | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| README_FAVICON.md | ||
HeroZero
A human-centric backend server entirely generated from schema definitions using OSIS (Object Storage with SmartID).
Quick Start
make run # Build and run server
make dev # Run with debug logging
make help # Show all available commands
Server runs at http://127.0.0.1:3377/api:
- RPC endpoints:
/api/herozero/{domain}/rpc - DB Inspector:
/api/herozero/{domain}/inspector
How It Works
HeroZero is built on a schema-first architecture. All types, storage, RPC handlers, and documentation are auto-generated from .oschema files in specs/schemas/.
specs/schemas/{domain}/*.oschema → build.rs → Generated Code
↓
┌────────────────────┼────────────────────┐
↓ ↓ ↓
src/{domain}/ sdk/rust/src/ docs/schemas/
- types_generated.rs - client code - API docs
- rpc_generated.rs
- osis_server.rs
The herolib-osis crate handles:
- OSchema parsing - Schema language for defining types
- Code generation - Rust structs, builders, CRUD methods
- Storage - Filesystem-based with SmartID identifiers
- Full-text search - Tantivy-powered indexing
- RPC server - JSON-RPC endpoints per domain
Example Schema
# specs/schemas/business/company.oschema
Company = {
sid: sid # SmartID (auto-generated)
name: str [rootobject] # Marks as storable type, indexed
description?: str [index] # Optional, full-text indexed
website?: str
country?: str
active: bool
tags: [str]
}
Running cargo build generates:
Companystruct with all fieldsOsisBusinesshandler with CRUD methods- RPC endpoint at
/api/herozero/business/rpc - SDK client code
Domains
Domains are logical groupings of related types. Each domain compiles independently via feature flags.
| Domain | Description |
|---|---|
calendar |
Events, planning, scheduling |
files |
Documents, folders, sharing |
finance |
Money, payments, transactions |
communication |
Messages, channels, notifications |
identity |
Profiles, sessions, contacts |
projects |
Tasks, issues, requirements |
code |
Source code, changes, releases |
business |
CRM, deals, contracts |
network |
Network nodes, marketplace |
settings |
User preferences |
Project Structure
hero0/
├── specs/schemas/ # Schema definitions (.oschema files)
├── src/{domain}/ # Generated types and handlers
├── sdk/rust/ # Generated Rust SDK
├── data/mock/ # Seed data (TOML files)
├── data/ # Runtime data (gitignored)
└── tests/ # E2E tests
Environment Variables
| Variable | Default | Description |
|---|---|---|
HEROZERO_BIND |
127.0.0.1:3377 |
Server bind address |
HEROZERO_DATA_DIR |
~/hero/var/hero0/data |
Data directory |
HEROZERO_SEED_DIR |
- | Seed directory for auto-seeding |
Seeding Data
make seed # Seed from ./data/mock
Seed files are TOML with a _type field:
_type = "Company"
name = "ACME Corporation"
country = "US"
active = true
RPC Usage
curl -X POST http://127.0.0.1:3377/api/herozero/business/rpc \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":"1","method":"company.list","params":{}}'
Methods: {type}.new, {type}.get, {type}.set, {type}.delete, {type}.list, {type}.find
Adding a New Domain
- Create schemas in
specs/schemas/{domain}/*.oschema - Add feature flag to
Cargo.toml - Register domain in
build.rs - Add handler in
src/bin/server.rs - Run
cargo build
Resources
- OSIS Documentation - Full OSIS reference
- OSchema Specification - Schema language details
- SDK Documentation - Rust client library
License
Apache-2.0