Skip to content

About

Open-source Discord alternative with real-time messaging, voice/video calls, and self-hosted control. Built with Next.js, Fastify, and PostgreSQL.

Topics

Resources

Stars

70 stars

Watchers

0 watching

Forks

Latest commit

 

History

267 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FreedomTalk

Own Your Conversations.

An open-source, self-hosted real-time communication platform.

CI: unit, integration & e2e tests


FreedomTalk is a Discord-style communication platform you can run on your own infrastructure. It ships a Fastify + Socket.io backend and a Next.js web app organized as an npm-workspaces monorepo, backed by PostgreSQL, Redis, and RabbitMQ. Core community features are implemented end to end — accounts and authentication, servers with roles and permissions, channels, direct messages, friends, real-time messaging with reactions and attachments, search, and WebRTC-based voice — with automated test coverage at both the API and end-to-end levels (500+ Vitest unit/integration tests on real Postgres/Redis/RabbitMQ via Testcontainers, Playwright suites, and a k6 load suite with published results).

Features

  • Accounts & Authentication — registration with email verification, login with sessions, JWT access/refresh tokens, password reset, multi-factor authentication (TOTP), and session invalidation.
  • Servers (Communities) — create and manage servers with channels, roles, and a permission system; server discovery and invite links.
  • Real-Time Messaging — instant chat over Socket.io with Markdown formatting, emoji reactions, embeds, and file attachments.
  • Direct Messages & Friends — one-on-one DMs, friend requests, and presence.
  • Search — message and server search.
  • Voice — WebRTC voice backed by a mediasoup SFU (experimental).
  • Worker Pipeline — message events flow through RabbitMQ (topic exchange, per-queue consumers with retry + dead-letter semantics) to background workers for Meilisearch indexing, link-embed generation, and mention notifications — off the request path.
  • Observability — readiness endpoint probing every dependency (/ready), OpenTelemetry traces propagated across the API → RabbitMQ → worker boundary, structured pino logging, and Prometheus metrics with a shipped Grafana dashboard (deploy/).
  • Platform Plumbing — webhooks, audit logs, and Prometheus-style metrics endpoints.
  • Self-Hosted — everything runs in Docker Compose on your hardware. Your data, your rules.

Architecture

FreedomTalk architecture — client → nginx/API → RabbitMQ workers → data stores, mediasoup SFU path

Messages traverse the API once and fan out through RabbitMQ to the search, embed, and mention workers; Socket.io state (presence, typing) propagates across API nodes over a Redis pub/sub bus, so the gateway scales horizontally. See docs/scaling.md for the multi-node topology and the mediasoup SFU scaling path.

Tech Stack

Backend (packages/api)

Technology Purpose
Fastify 5.x High-performance HTTP framework (Helmet, CORS, rate limiting, Swagger)
Socket.io 4.x Real-time WebSocket communication (Redis adapter for scaling)
PostgreSQL + Knex Persistence with migrations and seeds
Redis Caching, pub/sub, rate limiting
RabbitMQ Message queue for background work
mediasoup WebRTC SFU for voice
TypeScript + Zod Type-safe development and schema validation

Frontend (packages/web)

Technology Purpose
Next.js 16 (App Router) React framework
React 19 UI
Tailwind CSS Styling
Socket.io Client Real-time updates

Infrastructure

  • Docker / Docker Compose — containerized development environment
  • npm Workspaces — monorepo management

Quick Start

Prerequisites

  • Node.js 20+
  • npm 10+
  • Docker & Docker Compose

Installation

  1. Clone the repository

    git clone https://github.com/notdezzi/freedomtalk.git
    cd freedomtalk
  2. Install dependencies

    npm install
  3. Start infrastructure services

    npm run docker:up
  4. Configure environment variables

    cp packages/api/.env.example packages/api/.env
    cp packages/web/.env.example packages/web/.env.local

    Update the .env files with your specific configuration before proceeding.

  5. Run database migrations

    npm run migrate:latest --workspace=@freedomtalk/api
  6. Launch development servers

    npm run dev

Your FreedomTalk instance is now running.

Available Commands

Root Level

npm run dev              # Start all packages in development mode
npm run build            # Build all packages for production
npm run start            # Start production servers
npm run format           # Format code with Prettier
npm run type-check       # TypeScript type checking
npm run test:unit        # Vitest unit + integration tests (Testcontainers)
npm run clean            # Remove build artifacts

Docker Infrastructure

