Convert Figma logo to code with AI

matrix-org logodendrite

Dendrite is a second-generation Matrix homeserver written in Go!

5,708
668
5,708
231

Top Related Projects

A glossy Matrix collaboration client for the web.

11,806

Synapse: Matrix homeserver written in Python/Twisted.

A Matrix-Telegram hybrid puppeting/relaybot bridge

A Matrix-WhatsApp puppeting bridge

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)

Matrix Client-Server SDK for JavaScript

Quick Overview

Dendrite is a Matrix homeserver written in Go. It is a next-generation, modular Matrix homeserver that aims to be faster, more scalable, and more reliable than the current reference implementation, Synapse.

Pros

  • Modular Design: Dendrite is designed with a modular architecture, allowing for easier maintenance, customization, and scalability.
  • Performance: Dendrite is written in Go, which provides better performance and concurrency compared to the Python-based Synapse.
  • Scalability: Dendrite is designed to handle large user bases and high traffic loads more efficiently than Synapse.
  • Reliability: Dendrite aims to be more reliable and stable than Synapse, with better error handling and recovery mechanisms.

Cons

  • Maturity: Dendrite is a relatively new project, and it may not have the same level of features and community support as Synapse.
  • Documentation: The documentation for Dendrite may not be as comprehensive as for more established projects, which can make it harder for new users to get started.
  • Adoption: Dendrite may have a slower adoption rate compared to Synapse, which is the current reference implementation and has a larger user base.
  • Compatibility: Dendrite may not be fully compatible with all existing Matrix clients and integrations, which could create compatibility issues for some users.

Getting Started

To get started with Dendrite, follow these steps:

  1. Install Go (version 1.16 or later) on your system.
  2. Clone the Dendrite repository from GitHub:
    git clone https://github.com/matrix-org/dendrite.git
    
  3. Navigate to the Dendrite directory:
    cd dendrite
    
  4. Build the Dendrite server:
    make build
    
  5. Start the Dendrite server:
    ./bin/dendrite-monolith-server
    
  6. Configure the server by editing the dendrite.yaml file in the root directory of the project.
  7. Restart the server after making any configuration changes.

That's it! You should now have a running Dendrite server that you can use to host your own Matrix homeserver.

Competitor Comparisons

A glossy Matrix collaboration client for the web.

Pros of Element Web

  • More mature and feature-rich client implementation
  • Supports a wide range of Matrix features and integrations
  • Active development with frequent updates and improvements

Cons of Element Web

  • Larger codebase, potentially more complex to maintain
  • Focused on client-side functionality, not server implementation
  • May have higher resource requirements for end-users

Code Comparison

Element Web (React-based UI component):

const RoomTile = ({ room, isSelected, onClick }) => (
  <div className={`room-tile ${isSelected ? 'selected' : ''}`} onClick={onClick}>
    <Avatar url={room.avatarUrl} name={room.name} />
    <span className="room-name">{room.name}</span>
  </div>
);

Dendrite (Go-based server component):

func (r *InternalRoom) AddEvent(event *gomatrixserverlib.Event) error {
    r.latestEvents = append(r.latestEvents, event)
    r.stateEvents[event.Type()] = event
    return nil
}

Element Web focuses on client-side UI components and user interactions, while Dendrite implements server-side logic for handling Matrix protocol events and room state management. Element Web uses JavaScript/React for frontend development, whereas Dendrite is written in Go for backend server implementation.

11,806

Synapse: Matrix homeserver written in Python/Twisted.

Pros of Synapse

  • More mature and feature-complete implementation
  • Larger community and wider adoption
  • Better documentation and support resources

Cons of Synapse

  • Higher resource consumption and less efficient scaling
  • Slower performance, especially for large deployments
  • Written in Python, which can be less performant than Go

Code Comparison

Synapse (Python):

class SyncHandler(object):
    @defer.inlineCallbacks
    def wait_for_sync_for_user(self, sync_config):
        # ... implementation details
        yield self.notifier.wait_for_events(
            sync_config.user.to_string(),
            sync_config.timeout,
            # ... additional parameters
        )

Dendrite (Go):

func (r *SyncAPIServer) OnIncomingEvent(
    ctx context.Context,
    ev *gomatrixserverlib.HeaderedEvent,
) error {
    // ... implementation details
    return r.eduServer.OnIncomingEvent(ctx, ev)
}

The code snippets showcase the different languages and approaches used in Synapse (Python) and Dendrite (Go). Synapse uses asynchronous programming with Python's defer.inlineCallbacks, while Dendrite leverages Go's concurrency model with goroutines and channels.

Dendrite aims to be a more efficient and scalable implementation of the Matrix protocol, written in Go. It's designed to address some of Synapse's limitations, such as performance and resource usage. However, Synapse remains the more mature and widely-used option, with a larger ecosystem and better documentation.

