Get real-time PostgreSQL database change notifications in Elixir applications via triggers and PubSub.
EctoWatch is an Elixir library that provides real-time notifications for database changes directly from PostgreSQL. It solves the problem of inconsistent or missed PubSub broadcasts in application code by using database triggers to capture every insert, update, and delete operation. This ensures reliable and standardized change notifications across your entire system.
Elixir developers building real-time applications with Phoenix, LiveView, or channels who need reliable database change notifications. It's particularly useful for teams managing complex data flows or scaling PubSub usage.
Developers choose EctoWatch because it guarantees notifications for all database changes, eliminates manual broadcast boilerplate, and provides consistent message formats. Its lightweight default payloads and PostgreSQL-native approach make it more reliable and scalable than application-level solutions.
EctoWatch allows you to easily get notifications about database changes directly from PostgreSQL.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses PostgreSQL triggers to monitor all inserts, updates, and deletions, ensuring no change is missed—even from external database clients or raw SQL queries.
Provides consistent PubSub messages for each schema and operation type, eliminating the inconsistency and bugs common in manual broadcast implementations.
By default, only sends record IDs in notifications, minimizing memory usage and improving scalability compared to transmitting full records.
Supports subscriptions to all changes, specific records, or filtered by association columns, offering granular control tailored to different use cases.
Only compatible with PostgreSQL, making database migration difficult and limiting choice for teams considering multi-database strategies.
Adding triggers to tables can introduce latency on write operations, which may degrade performance in write-heavy applications unless carefully optimized.
The README recommends disabling EctoWatch in test mode, requiring additional mocking or configuration to simulate change events effectively in tests.