Spacebar

A free, self-hostable Discord-compatible platform giving you full control over your chat, voice, and video community.

6.7Kstars
223forks
GNU AGPLv3

Spacebar is an open-source reimplementation of Discord’s backend and client that lets individuals, communities, and organizations run their own fully-featured communication platform. It replicates Discord’s REST API, WebSocket gateway, CDN, and WebRTC voice/video stack so that existing Discord bots, third-party clients, and integrations work with minimal changes.

The project is organized as a GitHub organization with dedicated repositories for the server, client, documentation, and landing page. The server supports PostgreSQL, MySQL, SQLite, and MariaDB out of the box, making it suitable for everything from single-user homelab setups to large community deployments. A public list of community-run instances is maintained in the main repository, and users can connect to any compatible instance using the official client or unmodified Discord clients.

Spacebar is licensed under AGPL-3.0 and developed entirely by volunteers. It targets technical self-hosters who want Discord’s familiar UX without surrendering data to a centralized service, and community builders who need configurable moderation, message limits, and rate-limiting policies that Discord’s platform does not expose.

What You Get

  • Discord API compatibility layer - Implements Discord’s REST endpoints, WebSocket gateway opcodes, and CDN so existing bots and third-party Discord clients connect with minimal code changes.
  • Modular server stack - Independent services for API, gateway, CDN, WebRTC voice/video, and admin dashboard can each be started separately or bundled together in a single process.
  • Multi-database support - TypeORM integration supports PostgreSQL, MySQL, MariaDB, and SQLite so you can match the database to your infrastructure from day one.
  • Cross-platform desktop client - The official client is built with React 18 and Tauri, delivering native desktop apps for Windows, macOS, and Linux alongside a web client.
  • Plugin and theme system - Secure, cross-platform plugin architecture and a built-in design editor allow administrators and users to extend and customize the interface.
  • Community instance directory - A curated, community-maintained list of public Spacebar instances lets users join verified or community-run servers beyond the official instance.
  • Crowdin-backed localization - Active translation through Crowdin makes the platform accessible in multiple languages with community-driven i18n support.

Common Use Cases

  • Private gaming community - A gaming group self-hosts Spacebar on a VPS to maintain a Discord-like server with voice channels and bot automation, avoiding platform bans and data-sharing concerns.
  • On-premises enterprise chat - A tech company replaces Slack or Discord with a Spacebar instance on their own servers to meet data residency requirements and keep all communications internal.
  • Bot ecosystem migration - A developer running a suite of Discord bots points them at a Spacebar gateway with minimal endpoint changes to test new features or avoid Discord’s API rate limits.
  • Open-source project hub - An open-source project hosts its community support channel on Spacebar for full control over moderation policies, message retention, and no corporate censorship.
  • Educational institution - A university deploys Spacebar for student clubs and study groups, applying custom message limits and moderation rules suited to their institutional policies.

Under The Hood

Architecture Spacebar’s server follows a service-oriented modular design where the API, WebSocket gateway, CDN, and WebRTC media server are fully independent processes that can be started separately or combined in a single bundle entrypoint. Each service layer has its own startup lifecycle and middleware pipeline, with the API layer using a layered Express structure — authentication, CORS, rate-limiting, and error handling are composed as discrete middleware before requests reach route handlers. The gateway service maintains WebSocket connections with Discord-compatible opcode dispatching, and the database layer is cleanly abstracted through a shared TypeORM-based package that all services import. This separation means individual components can be scaled or replaced independently, which is well-suited to community deployments of varying sizes.

Tech Stack The server is written in TypeScript targeting Node.js, using Express for the HTTP API layer and the ws library for raw WebSocket handling in the gateway and WebRTC services. Persistence is handled via TypeORM with migration support across PostgreSQL, MySQL, MariaDB, and SQLite, making the platform deployable on anything from a Raspberry Pi to a managed cloud database. RabbitMQ is supported for inter-service messaging at scale. The official client is built with React 18, MobX for reactive state management, styled-components for theming, and Tauri for cross-platform native desktop packaging — meaning the same codebase ships as a web app and native desktop binary. Build tooling uses TypeScript’s compiler with project references and Vite for the client.

Code Quality The codebase uses TypeScript in strict mode throughout, with ESLint and Prettier enforced by Husky pre-commit hooks, giving the project consistent formatting and type safety at commit time. Testing uses Node.js’s built-in node:test framework rather than a third-party harness, with meaningful unit tests covering utility classes and JSON serialization. Test coverage is limited to utility-level modules rather than integration scenarios, so core Discord protocol handling is not formally verified by automated tests. License headers are present in every source file, and code comments explain protocol-level decisions and known limitations, making the codebase approachable for contributors navigating Discord’s undocumented internals.

What Makes It Unique What sets Spacebar apart is the breadth and depth of Discord API coverage it achieves entirely through reverse engineering. Reimplementing Discord’s proprietary WebSocket gateway opcodes, voice WebRTC signaling, CDN media handling, and bot permission model in a single open-source stack is a substantial technical undertaking with no direct parallel in the self-hosting ecosystem. The decision to support four different database backends through a shared ORM layer — rather than committing to a single database — lowers the barrier to adoption for self-hosters with existing infrastructure. The Tauri-based client is also notable for delivering a genuinely native desktop experience rather than wrapping Electron, which keeps memory usage lower on end-user machines.

Self-Hosting

Spacebar is released under the GNU Affero General Public License v3.0 (AGPL-3.0), a strong copyleft license designed specifically for network server software. In practical terms, AGPL requires that if you run a modified version of Spacebar as a networked service — even privately — you must make the modified source code available to users of that service. For most self-hosters running the software as-is, this has no impact. However, organizations that fork and modify Spacebar before deploying it internally or publicly are obligated to open-source those modifications. There are no commercial use restrictions — you may run Spacebar for business purposes without a commercial license — but the copyleft obligation means proprietary customizations cannot stay private.

Running Spacebar in production requires meaningful operational investment. The platform is composed of multiple services (API, gateway, CDN, WebRTC, optionally RabbitMQ) that each need to be deployed, kept updated, and monitored. A reverse proxy (nginx is included in configuration examples) must be configured to route traffic correctly. Database migrations need to be applied manually when upgrading. Voice and video through WebRTC requires either a TURN/STUN server or media relay infrastructure for users behind NAT. There is no automated backup, high-availability configuration, or zero-downtime upgrade path provided out of the box — these are responsibilities the operator takes on. The project is volunteer-maintained, so security patches and compatibility updates may lag behind Discord protocol changes.

There is no paid cloud or managed tier for Spacebar — it is a purely community-driven open-source project. This means everything you would expect from a managed service (SLAs, 24/7 support, automatic upgrades, managed backups, HA clustering) must be built and maintained by you. Support is available through the project’s own Discord guild and community documentation, but response times are best-effort from volunteers. Organizations that need enterprise-grade uptime guarantees or dedicated support would need to hire engineers to operate the stack, as there is no commercial support offering.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack

No spam. Unsubscribe anytime.

Join 750+ subscribers
No spam. Unsubscribe anytime.

Search