RxAssim

RxAssim

ExInertia - Toolkit for Phoenix + Inertia.js Integration with Bun and Vite

I’m excited to announce ExInertia, a toolkit built on top of Igniter that provides a robust integration between Phoenix and Inertia.js, with first-class support for Routes library and Bun.

:wrench: Technical Stack:

  • Built on Igniter for powerful, composable installer generators
  • Full Inertia.js integration with Phoenix using Inertiajs/inertia-phoenix
  • Modern asset pipeline using Bun + Vite (replacing esbuild/tailwind)
  • Built-in Routes integration for type-safe routing between Phoenix and TypeScript
  • Automated manifest handling for Vite assets

:package: Installation:

def deps do
  [
    {:exinertia, "~> 0.5.0"},
  ]
end

The installer, powered by Igniter (thanks @zachdaniel ), handles the complete setup:

mix exinertia.install

:hammer_and_wrench: What gets installed:

  1. Vite manifest reader in your Web namespace
  2. Inertia pipeline + configuration in your Router
  3. Routes integration for type-safe routing
  4. Modified root layout with Vite asset handling
  5. Complete Bun + Vite setup replacing esbuild/tailwind
  6. TypeScript-ready frontend structure with Routes type definitions
  7. Automated mix aliases for asset building

:zap: Development Experience:

  • Hot Module Replacement (HMR) with Vite
  • TypeScript compilation with Bun
  • Type-safe routing between Phoenix and TypeScript using Routes
  • Seamless server-side rendering support
  • Zero-configuration Tailwind integration

Type-safe routing example with Routes:

// Your routes are automatically typed!
const url = Routes.path('user.show', { id: 123 });
// => "/users/123"

// TypeScript error if you miss required params
const url = Routes.path('user.show'); // Error: missing id parameter

The project is built to be modular - you can use the installers independently or compose them with your own Igniter-based installers.

:link: Resources:

Contributions and feedback are welcome! We’re particularly interested in hearing about different use cases and integration patterns.

Most Liked

zachdaniel

zachdaniel

Creator of Ash

Looks awesome!

FYI your package can be installed without modifying the mix.exs file by anyone who already is using igniter with mix igniter.install exinertia and that’s the command we recommend to use when running installers as opposed to calling exinertia.install directly :slight_smile:

Great work!

zachdaniel

zachdaniel

Creator of Ash

Awesome! One small note is that mix igniter.install actually works even when igniter is not installed into a project, as long as igniter_new is installed as an archive.

So your instructions could be

# in your project directory
mix archive.install hex igniter_new
mix igniter.install exinertia

And then the user doesn’t have to manually edit even a single file :slight_smile:

RxAssim

RxAssim

Thanks for the feedback! I’ve updated exinertia to make Igniter an optional dependency and modified the README to instruct users to install via mix igniter.install exinertia. This should help ensure Igniter remains a dev/test only dependency as intended.

skyturtle

skyturtle

Thanks for creating this! I’ve been playing around with Inertia.js and Phoenix and have really been enjoying the experience. It was getting old having to go through all the same setup steps. I had a couple of questions:

  1. Are there any changes you need to make to the Dockerfile that is created by mix phx.gen.release --docker? I tried to deploy my app to Coolify on a self-hosted VPS. My build keeps failing during the builder stage at RUN mix assets.deploy. Here is what I see in the debug log:
#22 [builder 12/17] COPY assets assets
#22 DONE 0.0s
#23 [builder 13/17] RUN mix assets.deploy
#23 0.771 Compiling 17 files (.ex)
#23 1.753 Generated test_exinertia app
#23 2.003 03:56:23.754 [debug] Downloading bun from https://github.com/oven-sh/bun/releases/download/bun-v1.2.1/bun-linux-x64.zip
#23 4.794 $ ../_build/bun x --bun vite build --minify
#23 4.806 Resolving dependencies
#23 5.309 Resolved, downloaded and extracted [128]
#23 5.371 Saved lockfile
#23 6.361 failed to load config from /app/assets/vite.config.ts
#23 6.361 error during build:
#23 6.361 undefined
#23 6.375 error: script "build" exited with code 1
#23 6.381 ** (Mix) `mix bun build --minify` exited with 1
#23 ERROR: process "/bin/sh -c mix assets.deploy" did not complete successfully: exit code: 1

It looks like the Vite.js config file can’t be found. When I used Svelte in a Phoenix + Inertia.js project, I had to install Node for the build stage to run npm install is the assets directory after it was copied. I wasn’t sure if I need to do something similar here. This is my first time using the Hex Bun package. I thought the Bun wrapper package eliminated the need to install any additional JavaScript tooling, but I might be mistaken.

  1. I was curious why you created the PhxManifestReader module. When I was trying to setup Vite within a Phoenix project, I noticed other examples had set manifest: false in their vite.config.ts and put the output to match the assets folder used by Phoenix. Is there an advantage to reading those manifest files in this manner?

Thanks again for creating this toolkit! Everything seems to be working in dev right now. This was also my first time using Igniter and the ExInertia installation experience was sweet.

dmitriid

dmitriid

I read that, too. And that means what exactly? I’ve always been able to build anything on the frontend using anything on the backend :slight_smile:

Where Next?

Popular in Libraries Top

mhanberg
I just released the first version of Temple: an HTML DSL for Elixir and Phoenix! You can read this blog post or the docs for more info...
New
RobertDober
Earmark is a pure-Elixir Markdown converter. It is intended to be used as a library (just call Earmark.as_html), but can also be used as...
239 11851 134
New
kelvinst
Hey everyone! Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
michalmuskala
Hello everybody. I have just released Jason - a new JSON library. You might be wondering, why do we need a new library? The primary foc...
New
Qqwy
Solution is a library to help you with working with ok/error-tuples in case and with-expressions by exposing special matching macros, as ...
New
Eiji
ExApi is a library that I’m developing now and hope release soon This library will allow to: list all apis list all api implementation...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
bryanjos
Hi, I wanted share a small library we at Revelry Labs made for rendering react components from the server side. There are instructions fo...
New
Azolo
Hey everyone, I just released WebSockex which is a Elixir WebSocket client. WebSockex strives to work as a OTP special process, be RFC6...
New
KallDrexx
For a good number of months I've been working on creating a very basic RTMP live video streaming server. Now that I have a very, very ba...
New

Other popular topics Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New

Sub Categories:

We're in Beta

About us Mission Statement