Single File Elixir Architecture

I just discovered single file Elixir scripts and its love at first sight:

Crazy how simple and OP these look. Now I’m wondering how far it can go.

I’m imagining these script files as serverless functions, and then have a pub/sub queue route events to them for an event processing system. Bad or elegant? What are trade offs with performance and traditonal mix app etc?

3 Likes

There is basically no difference between single or multiple files. Calls to functions from the same module are faster than calls to other modules but it is not really important.

If you have 10k lines of code in your file you will probably have several modules, so you’d better split the file for the codebase to be clean.

There are many solutions to write an event processing system in elixir, but I doubt using serverless functions would be very interesting. This is more a Node/PHP thing.

3 Likes