
apoorv-2204
Design patterns for Hexagonal / Clean Architecture in Elixir (beyond Behaviour + Impl)
I’m experimenting with Hexagonal / Clean Architecture in Elixir. The classic Behaviour + Impl split works great for mocking and isolating IO—here’s a trimmed-down example from our SFTP adapter:
elixir
# Port (Behaviour)
defmodule Core.SFTP.Port do
@callback connect(map()) :: {:ok, term()} | {:error, term()}
@callback write(Path.t(), iodata()) :: :ok | {:error, term()}
@callback disconnect(term()) :: :ok | {:error, term()}
end
# Adapter (Impl)
defmodule Core.SFTP.Live do
@behaviour Core.SFTP.Port
@impl true
def connect(conf), do: SFTPClient.connect(conf)
@impl true
def write(path, data), do: SFTPClient.write_file(path, data)
@impl true
def disconnect(conn), do: SFTPClient.disconnect(conn)
end
I wanted to know what are architectural patterns in elixir , apart from behaviour and impl pattern
Popular Backend topics

Yes? No? If yes, how/in what way?
New

A new item has been posted:
This thread was posted automatically, if you feel it could be in a better category and are at Trust Level ...
New

New

Some time ago I read somewhere that Rocket will work with stable versions of Rust.
The previous version’s changelog says, “Core: Removed...
New
New

I’ve recently become interested in Elixir and all it’s neat perks. And since I’m currently working on a messaging platform; elixir seems ...
New

To promote Tarearbol.DynamicManager I created the :heart_eyes_cat:-language (which is a brainfuck dialect.)
Code outputting “Meow” to th...
New

Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New

And the blog:
Rails has been unapologetically full stack since the beginning. We’ve continuously sought to include ever-more default an...
New

MongoDB, Cassandra, DynamoDB and etc.
Also, do you use VM or container to run it?
New
Other popular topics

What chair do you have while working… and why?
Is there a ‘best’ type of chair or working position for developers?
New

Any thoughts on Svelte?
Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New

Which, if any, games do you play? On what platform?
I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New

New

I know that -t flag is used along with -i flag for getting an interactive shell. But I cannot digest what the man page for docker run com...
New

poll
poll
Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New

I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl:
The Ser...
New

“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco
Ever wonder how authoring books compares to writing articles?...
New

Biggest jackpot ever apparently! :upside_down_face:
I don’t (usually) gamble/play the lottery, but working on a program to predict the...
New

We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /ash
- /vscode
- /opensuse
- /centos
- /php
- /deepseek
- /html
- /scala
- /zig
- /debian
- /textmate
- /nixos
- /sublime-text
- /lisp
- /agda
- /react-native
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /lua
- /nodejs
- /c
- /slackware
- /julia
- /neovim