Event-driven backend written in Gleam: an HTTP API and two RabbitMQ consumers running as separate Erlang processes, backed by PostgreSQL.
Built for a code challenge, and mostly an excuse to find out what the BEAM gives you when the language on top is typed.
HTTP (Wisp/Elli, :3000) ──> handlers ──> repositories ──> PostgreSQL
│
RabbitMQ topics ──> "users" ─────┤ one Erlang process per queue,
└─> "transactions" started at boot and listening
src/server.gleam declares both queues, binds them to their topics, spawns a process per queue with process.start, and only then hands the port over to Elli. Consumers and the API live in the same supervision tree.
Gleam had no AMQP client, so rabbitmq_client/ is a small Elixir library wrapping the amqp package, called from Gleam through @external(erlang, "Elixir.RabbitMQClient", ...) in src/rmq.gleam. Same BEAM, two languages, zero serialization between them.
| Path | What it is |
|---|---|
src/server.gleam |
Entry point: declares queues and topics, spawns consumers, starts the HTTP server |
src/rmq.gleam |
Gleam bindings to the Elixir AMQP client |
src/app/routes, src/app/handlers |
HTTP routing and handlers |
src/db/ |
Config, migrations and repositories (gleam_pgo) |
rabbitmq_client/ |
Elixir library wrapping amqp, built with Mix |
docker-compose.yml |
RabbitMQ with the management UI, PostgreSQL and the challenge service |
docs/ |
User and transaction flow diagrams |
docker compose up -d # RabbitMQ (5672, UI on 15672) and PostgreSQL
sh script.sh # build and run the server on :3000Gleam · Erlang/OTP · Elixir · Wisp · Elli · RabbitMQ (AMQP) · PostgreSQL · Docker Compose