Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 113 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,134 @@
# ByteHive
<p align="center">
<img src="crates/core/assets/bytehive-logo-full.svg" alt="ByteHive" width="320">
</p>

A framework and personal cloud server. A central message bus and HTTP control plane
for focused, composable applications.
<p align="center">
<strong>Your infrastructure. Your data. No nonsense.</strong><br>
A self-hosted cloud server framework with a plugin architecture for composable, focused applications.
</p>

See [ARCHITECTURE.md](ARCHITECTURE.md) for system design, module map, and the `App` trait contract.
<p align="center">
<img src="https://img.shields.io/badge/version-0.1.0-orange" alt="Version">
<img src="https://img.shields.io/badge/license-GPLv3-blue" alt="License">
<img src="https://img.shields.io/badge/platform-Linux-lightgrey" alt="Platform">
</p>

> [!WARNING]
> This software is in an experimental stage, I cannot guarantee (100%) file integrity.
> [!WARNING]
> **Experimental (v0.1.0)** - There can be bugs. Linux only.
> A stress test has ran for 100 hours without a single failure.
> Tests do not yet cover all paths and possibilities.
---

## Build
## Features

### ⚡ Fast

BLAKE3 hashing, parallel I/O, and a compact wire format - sync stays out of your way.

<details>
<summary>Details</summary>

- Parallel file hashing (4 rayon threads) and parallel reading (4 reader threads)
- Small files (< 8 MiB) batched into bundles (up to 8 MiB / 500 files); large files streamed in 8 MiB chunks with retransmit
- bincode + LZ4 compressed wire format with 4-byte length prefix
- inotify watcher with 200 ms debounce and 500 ms stability checks - changes picked up near-instantly
- Bounded message bus queues (256 messages) with automatic dead-subscriber GC
</details>

### 🔒 Secure

TLS 1.3 mutual authentication, modern password hashing, and zero trust-on-first-use assumptions.

<details>
<summary>Details</summary>

- TLS 1.3 with AES-256-GCM and ChaCha20-Poly1305 for all file sync traffic
- Mutual TLS using ECDSA P-384 certificates with stable identities persisted to disk
- TOFU server fingerprint pinning; known-clients approval (pending / allowed / rejected)
- Argon2id password hashing, cookie sessions (8 h TTL), named API keys (UUID v4, optional expiry)
- Read-only role enforcement, path traversal prevention, and token-based share links with optional password and expiry
</details>

### ✨ Simple

One binary, one config file, one command to start. First-run wizard gets you going in seconds.

<details>
<summary>Details</summary>

- Single TOML config with `[framework]` and `[apps.<name>]` sections - auto-persisted with format-preserving splicing
- Web assets embedded directly into the binary - nothing to deploy separately
- First-run setup wizard when no users exist - just open a browser
- Built-in web file manager with Monaco editor, file preview, upload/download, and share links
- Bidirectional file sync that just works - conflict copies are created automatically
</details>

### 🧩 Extensible

A plugin architecture that gives each app its own namespace, message topics, and HTTP routes.

<details>
<summary>Details</summary>

- Apps implement the `App` trait (`manifest()`, `start()`, `stop()`, `handle_http()`, `on_message()`) managed by the `AppRegistry`
- Pub/sub message bus with dot-separated topics and wildcard subscriptions (`filesync.*`, `*`)
- SSE event stream at `/api/core/events` - every bus message available to the browser in real time
- Axum HTTP server with proxy routing under `/api/*` and `/apps/*` - each app gets its own route space
- Full user, group, and API key management via admin API
</details>

---

## Screenshots

| | |
|:---:|:---:|
| ![Dashboard](screenshots/dashboard.png) | ![FileBrowser](screenshots/filebrowser.png) |
| **Dashboard** | **File Browser** |
| ![FileSync](screenshots/filesync-gui.png) | ![Editor](screenshots/editor.png) |
| **FileSync Status** | **Monaco Editor** |

---

## Quick Start

```bash
# Prerequisites: Rust stable, Linux (inotify)
# Prerequisites: Rust stable toolchain, Linux
cargo build --release
./target/release/bytehive --config config.toml
```

On first run with no `[[users]]` entries the server redirects to `/setup` for interactive
admin password creation.
On first run with no users, navigate to `http://<host>:9000/` - you will be redirected to the setup wizard.

## Configuration
<details>
<summary>Example configuration</summary>