A Matrix-Telegram hybrid puppeting/relaybot bridge

Pros of mautrix-telegram

  • Specifically designed for Telegram bridging, offering deep integration with Telegram features
  • Supports end-to-end encryption for Telegram Secret Chats
  • Lightweight and focused, requiring fewer resources to run

Cons of mautrix-telegram

  • Limited to Telegram bridging, while Dendrite is a full Matrix homeserver
  • May require more frequent updates to keep up with Telegram API changes
  • Less scalable for large deployments compared to Dendrite's distributed architecture

Code Comparison

mautrix-telegram (Python):

@command_handler(needs_auth=True, needs_puppeting=True)
async def telegram_login(evt: CommandEvent) -> EventID:
    await evt.reply("You're already logged in.")
    return evt.id

Dendrite (Go):

func (r *InternalAPI) QueryAccessToken(
    ctx context.Context,
    req *api.QueryAccessTokenRequest,
    res *api.QueryAccessTokenResponse,
) error {
    device, err := r.DB.AccessTokens.GetDeviceByAccessToken(ctx, req.AccessToken)
    if err != nil {
        return err
    }
    res.Device = device
    return nil
}

The code snippets highlight the different languages and approaches used in each project, with mautrix-telegram focusing on Telegram-specific functionality and Dendrite implementing core Matrix server features.

A Matrix-WhatsApp puppeting bridge

Pros of mautrix/whatsapp

  • Focused on WhatsApp integration, providing a bridge to the popular messaging platform
  • Lightweight and specific to WhatsApp, potentially easier to set up and maintain
  • Actively developed with frequent updates and improvements

Cons of mautrix/whatsapp

  • Limited scope compared to Dendrite's full Matrix homeserver implementation
  • May require additional components for a complete Matrix ecosystem
  • Dependent on WhatsApp's API, which could be subject to changes or limitations

Code Comparison

mautrix/whatsapp:

func (puppet *Puppet) UpdateAvatar(source *User, avatar *whatsapp.ProfilePicInfo) bool {
	if avatar == nil || avatar.URL == "" {
		return puppet.DefaultAvatar(source)
	}
	// ... (additional code)
}

Dendrite:

func (r *UserInternalAPI) QueryProfile(ctx context.Context, req *api.QueryProfileRequest, res *api.QueryProfileResponse) error {
	userID, err := spec.NewUserID(req.UserID, true)
	if err != nil {
		return fmt.Errorf("QueryProfile: invalid userID: %w", err)
	}
	// ... (additional code)
}

The code snippets demonstrate the different focus areas of each project. mautrix/whatsapp deals with WhatsApp-specific functionality like avatar updates, while Dendrite handles core Matrix server operations such as profile queries.

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)

Pros of Matterbridge

  • Supports a wide range of chat platforms and protocols
  • Lightweight and easy to set up
  • Active development with frequent updates

Cons of Matterbridge

  • Limited scalability for large-scale deployments
  • Lacks some advanced features present in Dendrite

Code Comparison

Matterbridge (Go):

type Bridge struct {
    Config    *config.Config
    MyConfig  *config.Bridge
    General   *config.Protocol
    Channels  []*config.ChannelInfo
    Name      string
    Account   string
    Protocol  string
    RcvdMsgs  chan config.Message
    RcvdUsers chan config.UserInfo
    Log       *logrus.Entry
}

Dendrite (Go):

type UserInternalAPI struct {
    DB           storage.Database
    ServerName   gomatrixserverlib.ServerName
    AppServices  []config.ApplicationService
    AccountTypes []string
    Cfg          *config.Dendrite
}

Both projects are written in Go, but they serve different purposes. Matterbridge focuses on bridging multiple chat platforms, while Dendrite is a Matrix homeserver implementation. Matterbridge's code emphasizes configuration and message handling across different protocols, whereas Dendrite's code is more focused on Matrix-specific functionality and user management.

Matrix Client-Server SDK for JavaScript

Pros of matrix-js-sdk

  • Lightweight and easy to integrate into web applications
  • Extensive documentation and examples for quick implementation
  • Active community support and regular updates

Cons of matrix-js-sdk

  • Limited to client-side functionality, not suitable for server implementations
  • May require additional libraries for advanced features
  • Performance can be affected in large-scale applications

Code Comparison

matrix-js-sdk:

const client = sdk.createClient({
  baseUrl: "https://matrix.org",
  accessToken: "YOUR_ACCESS_TOKEN",
  userId: "@alice:matrix.org"
});

client.sendMessage("!roomId:matrix.org", {
  body: "Hello, Matrix!",
  msgtype: "m.text"
});

Dendrite:

func (r *InternalAPIServer) SendMessage(
    ctx context.Context,
    req *api.SendMessageRequest,
) (*api.SendMessageResponse, error) {
    // Implementation details
}

