Overview
Discover what makes Synapse powerful
Synapse is the reference implementation of a Matrix homeserver, written primarily in **Python 3** and built on top of the **Tornado** web framework. It acts as a full‑fledged communication engine that accepts Matrix clients (web, desktop, mobile) and forwards events to other homeservers in a federated network. From a developer’s perspective, Synapse is not just an end‑to‑end messaging service; it exposes a rich set of RESTful APIs, websockets for real‑time updates, and a pluggable module system that lets you extend or replace core behaviour without touching the kernel.
Core runtime
Database layer
Worker model
Configuration
Overview
Synapse is the reference implementation of a Matrix homeserver, written primarily in Python 3 and built on top of the Tornado web framework. It acts as a full‑fledged communication engine that accepts Matrix clients (web, desktop, mobile) and forwards events to other homeservers in a federated network. From a developer’s perspective, Synapse is not just an end‑to‑end messaging service; it exposes a rich set of RESTful APIs, websockets for real‑time updates, and a pluggable module system that lets you extend or replace core behaviour without touching the kernel.
Architecture
- Core runtime – Tornado async HTTP server, leveraging Python’s
asyncioevent loop for high‑concurrency handling of Matrix protocol requests. - Database layer – Supports PostgreSQL (recommended), MySQL, SQLite, and an in‑memory variant for testing. Data is accessed via a lightweight ORM built on top of
sqlalchemy‑like abstractions, with schema migrations managed by a custom migration tool. - Worker model – Synapse can be split into multiple processes: the main “homeserver” process and optional “worker” processes (e.g.,
event,media,federation). Workers communicate over ZeroMQ (or a simple TCP socket) and share a common database, allowing horizontal scaling by adding more workers to handle specific workloads. - Configuration – YAML‑based config files (
homeserver.yaml) that expose a wide range of knobs: listening ports, TLS certificates, federation settings, caching backends (Redis or in‑process), and module hooks. - Logging – Structured JSON logs by default, with support for log aggregation via
systemd,journald, or external services.
Core Capabilities
- Admin API – Full REST interface for user and room management, server diagnostics, and analytics. Endpoints include
/admin/v1/users,/admin/v1/rooms, and federation‑specific routes. - Pluggable modules – Implemented as Python classes that register callbacks for Matrix events (
on_room_event,on_user_join). Modules can modify or drop events, add custom authentication backends, or inject additional data into the event stream. - Webhooks – Built‑in support for exposing outbound webhooks on state changes, useful for integrating with external systems like CI/CD pipelines or monitoring dashboards.
- Federation – Implements the Matrix federation protocol (v1.0+), enabling secure, authenticated cross‑server communication with cryptographic signatures and end‑to‑end encryption support.
- Metrics – Exposes Prometheus metrics (
/metrics) covering request latency, worker queue depth, and database connection pools.
Deployment & Infrastructure
Synapse is designed for self‑hosting in a variety of environments:
- Containerization – Official Docker images are available on Docker Hub. The container exposes configurable ports (
8448for HTTPS,8009for federation) and can be orchestrated with Kubernetes or Docker Compose. For high‑availability, run multiple replicas behind a load balancer that respects the Matrix federation protocol. - Scaling – Horizontal scaling is achieved by adding more worker processes or container instances. Synapse’s stateless HTTP workers can be replicated, while the database remains a single source of truth. Redis is optional but highly recommended for caching and rate‑limiting.
- High‑Availability – Use PostgreSQL replication or a managed database service. Synapse’s ZeroMQ workers are stateless, so they can be restarted without losing in‑flight events.
- Monitoring – Integrate with Prometheus, Grafana, or ELK stacks. The built‑in metrics endpoint and structured logs make it straightforward to surface performance indicators.
Integration & Extensibility
- Modules – The plugin system allows developers to write custom authentication providers (e.g., OAuth2, LDAP), enrich event payloads, or enforce organization‑specific policies. Modules are loaded via
synapse.module_loader. - Webhooks & Callbacks – Expose custom endpoints that react to room creation, user registration, or message events. These can trigger external workflows or update third‑party dashboards.
- SDKs & Clients – While Synapse itself is a server, the Matrix ecosystem provides client SDKs in JavaScript, Python, Rust, and others. Developers can build custom bots or integrations that interact with Synapse through the standard Matrix APIs.
- Federation Hooks – Advanced developers can tap into federation protocols, inspecting or modifying outbound requests to other homeservers. This is useful for compliance‑aware deployments that need to filter or transform cross‑server traffic.
Developer Experience
- Documentation – The official docs cover installation, configuration, and advanced topics like migration scripts. The API reference is exhaustive, with example payloads for every endpoint.
- Community – Synapse has a large contributor base on GitHub, with an active issue tracker and “good first issue” labels. The Matrix community channels (e.g.,
#synapse:matrix.org) provide real‑time support. - Testing & Linting – The codebase uses
pytestand a custom linting pipeline. Developers can run unit tests locally against an in‑memory SQLite database, speeding up the feedback loop. - Continuous Integration – Automated CI runs on every PR, ensuring that new code passes tests and adheres to style guidelines before merging.
Use Cases
- Enterprise Messaging – Companies can deploy Synapse as an internal chat platform with SSO integration (OAuth2, SAML) and custom authentication modules.
- Federated Collaboration – Educational institutions or
Open SourceReady to get started?
Join the community and start self-hosting Synapse today
Related Apps in apis-services
Mastodon
Decentralized, real‑time social networking
Discourse
Open‑source community forum platform with real‑time chat and AI
Rocket.Chat
Secure, open‑source team communication platform
Novu
Unified notification platform for multi‑channel delivery
Mattermost
Secure, self‑hosted team collaboration with chat, voice, and AI
Jitsi Meet
Free, encrypted video conferencing for everyone
Weekly Views
Repository Health
Information
Explore More Apps
FlashPaper
Zero‑knowledge one‑time secret sharing, no database needed
Nullboard
Compact, offline kanban board for quick task management
Local Content Share
Share text, files, and links locally without client setup
Metabase
Easy open‑source business intelligence for everyone
LedgerSMB
Open-source ERP for small‑to‑medium businesses
Puter
Your personal internet OS for files, apps, and games