Skip to content

Refraggerator/concord

Repository files navigation

Concord

Concord is an open-source, self-hosted communication platform inspired by modern team-chat apps, built on the Matrix protocol. It uses Synapse as the homeserver, a lightweight Go Application Service for guild management and voice tokens, and a Flutter cross-platform client.

Disclaimer: This is a purely educational project. It has no affiliation with any commercial communication platforms.


Quick Start

1. Prerequisites

  • Git
  • Docker Desktop (must be running)
  • Flutter SDK (>= 3.11)
    • Windows: Visual Studio 2022 with "Desktop development with C++" workload
    • Linux: Install Flutter manually (not via Snap); install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev

2. Set Up

git clone <repo-url> concord && cd concord
cp .env.example .env   # Edit passwords!

Open .env and replace all CHANGE_ME values. At minimum set:

  • POSTGRES_PASSWORD
  • SYNAPSE_MACAROON_SECRET, SYNAPSE_FORM_SECRET, SYNAPSE_REGISTRATION_SECRET
  • AS_TOKEN, HS_TOKEN (must match server/appservice/registration.yaml)
  • MINIO_ROOT_PASSWORD
  • LIVEKIT_API_SECRET

3. Start the Stack

docker compose up -d

This starts 7 services:

Service Container Port
PostgreSQL concord-db 5432
Redis concord-redis 6379
MinIO concord-minio 9000 / 9001
Synapse concord-synapse 8008
Application Service concord-as 8090
LiveKit concord-livekit 7880
Element Call concord-element-call 8580

Verify: docker ps should show all 7 containers running.

4. Start the App

cd app
flutter pub get
flutter run -d windows    # or -d chrome, -d linux, -d macos

On the login screen, enter:

  • Homeserver URL: http://localhost:8008
  • AS Base URL: http://localhost:8090
  • Register a new account or log in.

Architecture Summary

Flutter App ──── Matrix CS API ───► Synapse (homeserver)
     │                                  │
     │── HTTP ──► Go AS (invites,       │── PostgreSQL (synapse DB)
     │            voice tokens)         │── MinIO (media storage)
     │                                  │── Redis (cache)
     └── WebRTC ──► LiveKit (voice/video/screenshare)
  • Guild = Matrix Space, Channel = Matrix Room, Message = m.room.message
  • Voice state tracked via m.call.member state events
  • All file uploads use Matrix content repository (mxc:// URIs)
  • Presence is native Matrix presence
  • Direct messages use Matrix isDirectChat rooms

Project Structure

Concord/
├── app/                    # Flutter client
│   ├── lib/
│   │   ├── core/           # Matrix provider, router, voice service, logging
│   │   ├── features/       # auth, chat, dm, guilds, voice, settings
│   │   └── shared/         # Models (User, Guild, Channel, Message), widgets
│   ├── test/               # 290 unit/widget tests + 28 API integration tests
│   │   └── integration/    # matrix_api_test.dart (runs without a device)
│   ├── integration_test/   # 14 visual UI integration tests (requires desktop)
│   └── pubspec.yaml
│
├── server/                 # Go Application Service
│   ├── main.go
│   ├── handlers/           # guilds, invites, voice, transactions
│   ├── middleware/          # HS_TOKEN auth
│   ├── matrix/             # Synapse API client helper
│   ├── config/             # Env var loader
│   ├── models/             # Invite model
│   ├── appservice/         # registration.yaml
│   └── Dockerfile
│
├── synapse/                # Synapse configuration
│   ├── homeserver.yaml
│   ├── Dockerfile
│   └── log.config
│
├── infra/                  # init-db.sql (creates synapse DB)
├── element-call/           # config.json for Element Call
├── docker-compose.yml      # All 7 services
├── nginx_example.conf      # Production reverse proxy
├── .env.example            # Environment variable template
└── *.md                    # Documentation

Running Tests

cd app

# Unit + widget tests (290 tests, no Docker needed)
flutter test --reporter compact

# API integration tests (28 tests, requires Docker stack)
flutter test test/integration/

# Visual UI integration tests (14 tests, requires Docker stack + desktop)
flutter test integration_test/visual_test.dart -d windows

# Static analysis
dart analyze lib

Troubleshooting

  • App won't connect? Check docker ps — all 7 containers should be running. Verify homeserver URL is http://localhost:8008 and AS URL is http://localhost:8090.
  • Registration fails? Ensure SYNAPSE_REGISTRATION_SECRET in .env matches the Synapse config. Open registration is enabled by default in development.
  • Database reset: docker compose down -v && docker compose up -d (warning: deletes all data).
  • Linux build errors: Use manually installed Flutter (not Snap). Install: sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev

Contributing

Currently, this repository is open for public viewing and learning, but closed to public contributions. Only selected and approved contributors may submit Pull Requests. Please see the CONTRIBUTING.md for more details.