This is a simple self-hosted Phoenix LiveView app that generates downloadable SVG identicons, as a demo of my IdenticonSvg and Squircle Elixir libraries.

Screenshot of obidenticon with new squircle options

Why this exists

I wrote and deployed this with the motivation of learning and practicing how to do a few simple but also important things in and with Elixir and Phoenix LiveView.

  1. A LiveView with a form component and parameters that are fed to my SVG identicon drawing library (IdenticonSVG), returning an inline SVG with every change of the form parameters. That was simple.

  2. A button that triggers an event that takes the SVG plaintext and initiates the download of an SVG file. Due to how LiveView (running over websockets) handles HTTP requests leading away from it, using a Phoenix Controller was out of the question, as it made the LiveView inoperable or re-mounted it, resetting the form values. Figuring out how to achieve my goal was not so simple, even though the solution is super simple. I pieced it together using the documentation and various posts on elixiforum.com.

  3. Deploying a Phoenix LiveView app to production. That one was simple on Linux but not possible on a FreeBSD jail, for unknown reasons (something about not being able to start the listener).

  4. Applying dark: modifiers to Tailwind classes to provide a dark mode.

Deployment

This is deployed in an LXC container with Debian 12 on a Proxmox VE node: https://obidenticon.overbring.com

blog-post
obidenticon 2024
/images/software/stack/Elixir.png Elixir
/images/software/stack/Phoenix LiveView.png Phoenix LiveView
/images/software/stack/Tailwind.png Tailwind
/images/software/stack/Linux.png Linux
Proprietary In Production