Key Differences

  • matrix-js-sdk is a JavaScript SDK for client-side Matrix protocol integration, while Dendrite is a Go-based Matrix homeserver implementation
  • matrix-js-sdk focuses on client-side operations, whereas Dendrite handles server-side functionality
  • Dendrite is more suitable for building custom Matrix servers, while matrix-js-sdk is ideal for developing Matrix-enabled web applications

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Dendrite

Build status Dendrite Dendrite Dev

Dendrite is a second-generation Matrix homeserver written in Go. It intends to provide an efficient, reliable and scalable alternative to Synapse:

  • Efficient: A small memory footprint with better baseline performance than an out-of-the-box Synapse.
  • Reliable: Implements the Matrix specification as written, using the same test suite as Synapse as well as a brand new Go test suite.
  • Scalable: can run on multiple machines and eventually scale to massive homeserver deployments.

Dendrite is beta software, which means:

  • Dendrite is ready for early adopters. We recommend running Dendrite with a PostgreSQL database.
  • Dendrite has periodic releases. We intend to release new versions as we fix bugs and land significant features.
  • Dendrite supports database schema upgrades between releases. This means you should never lose your messages when upgrading Dendrite.

This does not mean:

  • Dendrite is bug-free. It has not yet been battle-tested in the real world and so will be error prone initially.
  • Dendrite is feature-complete. There may be client or federation APIs that are not implemented.
  • Dendrite is ready for massive homeserver deployments. There is no high-availability/clustering support.

Currently, we expect Dendrite to function well for small (10s/100s of users) homeserver deployments as well as P2P Matrix nodes in-browser or on mobile devices.

If you have further questions, please take a look at our FAQ or join us in:

Requirements

See the Planning your Installation page for more information on requirements.

To build Dendrite, you will need Go 1.21 or later.

For a usable federating Dendrite deployment, you will also need:

  • A domain name (or subdomain)
  • A valid TLS certificate issued by a trusted authority for that domain
  • SRV records or a well-known file pointing to your deployment

Also recommended are:

  • A PostgreSQL database engine, which will perform better than SQLite with many users and/or larger rooms
  • A reverse proxy server, such as nginx, configured like this sample

The Federation Tester can be used to verify your deployment.

Get started

If you wish to build a fully-federating Dendrite instance, see the Installation documentation. For running in Docker, see build/docker.

The following instructions are enough to get Dendrite started as a non-federating test deployment using self-signed certificates and SQLite databases:

$ git clone https://github.com/matrix-org/dendrite
$ cd dendrite
$ go build -o bin/ ./cmd/...

# Generate a Matrix signing key for federation (required)
$ ./bin/generate-keys --private-key matrix_key.pem

# Generate a self-signed certificate (optional, but a valid TLS certificate is normally
# needed for Matrix federation/clients to work properly!)
$ ./bin/generate-keys --tls-cert server.crt --tls-key server.key

# Copy and modify the config file - you'll need to set a server name and paths to the keys
# at the very least, along with setting up the database connection strings.
$ cp dendrite-sample.yaml dendrite.yaml

# Build and run the server:
$ ./bin/dendrite --tls-cert server.crt --tls-key server.key --config dendrite.yaml

# Create an user account (add -admin for an admin user).
# Specify the localpart only, e.g. 'alice' for '@alice:domain.com'
$ ./bin/create-account --config dendrite.yaml --username alice

Then point your favourite Matrix client at http://localhost:8008 or https://localhost:8448.

Progress

We use a script called "Are We Synapse Yet" which checks Sytest compliance rates. Sytest is a black-box homeserver test rig with around 900 tests. The script works out how many of these tests are passing on Dendrite and it updates with CI. As of January 2023, we have 100% server-server parity with Synapse, and the client-server parity is at 93% , though check CI for the latest numbers. In practice, this means you can communicate locally and via federation with Synapse servers such as matrix.org reasonably well, although there are still some missing features (like SSO and Third-party ID APIs).

We are prioritising features that will benefit single-user homeservers first (e.g Receipts, E2E) rather than features that massive deployments may be interested in (OpenID, Guests, Admin APIs, AS API). This means Dendrite supports amongst others:

  • Core room functionality (creating rooms, invites, auth rules)
  • Room versions 1 to 10 supported
  • Backfilling locally and via federation
  • Accounts, profiles and devices
  • Published room lists
  • Typing
  • Media APIs
  • Redaction
  • Tagging
  • Context
  • E2E keys and device lists
  • Receipts
  • Push
  • Guests
  • User Directory
  • Presence
  • Fulltext search

Contributing

We would be grateful for any help on issues marked as Are We Synapse Yet. These issues all have related Sytests which need to pass in order for the issue to be closed. Once you've written your code, you can quickly run Sytest to ensure that the test names are now passing.

If you're new to the project, see our Contributing page to get up to speed, then look for Good First Issues. If you're familiar with the project, look for Help Wanted issues.