No description
  • Rust 56.5%
  • Shell 35.6%
  • HTML 5.6%
  • Makefile 2.3%
Find a file
despiegk bc866f0396 Rewrite README with complete usage docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 10:38:06 +03:00
crates Rename conduit to matrixchat, add multi-profile support and UI redesign 2026-02-22 10:34:15 +03:00
scripts Rename conduit to matrixchat, add multi-profile support and UI redesign 2026-02-22 10:34:15 +03:00
.gitignore Initial scaffold 2026-02-22 10:34:11 +03:00
buildenv.sh Rename conduit to matrixchat, add multi-profile support and UI redesign 2026-02-22 10:34:15 +03:00
Cargo.lock Rename conduit to matrixchat, add multi-profile support and UI redesign 2026-02-22 10:34:15 +03:00
Cargo.toml Rename conduit to matrixchat, add multi-profile support and UI redesign 2026-02-22 10:34:15 +03:00
Makefile Rename conduit to matrixchat, add multi-profile support and UI redesign 2026-02-22 10:34:15 +03:00
README.md Rewrite README with complete usage docs 2026-02-22 10:38:06 +03:00

Hero MatrixChat

Admin toolkit for Matrix homeservers. Connect to one or more Matrix servers (Conduit, Synapse, Dendrite, etc.) through profile-based configuration and manage users, rooms, spaces, and messages from a single CLI, web dashboard, or JSON-RPC API.

What it does

  • Multi-profile — define any number of Matrix server connections in ~/hero/cfg/matrix/*.toml, switch between them from the CLI (--profile) or the UI dropdown
  • User management — list, create, delete users and reset passwords via the Matrix CS API
  • Room & space management — list public/joined rooms, create rooms and spaces, inspect state, manage members
  • Messaging — send and retrieve messages, typing notifications, sync
  • Server monitoring — health checks, server version, user/room counts per profile
  • Web dashboard — Bootstrap 5 dark-themed admin UI at http://127.0.0.1:3790 with live profile switching
  • JSON-RPC server — all operations available over a Unix socket for tool integration
  • Rhai scripting — automate any operation from Rhai scripts

Architecture

hero_matrixchat/
├── crates/
│   ├── hero_matrixchat_sdk/       # SDK: MatrixClient (CS API), ProfileManager, types
│   ├── hero_matrixchat_server/    # JSON-RPC daemon on Unix socket
│   ├── hero_matrixchat/           # CLI
│   ├── hero_matrixchat_ui/        # Axum web dashboard
│   └── hero_matrixchat_rhai/      # Rhai scripting bindings

~/hero/cfg/matrix/                 # Profile configs (one .toml per server)
~/hero/var/sockets/                # Unix sockets for server + UI

All four binaries depend only on the SDK crate:

hero_matrixchat_sdk
     ↑    ↑    ↑    ↑
  server  CLI  UI  rhai

The SDK talks directly to Matrix servers over HTTP using the Client-Server API — no custom protocol involved.

Quick start

# 1. Create a profile (assumes a Matrix server on localhost:6167)
mkdir -p ~/hero/cfg/matrix
cat > ~/hero/cfg/matrix/local.toml << 'EOF'
server_url = "http://127.0.0.1:6167"
username = "@admin:localhost"
password = "admin_password"
registration_token = "conduit_dev_token"
EOF

# 2. Build and run
make run        # builds, installs to ~/hero/bin, starts server + UI

# 3. Open the dashboard
open http://127.0.0.1:3790

If no profile files exist, an implicit local profile pointing to 127.0.0.1:6167 is created automatically.

CLI usage

hero_matrixchat health                     # check server connectivity
hero_matrixchat users list                 # list users on default profile
hero_matrixchat --profile work users list  # list users on "work" profile
hero_matrixchat users create --username alice --password secret
hero_matrixchat rooms list
hero_matrixchat send --room-id '!abc:example.com' --message "hello"
hero_matrixchat messages --room-id '!abc:example.com' --limit 20
hero_matrixchat stats
hero_matrixchat profiles list

Profile configuration

Each .toml file in ~/hero/cfg/matrix/ defines one Matrix server connection. The filename (without extension) becomes the profile name.

# ~/hero/cfg/matrix/work.toml
server_url = "https://matrix.example.com"
username = "@admin:example.com"
password = "secret"
registration_token = "optional_registration_token"
Field Required Description
server_url yes Base URL of the Matrix server
username yes Matrix user ID or local part
password yes Password for login
registration_token no Token for creating new users via the registration API

Ports and sockets

Component Type Default
hero_matrixchat_server Unix socket ~/hero/var/sockets/hero_matrixchat_server.sock
hero_matrixchat_ui TCP http://127.0.0.1:3790

JSON-RPC methods

All methods accept an optional profile parameter. When omitted, the first profile (alphabetically) is used.

Method Description
health Server version, reachability, server name
list_users Search the user directory
create_user Register a new user
delete_user Deactivate a user
reset_password Reset a user's password
list_rooms Public and joined rooms with member counts
send_message Send a text message to a room
get_messages Retrieve messages from a room
server_stats Aggregate stats (user count, room count, version)
list_profiles Available profile names
get_config Read server-level configuration
update_config Write server-level configuration

Make targets

make help           Show all targets
make build          Build all crates (release)
make run            Build, install, and run server + UI
make rundev         Run in debug mode with logging
make stop           Stop running services
make check          Fast workspace check (no build)
make test           Unit tests
make test-integration  SDK integration tests (needs running Matrix server)
make test-all       Full test suite
make fmt            Format code
make lint           Run clippy
make install        Build and install to ~/hero/bin
make installdev     Debug build and install (fastest compile)

Testing

Integration tests talk directly to a Matrix server via the CS API — they register users, create rooms and spaces, send messages, and verify everything round-trips correctly.

# Requires a Matrix server on 127.0.0.1:6167 with registration enabled
make test-integration

# Unit tests only (no server required)
make test

# Everything
make test-all