Skip to content

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

License

Notifications You must be signed in to change notification settings

ibarakaiev/fireside

Repository files navigation

Logo Light

Logo Dark

Hex version badge Hexdocs badge

Fireside

Fireside is a small Elixir library that allows importing code components (templates) into an existing Elixir project together with their dependencies. It also allows upgrading these components if they have a newer version available.

Installation

def deps do
  [
    {:fireside, "~> 0.1", only: :dev, runtime: false}
  ]
end

Use cases

  • Embedded microservices: using Fireside allows to split up a monolith into microservices while still maintaining the monolith. You get the benefits of both worlds:

    • Isolated, testable microservices and improved developer productivity in larger teams.
    • One distributed BEAM runtime.

    Typically, a monolith approach comes with slower reviews (in larger teams) and the microservices approach comes with additional complexity, the need for communication protocols, queues, etc. With Fireside and Elixir, you can develop individual microservices and embed them into your monolith with one command. You can even embed them in multiple monoliths.

  • Framework templates: if you ever created a Phoenix project, you most likely created it with mix phx.new ..., which creates a brand new Elixir application. This comes with a major drawback: it requires, well, a new Elixir project. If Phoenix's template was a Fireside component, it would've been possible to add it to an existing Elixir app.

  • Portable business logic: if you are a development agency, you can extract reusable code into individual Fireside components, reuse them in your projects, and update all your projects with one command.

  • Paid components: if you run something like Petal, you can make your components installable in one CLI command using Fireside. If you ever release a new version, they can be updated in one command as well.

  • Tutorials: suppose you are writing a great coding tutorial such as Small Development Kits or S3 with Tigris. You can make the code available as a Fireside component, which means your readers can import it to an existing project with just one CLI command.

Usage

To see supported Fireside tasks, refer to Mix Tasks.

Upgrading code components with Fireside

Fireside supports two modes of installing a code component (template): locked and unlocked. If you are installing a code component in the "unlocked" mode, it will just install the code and forget about it. If you are installing it in the "locked" mode (default), it will compute the hash of its AST, annotate each generated file as "DO NOT EDIT", and record the hash in config/fireside.exs. Later, when updating to a newer version, Fireside will know which files belong to which component and whether they have been mistakenly modified.

Example Fireside component

To see an example Fireside component, check out Shopifex, a component that provides the backbone for an e-commerce online store.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages