hex_core
walex
hex_core | walex | |
---|---|---|
1 | 17 | |
95 | 256 | |
- | - | |
4.9 | 9.1 | |
about 1 month ago | 9 days ago | |
Erlang | Elixir | |
Apache License 2.0 | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
hex_core
-
Elixir Nitpicks
We give similar examples in our anti-patterns docs: https://hexdocs.pm/elixir/main/code-anti-patterns.html#compl...
## State management
Generally agreed. Just one nit:
> Sure the state is all encapsulated into processes, but then those processes are hidden behind an abstraction layer that makes them invisible, so really you’re just touching global variables.
They are not invisible. You can use Observer, the Phoenix Live Dashboard, and many other tools to traverse, explore, and navigate the supervision tree, processes, and see where all state is!
## Imports
Agreed. We had several discussions on how to improve this but nothing satisfactory. Maybe it is time for another tango.
## Mixed messages
I'd say we actually do a good job on the official docs on the topics that are directly related to Elixir:
* On umbrella projects, the official guide discusses trade-offs: https://hexdocs.pm/elixir/dependencies-and-umbrella-projects...
* Live upgrades are covered in our release docs: https://hexdocs.pm/mix/Mix.Tasks.Release.html#module-hot-cod...
* On macros: https://hexdocs.pm/elixir/macro-anti-patterns.html#unnecessa...
I assume the trouble is in finding this information, so if anyone finds we should link to them from other places, pull requests are welcome. In general, PRs to improve docs are always gladly received, be in Elixir, Ecto, or elsewhere!
## Others
> Anecdotally, when Elixir started off there was some bad blood between them and the Erlang community, which is the origin of this schism
No bad blood, really. I asked the `rebar` team (not the current `rebar3`) if they would accept PRs to also compile Elixir, they said no (which is understandable) and then we move forward with `mix` (which was a contribution from a Clojure developer inspired by `lein`). The projects drifted apart but we often share whatever we can in other places (such as https://github.com/hexpm/hex_core).
> In fact the Elixir compiler almost never gives you an outright error, basically it only fails if a file can’t be parsed. This feels spooky as hell… but its warnings are basically always correct and seldom miss anything
Yes! Our goal is to avoid halting compilation as much as possible and instead rely on precise warnings. It is easier to debug a program that compiles (and then raises) than one that does not compile at all.
walex
-
The Guide to PostgreSQL Data Change Tracking
The WAL CDC approach: https://github.com/cpursley/walex?tab=readme-ov-file#publica...
CREATE PUBLICATION news_item FOR TABLE news WHERE (topic IS "AAPL");
-
Elixir Nitpicks
What do you mean testing with processes?
I won't suggest these are the best written tests, but I test various processes, supervisors, etc like this:
https://github.com/cpursley/walex/blob/master/test/walex/sup...
-
PostgreSQL Is Enough
You don’t send the entire WAL, just what you subscribe to - and you can even filter via SQL: https://github.com/cpursley/walex?tab=readme-ov-file#publica...
- A Technical Dive into PostgreSQL's replication mechanisms
-
Fly Postgres, Managed by Supabase
What we do is much if the business logic in Postgres. But then there’s all the other stuff like external integrations, etc.
We handled that by having an Even system built on the Postgres WAL that we use like a callback system.
I put together a little library in Elixir (that originally started out as forked Supabase realtime) for this:
https://github.com/cpursley/walex
Recently added the ability to configure WalEx to forward events to webhooks or EventRelay (so you don’t need to know Elixir).
-
All the ways to capture changes in Postgres
If you're using Elixir, check out https://github.com/cpursley/walex
I've actually been thinking about turning this idea into a product where you can just point it at your postgres database and select the tables you want to listen to (with filters, like you describe). And have that forwarded to a webhook (with possibility of other protocols).
I'd love to hear folks thoughts on that (and if it would be something people would pay for).
-
Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps
Neat, this is the pattern I've been thinking about for a while now. Also glad to see this is Elixir based.
I've been using https://github.com/cpursley/walex (basically a fork of cainophile via a fork for subabase) to listen to Postgres changes in Elixir.
-
How to Listen to Database Changes Using Postgres Triggers in Elixir
https://github.com/cpursley/walex
Which is based on WAL logs and doesnt have the same limitations.
-
PostgreSQL Logical Replication Gotchas
Great writeup, just added this to the WalEx readme:
https://github.com/cpursley/walex
(WalEx is an Elixir lib for listening to the WAL and perform callback-like actions with the data)
-
We used Elixir's Observer to hunt down bottlenecks
Very cool.
I'm using Elixir to listen to change events via https://github.com/cpursley/walex (which I basically ripped off from Supabase).
What are some alternatives?
PolarDB-for-PostgreSQL - A cloud-native database based on PostgreSQL developed by Alibaba Cloud.
neon - Neon: Serverless Postgres. We separated storage and compute to offer autoscaling, branching, and bottomless storage.
realtime - Broadcast, Presence, and Postgres Changes via WebSockets
libcluster - Automatic cluster formation/healing for Elixir applications
worker - High performance Node.js/PostgreSQL job queue (also suitable for getting jobs generated by PostgreSQL triggers/functions out into a different work queue)
helm-charts - neondatabase helm charts
supavisor - A cloud-native, multi-tenant Postgres connection pooler.
sql-task-queue
sorg - A Go-based static site generator that compiles brandur.org.
zenith - The serverless open source alternative to AWS Aurora Postgres. [Moved to: https://github.com/neondatabase/neon]
Que - A Ruby job queue that uses PostgreSQL's advisory locks for speed and reliability.
connectors - Connectors for capturing data from external data sources