Files
zep/README.md
T

89 lines
4.1 KiB
Markdown

# Ditchcord
Ditchcord is a self-hosted, privacy-oriented chat application built with **Svelte 5** and **SpacetimeDB**. Designed as a modern, lightweight alternative to commercial platforms, it prioritizes performance, low-latency communication, and high feature density without the bloat.
## 🚀 Features
Ditchcord offers a rich, Discord-inspired user experience backed by a highly scalable, WebAssembly-powered database architecture.
* **Multi-Server & Channel Support:** Organize your communities with dedicated Text, Voice, and Threaded channels.
* **Blazing Fast Pagination:** Uses a sophisticated hybrid "Recent Activity Cache" to load channels instantly, with on-demand expansion for deep history scrollback.
* **Real-Time Voice & Video:** Integrated WebRTC signaling via SpacetimeDB for low-latency audio channels and screen sharing.
* **Rich Media & Profiles:** Support for custom emojis, image uploads (up to 10MB), and customizable user profiles (avatars, banners, biographies).
* **Modern Svelte 5 UI:** Built with Svelte Runes for granular reactivity, featuring custom portaled dropdowns, context menus, and a responsive design that adapts to your screen.
* **Tauri Ready:** The Vite configuration is tailored for easy packaging as a native desktop application via Tauri.
## 🗺️ Roadmap
We are actively developing Ditchcord. Here is what's coming next:
* [ ] **Direct Messaging:** Private, 1-on-1 conversations outside of server contexts.
* [ ] **Mentions & Notifications:** Robust `@user` and `@role` tagging with RLS-protected notification delivery.
* [ ] **Read Status:** Unread badges and indicators for channels and servers.
* [ ] **Message Interactions:** Replying directly to messages (in addition to threading), grouping consecutive messages, and GIF integration.
* [ ] **Server Management:** Private servers, invite links, role-based permission systems, and custom server avatars.
* [ ] **Customization:** Full theming support (Dark/Light mode toggles) and hotkey shortcuts.
## 🛠️ Technology Stack
* **Frontend:** Svelte 5 (TypeScript, Vite, Vanilla CSS)
* **Backend:** SpacetimeDB (TypeScript/WASM module)
* **Real-time Comms:** WebRTC (Peer-to-peer audio/video)
* **Desktop:** Tauri (Planned/Configured)
### Architecture Highlights
Ditchcord leverages **SpacetimeDB's client-side cache model** to eliminate traditional REST API bottlenecks.
* **Zero-Latency Switching:** The client subscribes to a lightweight `recent_message` table for all joined servers on startup. This populates the UI instantly when switching channels.
* **Surgical Subscriptions:** The heavy `message` history table is only subscribed to on-demand when a user explicitly requests older messages, saving bandwidth and memory.
* **WASM Reducers:** All database mutations (sending messages, updating profiles) are handled by deterministic TypeScript reducers compiled to WebAssembly and executed transactionally on the server.
## 📦 Getting Started
### Prerequisites
* [Node.js](https://nodejs.org/) (v18+)
* [pnpm](https://pnpm.io/)
* [SpacetimeDB CLI](https://spacetimedb.com/docs/cli) (`spacetime`)
### Backend Setup (SpacetimeDB)
1. Navigate to the backend module directory:
```bash
cd spacetimedb
```
2. Install dependencies:
```bash
npm install
```
3. Publish the module to your SpacetimeDB instance (e.g., `maincloud` or a local instance). *Note: The first publish creates the database.*
```bash
spacetime publish --server maincloud ditchcord
```
4. Generate the TypeScript bindings for the frontend:
```bash
npm run spacetime:generate
```
### Frontend Setup (Svelte 5)
1. Navigate to the project root:
```bash
cd ..
```
2. Install dependencies:
```bash
pnpm install
```
3. Configure your environment variables (create a `.env.local` file if necessary) to point to your published SpacetimeDB instance:
```env
VITE_SPACETIMEDB_HOST=wss://maincloud.spacetimedb.com
VITE_SPACETIMEDB_DB_NAME=ditchcord
```
4. Run the development server:
```bash
pnpm run dev
```
## 📄 License
This project is open-source. Please see the `LICENSE` file for details.