Skip to content
Tech News
← Back to articles

Building a Blog with Elixir and Phoenix

read original get Elixir Programming Book → more articles
Why This Matters

This article highlights how using Elixir and Phoenix to build a blog offers developers full control, speed, and flexibility beyond static site generators. It demonstrates a practical approach to creating server-side rendered pages with Markdown content, hosted on a self-managed infrastructure. This approach can inspire the tech industry and consumers to explore more customizable, high-performance web solutions.

Key Takeaways

TL;DR: it’s an Elixir app using Phoenix server side rendered pages, with the blog post pages generated from Markdown using NimblePublisher. It’s running on a self-hosted Dokploy instance running on Hetzner, with bunny.net as a CDN sitting in front of it.

This is a very belated write up of how this blog was put together! There’s nothing terribly original here, but I figure it could come in handy for someone out there as a reference. And the world needs more Elixir content.

Why Phoenix

I have used static site generators before to power my blog (shoutout to Hakyll), but I wanted to open the door for myself to also have little experiments on this site, ones that would require more interactivity than a static site allows. Besides, I just like using Phoenix. Although most of my Phoenix projects use LiveView, this felt like a good place to do things old-school with DeadViews.

It also means I get full control of what I’m building. Using a tool someone else created means getting a lot for free, but the moment you step outside of the expected you’re having to figure out how to make things work for their tool.

So I kept things simple. No Ecto, no DB. Just server-side rendered HTML. It’s blazingly fast, as you can see from this PageSpeed Insights report.

NimblePublisher

My setup closely matches the original Dashbit blog post Welcome to our blog: how it was made!, which led to the creation of NimblePublisher.

The heart of the blog is the NimblePublisher setup, which consists of a use block:

defmodule JolaDev.Blog do use NimblePublisher , build : JolaDev.Blog.Post , from : Application . app_dir ( :jola_dev , "priv/posts/**/*.md" ) , as : :posts , html_converter : JolaDev.Blog.MarkdownConverter , highlighters : [ :makeup_elixir ] ...

... continue reading