igorb

igorb

Fireside - Installable & Upgradable Code Templates

Hello all!

Announcing Fireside, a tool to install and upgrade code templates that are themselves Elixir apps.

Fireside allows you to bring over microservices directly into your Elixir monolith. As an example, I built and open-sourced an e-commerce core for an online store (used in a real platform), and Fireside lets you install everything it needs to run in just one command: mix fireside.install shopifex@github:ibarakaiev/shopifex. This will:

  1. Install all its dependencies (as well as their Igniter installers, if available).
  2. Import all files listed in fireside.exs of the component.
  3. Run an optional setup/1 hook that uses Igniter for custom things like modifying config.exs, running mix tasks, etc.
  4. Calculate the hash of the AST of each imported file and record it in config/fireside.exs.

Then, if the component changes in the remote, you can bring over changes with mix fireside.update shopifex. Fireside components can even expose an upgrade/3 function that can run Igniter modifications. It’s kind of like a database migration, but for your app (or, rather, for an isolated part of it).

However, if you modify the imported code, Fireside will detect it by looking at the hash of its new AST and will reject updates. This is so that you can change the imported code and not risk having your changes overwritten. For this use case, it’s recommended to “unlock” the component before editing with mix fireside.unlock {component}, more on which below.

Some use cases, like project starter templates or code from tutorials, don’t require “locking”, and can be installed with the --unlocked flag. In this case, Fireside will import the code once and forget about it. This would be useful for something like phx.new if it were created with Fireside, in which case it would be possible to add a Phoenix template to an existing Elixir app. Updating or removing (mix fireside.uninstall) would not be possible in this case.

The key difference between regular code templates and Fireside components is that Fireside is AST-aware (thanks to Igniter!) and Fireside components are themselves standalone Elixir apps that you can test and build in any way you want—“exporting” only the critical parts. I wrote a bit more about the motivations and potential use cases in a blog post: Embedded Microservices and Fireside.

If you want to take it for a spin, feel free to take a look at the README and Creating a Fireside Component. If you do like it, let me know here or by leaving a star in the repo :slight_smile:

Where Next?

Popular in Libraries Top

hpopp
After just over two years in development, this latest version of Pigeon is what I finally consider done in regards to my original vision ...
New
kevinlang
Hey all, We have made an Ecto3 Adapter for SQLite3, ecto_sqlite3! We have successfully on-boarded the full suite of integration tests (...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
praveenperera
FastRSS Parse RSS feeds very quickly: This is rust NIF built using rustler Uses the RSS rust crate to do the actual RSS parsing Speed...
New
arkgil
Hi all! I’m happy to announce that Telemetry v0.3.0 is out! This release marks the conversion from Elixir to Erlang so that all the libr...
New
benlime
I created a new library GitHub - benvp/ex_cva: Class Variance Authority for Elixir which aims to make it very easy to define different va...
New
bryanjos
Hi, I just published version 0.23.0 of Elixirscript. Most of the changes are around JavaScript interop now that Elixirscript uses the ...
New
vic
Expat is a tiny experiment I did for extracting patterns and being able to reuse them (compose and share patterns between elixir librarie...
New
ostinelli
Let’s write a database! Well not really, but I think it’s a little sad that there doesn’t seem to be a simple in-memory distributed KV da...
New
mplatts
With HEEX released we decided to start a components library using Tailwind CSS - check it out here: Petal Components. We also have a boi...
New

Other popular topics Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

Sub Categories:

We're in Beta

About us Mission Statement