Chat client built with rust and svelt.js
README.md

Muchi #

Muchi is a self-hosted chat server for a small, private community: Discord-style channels, roles, voice, and screen sharing on a home server or rented VPS. One install serves one community.

  • Server: Go, with PostgreSQL, Redis, S3-compatible storage, and a LiveKit SFU for media
  • Clients: one Svelte 5 app, served to browsers and installable as a PWA on phones, and wrapped in Tauri for macOS, Windows, and Linux

Design docs live outside the repo, in ~/Documents/Development/MuchiChat/: Overview, Architecture and Data Model, Voice and Media, Clients, and Operations. The roadmap and tickets are in the Linear project Muchi Chat.

Repository layout #

server/              Go server and muchictl
web/                 SvelteKit app (browser, PWA, and the Tauri UI)
desktop/src-tauri/   Tauri app and Rust core
dev/                 Compose file and config for local services
spikes/              Throwaway M0 prototypes

Local development #

Prerequisites #

  • Nix with flakes enabled, and direnv with nix-direnv
  • OrbStack (or another Docker runtime)

Every other tool (Go, Node, pnpm, Rust, sqlc, goose, tygo, psql, redis-cli, lk, the AWS CLI, and just) comes from flake.nix. On first checkout:

direnv allow

The dev shell then loads whenever you enter the repo. Without direnv, run nix develop.

Local services #

Postgres, Redis, LiveKit, and RustFS (S3-compatible storage) run in Docker from dev/compose.yaml. The Go server and web app run on the host and connect to them on localhost.

just dev-up     # first run creates dev/.env from dev/.env.example
Service Address Notes
Postgres 18 localhost:5432 just db opens psql
Redis 8 localhost:6379 Nothing is persisted
LiveKit ws://localhost:7880 Dev mode: key devkey, secret secret
RustFS http://localhost:9000 Bucket muchi-dev. Console at http://localhost:9001/rustfs/console/

Connection settings for all four are in dev/.env, which just loads for every recipe. Ports are bound to 127.0.0.1, so nothing is reachable from your network.

Version control #

This repo uses Jujutsu (jj), colocated with Git: .jj/ sits beside .git/, and you use only jj commands. Git stays underneath because Nix flakes, direnv, and git describe (for the server's version) read it.

jj describe -m "…"         # name the current change
jj new                     # start the next change
jj git push --bookmark master   # push to Tangled (the default remote)

master tracks both tangled and origin (GitHub, kept as a mirror). Flakes only see files Git tracks, and jj adds new files to Git when their change stops being the working copy. So after adding a file the flake reads, run jj new before nix develop picks it up.

Tasks #

just            # list recipes
Recipe Does
just dev-up / dev-down Start or stop local services, keeping their data
just dev-reset Delete all local data and start fresh
just dev-logs [service…] Follow service logs
just db Open psql on the local database
just server Run the Go server
just web Run the SvelteKit dev server
just desktop Run the Tauri app. Reuses the dev server from just web if it's running
just desktop-build Build an unsigned Muchi.app into desktop/src-tauri/target/release/bundle/
just check Run every linter, type check, and test

CI #

CI runs on Tangled Spindles, from .tangled/workflows/: one workflow each for the server, web app, and desktop app, on every push and pull request to master. Each pins nixpkgs (and rust-overlay) to the same commits as flake.lock, so CI uses the dev shell's tool versions. After nix flake update, copy the new revs into the workflows' registry: blocks.

Debugging the desktop app #

Debug builds (just desktop) include CrabNebula DevTools. On startup the terminal prints a dashboard link, https://devtools.crabnebula.dev/dash/127.0.0.1/3033; open it in a browser to see logs, IPC calls, events, and the app's config. Release builds leave DevTools out and log to the OS log directory instead (~/Library/Logs/chat.muchi.desktop/ on macOS).