```toml
[framework]
http_addr = "0.0.0.0:9000" # portal and API
http_token = "" # optional static admin token; prefer named [[api_keys]]
http_addr = "0.0.0.0:9000"
http_token = ""
web_root = ""
log_level = "info"

[apps.filesync]
root = "/path/to/folder"
mode = "server" # or "client"
mode = "server" # or "client"
bind_addr = "0.0.0.0:7878"
# server_addr = "host:7878" # client mode
# auth_token = "<api-key>" # client mode

[apps.filebrowser]
max_upload_mb = 200
allow_delete = true
```

See `config.toml` for the full reference including user accounts, groups, API keys, and
exclusion rules. See [crates/filesync/README.md](crates/filesync/README.md) and
[crates/filebrowser/README.md](crates/filebrowser/README.md) for app-specific options.
</details>

## Documentation

- [Architecture](docs/ARCHITECTURE.md) - system design, module map, `App` trait contract
- [Usage Guide](docs/USAGE.md) - setup and day-to-day usage
- [FileSync](crates/filesync/README.md) - sync protocol and configuration
- [FileBrowser](crates/filebrowser/README.md) - file manager details

## License

[GPLv3](LICENSE)
83 changes: 65 additions & 18 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ http_token = ""
# Leave empty to use the built-in portal.
web_root = ""

log_level = "debug"
log_level = "info"


# =============================================================================
Expand Down Expand Up @@ -166,25 +166,72 @@ created_at = 1773176839540
# -----------------------------------------------------------------------------

[apps.filesync]
root = "/home/guy/Desktop/bytehive/server/"
root = "/home/guy/cloud/"
mode = "server"
bind_addr = "0.0.0.0:7878"

# Authentication: server validates clients via the framework UserStore.
# No extra config needed for the server. Clients set auth_token below.

# Example exclusion rules — uncomment and adapt as needed:
# exclude_patterns = [
# "*.log", # all log files at the root level
# "build/**", # everything inside build/
# "**/.cache/**", # any .cache directory anywhere in the tree
# "tmp_?.dat", # single-char wildcard: tmp_a.dat, tmp_b.dat …
# ]
# exclude_regex = [
# '.*\.(tmp|bak|swp)$', # temporary/swap files
# '^private/', # private/ directory at root
# 'node_modules', # any node_modules path component
# ]
exclude_patterns = [
# ── Python ────────────────────────────────────────────────
"**/venv/**",
"**/.venv/**",
"**/env/**",
"**/__pycache__/**",
"**/*.pyc",
"**/*.pyo",
"**/*.pyd",
"**/.pytest_cache/**",
"**/*.egg-info/**",
"**/dist/**",
"**/.mypy_cache/**",
"**/.ruff_cache/**",

# ── C / C++ ───────────────────────────────────────────────
"**/build/**",
"**/cmake-build-*/**",

# ── PlatformIO ────────────────────────────────────────────
"**/.pio/**",
"**/.pioenvs/**",
"**/.piolibdeps/**",

# ── Rust ──────────────────────────────────────────────────
"**/target/**",

# ── Node / JS ─────────────────────────────────────────────
"**/node_modules/**",

# ── General OS & editor noise ─────────────────────────────
"**/.DS_Store",
"**/Thumbs.db",
"**/*.tmp",
"**/*.bak",
"**/*.swp",
"**/*.swo",
"**/*~",
"**/.Trash-*/**",

# ── Logs & runtime artifacts ──────────────────────────────
"**/*.log",
"**/logs/**",
"**/tmp/**",
"**/temp/**",
"**/.cache/**",
]

exclude_regex = [
'.*\.pyc$',
'.*\.pyo$',
'.*\.(o|d|elf|map)$',
'(^|/)target/',
'(^|/)\.pio/',
'.*\.(tmp|bak|swp|swo)$',
'.*~$',
'(^|/)\.DS_Store$',
'(^|/)Thumbs\.db$',
]


# Client example (separate machine or second instance):
Expand All @@ -204,10 +251,10 @@ max_upload_mb = 200
allow_delete = false

[[filesync_known_clients]]
node_id = "gui-18a6040ceed3180d"
node_id = "gui-18a782eb7111ab17"
fingerprint = "30a9affdb0b18df66302e9c0b9ad6680490a428fd215e63a78b9b49053f0e372"
label = ""
status = "allowed"
addr = "127.0.0.1:33536"
first_seen_ms = 1776111556666
last_seen_ms = 1776111581775
addr = "127.0.0.1:54560"
first_seen_ms = 1776532525762
last_seen_ms = 1776604627158
Loading
Loading