apoorv-2204

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

Where Next?

Popular Backend topics Top

New
New
First poster: bot
The Emerging Architectures for Modern Data Infrastructure. Five years ago, if you were building a system, it was a result of the code yo...
New
AstonJ
Consider this Erlang code: Rectangle = {rectangle, 20, 10}. {rectangle, Width, Height} = Rectangle. > Width. 20 > Height. 10 When...
New
First poster: bot
What's so exciting about Postgres? with Craig Kerstiens (The Changelog #417). PostgreSQL aficionado Craig Kerstiens joins Jerod to talk ...
New
finner
I’ve never really felt 100% comfortable using the enum type because of my lack of understanding how it is constructed . . . . . . until ...
New
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
jaeyson
Sorry for the very vague noob question, I really want to ask this: When do we use async or sync code in the context of Elixir? AFAIK gen...
New
lucasvegi
Hello guys! Perhaps some of you have already seen this invitation on other channels in the Elixir community or even responded to our surv...
New

Other popular topics Top

malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
AstonJ
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
New
gagan7995
API 4 Path: /user/following/ Method: GET Description: Returns the list of all names of people whom the user follows Response [ { ...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
CommunityNews
A Brief Review of the Minisforum V3 AMD Tablet. Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New
AstonJ
This is cool! DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON We just witnessed something incredible: the largest open-s...
New