Jannis Braun 95c9666213 build(server): drop stale project reference to @backspace/shared
The three typecheck failures in ws/events.ts for DmCallUndeliverable{Failure,Reason}
and 'dm_call_undeliverable' looked like missing exports from @backspace/shared,
but the types are fully defined and exported in packages/shared/src/types.ts
(lines 361, 367, 429). The real cause was architectural.

packages/server/tsconfig.json declared:

    "references": [{ "path": "../shared" }]

TypeScript project references make the dependent project's typecheck consume
the referenced project's *build output* (dist/*.d.ts), not its sources. The
shared package's dist is gitignored, is not rebuilt by any script before
`pnpm -r typecheck` or `pnpm --filter @backspace/server typecheck`, and the
referenced-project-stale failure mode surfaces as TS6305 in the server, or
(when the dist is present but older) as "no exported member" for types
that were added after the last shared build. The #16 merge (which added
DmCallUndeliverableFailure/Reason and the dm_call_undeliverable event
variant) landed the types in src but the local dist was never refreshed,
so server's typecheck started failing against the stale .d.ts.

packages/web/tsconfig.json already resolved @backspace/shared via
`moduleResolution: "bundler"` + the package.json `exports` field, which
points directly at ./src/types.ts. That path has no build-ordering
dependency, never goes stale, and already typecheck-passes cleanly.

Fix: remove the server-side project reference so server matches web's
bundler-style resolution. Server still emits its own dist on `tsc` (its
rootDir confines emission to its own src/); the runtime already reads
TS directly via tsx, so nothing in the dev or prod run path changes.
The Dockerfile/root build scripts that build shared explicitly are also
unaffected.

Verified: `pnpm -r typecheck` passes for shared and server; standalone
`pnpm exec tsc --noEmit` in packages/web passes; `pnpm build` completes
all three packages.

Fixes #24 (pre-existing typecheck failure on main).
2026-04-21 22:27:51 +02:00

Backspace

Open-source, self-hosted Discord alternative built with TypeScript.

Features

  • Real-time text messaging with WebSocket
  • Servers, channels, and role-based permission management
  • Voice and video chat via LiveKit
  • Screen sharing with configurable quality (VP9)
  • Direct messages (1-on-1 and group DMs up to 10)
  • DM voice/video calls with ringing
  • Friend system with requests
  • File uploads and image sharing
  • Markdown message formatting with syntax highlighting
  • Message reactions, replies, and editing
  • Typing indicators, presence status, and read states
  • Invite system with shareable codes
  • Instance-level admin panel (streaming limits)
  • Desktop app (Electron)
  • Mobile-responsive web UI
  • Docker deployment

Tech Stack

Layer Technology
Backend Fastify + TypeScript
Database SQLite (better-sqlite3) + Drizzle ORM
Auth JWT + bcrypt
Real-time WebSocket (ws)
Frontend React 18 + Tailwind CSS + Zustand
Voice/Video LiveKit
Desktop Electron
Build Vite + pnpm workspaces

Quick Start with Docker

# Clone the repository
git clone https://github.com/your-username/backspace.git
cd backspace

# Create environment file
cp .env.example .env

# Generate a JWT secret
echo "JWT_SECRET=$(openssl rand -hex 32)" >> .env

# Start Backspace
docker compose up -d

Open http://localhost:3000 in your browser. A default server "Backspace" is created automatically.

Default admin account: admin / admin123 (change this after first login).

Development Setup

Prerequisites

  • Node.js 20+
  • pnpm 8+

Install

pnpm install

Configure

cp .env.example .env
# Edit .env with your settings (generate a JWT_SECRET)

Run

# Start both server and web dev server
pnpm dev

# Or start individually
pnpm dev:server    # API server on :3005
pnpm dev:web       # Vite dev server on :5173

Build

pnpm build

This builds the shared types, server, and web frontend. The server serves the built frontend in production mode.

Project Structure

Backspace/
├── packages/
│   ├── shared/       # Shared TypeScript types & permissions
│   ├── server/       # Fastify API + WebSocket server
│   ├── web/          # React frontend (Vite + Tailwind)
│   └── desktop/      # Electron desktop app
├── data/             # SQLite DB + uploads (created at runtime)
├── Dockerfile
├── docker-compose.yml
└── .env.example

Voice & Video

Voice and video requires a LiveKit server. Set these in your .env:

LIVEKIT_URL=wss://your-livekit-server
LIVEKIT_API_KEY=your-api-key
LIVEKIT_API_SECRET=your-api-secret

Without LiveKit configured, text chat works fully but voice/video channels will not connect.

API

The server exposes a REST API and WebSocket endpoint:

  • REST API: http://localhost:3000/api/*
  • WebSocket: ws://localhost:3000/ws
  • Health check: GET /api/health

See CLAUDE.md for the full API reference.

Desktop App

The Electron desktop app wraps the web UI and adds system tray, notifications, and native window controls.

cd packages/desktop
pnpm build:ts    # Compile TypeScript
pnpm dev         # Run in development
pnpm build       # Package for distribution

License

MIT

S
Description
Fork proprio do Backspace — instancia chat.resenha.website
Readme AGPL-3.0
22 MiB
Languages
TypeScript 96.8%
HTML 1.3%
Shell 1.1%
JavaScript 0.4%
CSS 0.3%