No description
Find a file
2026-03-01 13:24:01 +02:00
assets Add channel to be joined 2026-02-28 13:11:58 +02:00
config Cleanup work 2026-03-01 11:35:32 +02:00
lib Add documentation 2026-03-01 13:22:29 +02:00
priv Cleanup work 2026-03-01 11:35:32 +02:00
rel/overlays/bin Add documentation 2026-03-01 13:22:29 +02:00
test Docs and cleanup 2026-03-01 12:46:28 +02:00
.credo.exs Add credo 2026-02-28 12:00:42 +02:00
.formatter.exs Add credo 2026-02-28 12:00:42 +02:00
.gitignore Precommit value is clean 2026-03-01 12:54:33 +02:00
AGENTS.md initial commit 2026-02-21 09:20:40 +02:00
mix.exs Precommit value is clean 2026-03-01 12:54:33 +02:00
mix.lock Precommit value is clean 2026-03-01 12:54:33 +02:00
README.md Format docs 2026-03-01 13:24:01 +02:00

BirdyChat Tech Challenge

This repository implements BirdyChat tech challenge.

Start here

Firstly, check out this repository locally. Then install required versions of Elixir and Erlang from .tool-versions. asdf-vm will pick them up automatically. Then you run the test suite with mix test. Then, a scripted demo release is prepared in the prod environment:

MIX_ENV=prod mix build_release

Then you can run 3 servers connected to one another:

_build/prod/rel/birdy_chat/bin/server_1 - runs at localhost:4001

_build/prod/rel/birdy_chat/bin/server_2 - runs at localhost:4002

_build/prod/rel/birdy_chat/bin/server_3 - runs at localhost:4003

Out of the box they communicate with one another. Send a json request to one of them and observe the results. Feel free to modify the examples below.

A local request:

curl --request POST \
  --url http://localhost:4001/api/messages \
  --header 'content-type: application/json' \
  --data '{"message":"123","to":"1-user","from":"1-user"}'

A remote request:

curl --request POST \
  --url http://localhost:4001/api/messages \
  --header 'content-type: application/json' \
  --data '{"message":"123","to":"2-user","from":"1-user"}'

A request to unknown server:

curl --request POST \
  --url http://localhost:4001/api/messages \
  --header 'content-type: application/json' \
  --data '{"message":"123","to":"4-user","from":"1-user"}'

Files are saved to priv/messages.

Key rundown of technical details

First and foremost, I tried to keep it as simple as possible - stick to know conventions, leverage existing libraries or frameworks, hence the usage of both Phoenix and Ecto - conventions they provide are understandable to pretty much any Elixir developer.

All important modules are documented and there is a test suite that exacutes all known code paths.

Servers authenticate with one another using Phoenix tokens. Servers communicate via HTTP using JSON. There were other options but I decided to use this one for reasons enumerated in documentation for BirdyChatWeb.Api.Server.Internal.Controller.