The simplest way to build HTMX apps in Elixir
Nex is a minimalist, HTMX-first toolkit for building server-rendered Elixir apps fast.
Nex is built for developers who want to ship real products without dragging in SPA complexity or framework ceremony.
- HTMX-first — server-rendered UX without a large frontend stack
- Minimal API surface — one
use Nexentry point for pages, APIs, and components - File-based routing — routes come from the filesystem, not route config
- Fast iteration — hot reloading, simple project structure, and low boilerplate
- AI-friendly locality — UI and behavior live close together, which makes the codebase easier for both humans and agents to modify
Nex is a pragmatic framework for:
- indie products
- internal tools and dashboards
- HTMX-first web apps
- JSON APIs and streaming endpoints
- teams that want SSR with less complexity
Nex is not trying to be:
- a Phoenix replacement for every use case
- a batteries-included enterprise platform
- the best fit for complex SPAs
mix archive.install hex nex_new
mix nex.new my_app
cd my_app
mix nex.devThen open http://localhost:4000.
my_app/
├── src/
│ ├── pages/
│ │ ├── index.ex
│ │ └── [id].ex
│ ├── api/
│ │ └── todos/
│ │ └── index.ex
│ ├── components/
│ └── layouts.ex
├── mix.exs
└── Dockerfile
- File-based routing from
src/pages/ - Dynamic segments like
[id],[slug], and[...path] - Convention-over-configuration module structure
- HTML-first rendering with HEEx templates
- HTMX integration out of the box
- Automatic CSRF handling for state-changing requests
- Partial updates without SPA plumbing
- JSON APIs with a simple request object
- Native SSE streaming with
Nex.stream/1 - WebSocket support for user-defined handlers
- Shared request-time helpers for cookies, session, and flash
- Unified
use Nexentry point - Low-boilerplate layouts and page modules
- Built-in static file serving
- Examples and showcases in the same repository
framework/— the core Nex framework published asnex_coreinstaller/—mix nex.newproject generatornex_env/— environment variable helper packagenex_base/— schema-less database layer and query builderexamples/— focused examples for learning specific capabilitiesshowcase/— larger apps that demonstrate real-world usagewebsite/— the official site built with Nex itself
If you want the fastest path into Nex, use this sequence:
- Read this README
- Create a fresh app with
mix nex.new - Open one focused example
- Open one showcase app once the basics click
These are the best starting points for understanding the main Nex product line:
examples/counter— minimal state + HTMX loopexamples/todos— CRUD-style page actionsexamples/dynamic_routes— routing conventions and path patternsexamples/upload— file upload handlingexamples/todos_api— JSON API structure
For more realistic product-shaped examples:
showcase/bestof_ex— a larger Nex application structureshowcase/agent_console— a UI-heavy showcase built on Nex
defmodule MyApp.Pages.Index do
use Nex
def mount(_params) do
%{count: Nex.Store.get(:count, 0)}
end
def render(assigns) do
~H"""
<div>
<h1>Counter</h1>
<div id="counter-display">{@count}</div>
<button hx-post="/increment" hx-target="#counter-display" hx-swap="outerHTML">+</button>
</div>
"""
end
def increment(_params) do
count = Nex.Store.update(:count, 0, &(&1 + 1))
~H"<div id="counter-display">{count}</div>"
end
end- Official Documentation
- Hex Package: nex_core
- Hex Package: nex_new
- HexDocs: nex_core
- HexDocs: nex_new
If you want to contribute or evaluate the repository for adoption, start here:
MIT