A modern, high-performance, FOSS alternative to Discord. Built with Rust, SolidJS, and PostgreSQL.
Sakura is an open-source community platform that stays self-hostable and horizontally scalable without sacrificing trust & safety. One binary, two worlds: deploy as a managed SaaS service or self-host with Docker Compose.
- Real-time messaging — Send, edit, delete, pin, and search messages with MsgPack-encoded WebSocket delivery
- Guilds & channels — Create communities with text and voice channels, roles, and permissions
- Voice & video — LiveKit-powered voice channels with screen sharing
- Reactions & typing indicators — Full emoji reactions and live typing status
- File uploads — Content-addressable storage with SHA256 deduplication, image compression, and antivirus scanning
- Roles & permissions — Hierarchical role system with per-channel permission overwrites
- Invite system — Shareable invite links with expiration and usage limits
- Friends & DMs — Friend requests, direct messages, and user blocking
- Presence — Online, Idle, DND, Invisible, and Offline status with real-time updates
- MFA — TOTP-based multi-factor authentication with backup codes
- Moderation — Reports, bans, trust scoring, word filters, ClamAV integration, and admin audit logs
- Desktop client — Full-featured SolidJS client with dark theme, virtual scrolling, markdown rendering, and device management
- Admin panel — Report triage, user banning, message deletion, and audit log viewer
- Self-hosting — Single Docker Compose deployment with MinIO, PostgreSQL, and Redis
┌─────────────┐ ┌──────────────┐ ┌──────────────┐
│ Desktop / │────▶│ sakura-api │────▶│ PostgreSQL │
│ Web Client │ │ (REST API) │ │ (partitioned)│
└──────┬──────┘ └──────────────┘ └──────────────┘
│ │
│ MsgPack/WS │ Redis Pub/Sub
▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│sakura-gateway│◀───▶│ Redis │ │ S3 / MinIO │
│ (WebSocket) │ │ │ │ (CAS files) │
└──────────────┘ └──────────────┘ └──────────────┘
┌──────────────┐
│sakura-janitor│
│ (cleanup) │
└──────────────┘
| Crate | Purpose |
|---|---|
crates/core |
Shared types, DB models, config, auth, extensibility traits |
crates/api |
Axum REST API — auth, guilds, channels, messages, uploads, moderation, voice |
crates/gateway |
WebSocket gateway — real-time event fanout via MsgPack + Redis Pub/Sub |
crates/janitor |
Background cleanup — expired attachments, orphaned files, cascading deletes |
crates/moderation |
Content scanning — ClamAV, perceptual image hashing, trust scoring |
apps/desktop |
SolidJS desktop client — guilds, messaging, voice, file uploads, reactions |
apps/web |
Astro landing page with OS-aware download button |
apps/admin |
SolidJS admin dashboard — reports, bans, audit logs |
- Stateless services, stateful data — All state lives in Postgres, Redis, or object storage; services restart without drama
- Time-ordered data by default — UUIDv7 + partitioned tables for message scale
- Content-addressable storage — Files deduplicated, reference-counted, and garbage-collected
- Safety is foundational — MFA, moderation hooks, and audit trails are core, not add-ons
- One binary, two worlds — SaaS and self-hosted modes are configuration choices, not forks
Sakura exposes trait-based extension points for plugins and alternative backends:
EventPublisher— Swap Redis Pub/Sub for NATS or KafkaStorageProvider— Plug in Backblaze B2, GCS, or any S3-compatible backendAuthProvider— Replace PASETO with SSO/OAuthNotificationProvider— Push, email, or webhook deliveryModerationScanner— Custom content scanners beyond ClamAVPreSendHook/PostSendHook— Message pipeline validation and analytics
- Rust 1.75+
- PostgreSQL 15+
- Redis 7+
- S3-compatible storage (Cloudflare R2, MinIO, or AWS S3)
- Node.js 18+ (for frontend development)
# Clone and build
git clone https://github.com/modpotato/Sakura.git
cd Sakura
cargo build
# Copy and edit config
cp config.example.toml config.toml # SaaS mode (Cloudflare R2)
# or
cp config.selfhosted.example.toml config.toml # Self-hosted mode (MinIO)
# Run all database migrations
for f in migrations/*.sql; do psql "$DATABASE_URL" -f "$f"; done
# Start services (each in its own terminal)
cargo run -p sakura-api # REST API on :8080
cargo run -p sakura-gateway # WebSocket gateway on :9001
cargo run -p sakura-janitor # Background cleanup (runs every 5 min)cd apps/desktop
npm install
npm run dev # Vite dev server on :1420cd apps/admin
npm install
npm run dev # Vite dev server on :3001cp .env.example .env # Edit with your secrets
docker compose up -d # Starts API, gateway, janitor, Postgres, Redis, MinIOSee README_PROD.md for production deployment on Hetzner/VPS.
cargo testCopy config.example.toml (SaaS) or config.selfhosted.example.toml (self-hosted) to config.toml. Environment variables with the SAKURA__ prefix override TOML settings:
SAKURA__DATABASE__URL=postgres://sakura:pass@localhost/sakura
SAKURA__REDIS__URL=redis://localhost:6379
SAKURA__AUTH__PASETO_SECRET=<base64-32-bytes>
SAKURA__STORAGE__BUCKET=sakura-uploadsSee DOCS/SELF_HOSTING.md for a complete self-hosting guide.
- API Reference — REST endpoint documentation
- Gateway Protocol — WebSocket events and opcodes
- Self-Hosting Guide — Docker Compose deployment
- Production Deployment — VPS deployment with Caddy and backups
- Vision & Philosophy — Design principles
- Roadmap — Feature timeline
GPL-3.0 — see LICENSE.