npm run docker:up        # Start PostgreSQL, Redis, RabbitMQ
npm run docker:down      # Stop all services
npm run docker:logs      # View service logs

API Package

npm run dev --workspace=@freedomtalk/api              # Development server
npm run migrate:latest --workspace=@freedomtalk/api   # Run migrations
npm run migrate:make --workspace=@freedomtalk/api     # Create a migration
npm run test --workspace=@freedomtalk/api             # Run Vitest unit tests

Web Package

npm run dev --workspace=@freedomtalk/web    # Development with Turbopack
npm run build --workspace=@freedomtalk/web  # Production build
npm run start --workspace=@freedomtalk/web  # Production server

Testing

Unit and integration tests run on Vitest against real dependencies spun up with Testcontainers (Postgres, Redis, RabbitMQ) — no mocked repositories. End-to-end and API-level flows use Playwright. All of it runs in CI on every push.

npm run test:unit        # Vitest unit + integration tests (Testcontainers)
npm test                 # Full Playwright suite (API + e2e)
npm run test:api         # API integration tests only
npm run test:e2e         # End-to-end tests (Chromium)
npm run test:ui          # Interactive Playwright UI mode

The Socket.IO gateway, message pipeline, voice signaling plane, and connection churn are additionally covered by a k6 load suite with published results — message ack p95 of 13 ms at 20 VUs and 10,400 churn cycles/min with zero failures on a 20-core dev box.

Project Structure

freedomtalk/
├── packages/
│   ├── api/          # Backend API server (Fastify + Socket.io + mediasoup)
│   ├── web/          # Web application (Next.js)
│   ├── shared/       # Shared types, permissions, and utilities
│   ├── desktop/      # Desktop app (Electron) — experimental
│   ├── mobile/       # Mobile app (React Native) — experimental
│   └── scripts/      # DB backup/restore and maintenance scripts
├── tests/            # Playwright e2e tests
├── load/             # k6 load tests + published results (load/README.md)
├── docs/             # Setup, architecture, scaling, and roadmap docs
├── deploy/           # Prometheus, Grafana dashboard, OTel collector, nginx configs
├── docker-compose.yml          # Local infra + observability stack
├── docker-compose.scale.yml    # Multi-node topology (2 API nodes + worker behind nginx)
├── docker-compose.prod.yml     # Production deployment (Caddy TLS, WebRTC port range)
├── Dockerfile.api     # API + worker image (multi-stage, npm workspaces)
├── playwright.config.ts
└── package.json

Infrastructure Services

Service Port Purpose
PostgreSQL 5432 Primary database
Redis 6379 Caching, pub/sub, rate limiting, multi-node WS bus
RabbitMQ 5672 Domain-event pipeline (search/embeds/mentions workers)
RabbitMQ Management 15672 Admin UI at http://localhost:15672
Meilisearch 7700 Message/server search index
OTel Collector 4318 OpenTelemetry trace ingestion (→ Jaeger at http://localhost:16686)
Prometheus 9090 Metrics scraping
Grafana 3001 Dashboards at http://localhost:3001 (provisioned from deploy/)

Roadmap

Shipped

  • Monorepo architecture with npm workspaces
  • Backend API with Fastify + Socket.io
  • Frontend application with Next.js
  • Authentication: sessions, JWT refresh, email verification, password reset, MFA
  • Servers, channels, roles, and permissions
  • Real-time messaging with reactions, embeds, and attachments
  • Direct messages and friends
  • Search
  • Webhooks, audit logs, and metrics
  • RabbitMQ worker pipeline (search indexing, link embeds, mention notifications)
  • OpenTelemetry tracing across the API → queue → worker boundary
  • Multi-node WebSocket: Redis-backed presence/typing, docker-compose.scale.yml
  • API (Vitest) and end-to-end (Playwright) test suites, k6 load suite

In Progress

  • Voice calling (mediasoup SFU) — experimental
  • Desktop application (Electron)
  • Mobile application (React Native)

Planned

  • Plugin/extension system
  • Self-hosting deployment guides

Documentation

Documentation is organized under docs/:

Development Workflow

  1. Create a feature branch from main
  2. Implement your changes
  3. Run quality checks:
    npm run type-check
  4. Build all packages:
    npm run build
  5. Test your changes:
    npm test
  6. Commit, push, and open a pull request

FreedomTalk — Because your conversations deserve freedom.

About

Open-source Discord alternative with real-time messaging, voice/video calls, and self-hosted control. Built with Next.js, Fastify, and PostgreSQL.

Topics

Resources

Stars

70 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages