Show HN: Nex – The simplest way to build Htmx apps in Elixir

4 pointsposted 9 hours ago
by gofenix

1 Comments

gofenix

9 hours ago

I've been building web apps for years, and I got tired of the complexity. So I created Nex – a minimalist web framework that strips away the cruft and lets you ship features fast.

*What makes Nex different:*

- *Zero JavaScript complexity* – Server-side rendering with HTMX, no React/Vue needed - *File-based routing* – Drop a file in `src/pages/`, get a route automatically - *Hot reload* – Instant feedback while developing - *Real-time ready* – Built-in Server-Sent Events for live dashboards, chat, streaming - *Production-ready* – Docker included, deploy to Railway/Fly.io in minutes

*Who it's for:*

Indie hackers, startups, and anyone building internal tools, dashboards, or real-time apps. Not for enterprise complexity – that's what Phoenix is for.

*Quick example:*

```elixir defmodule MyApp.Pages.Todos do use Nex.Page

  def mount(_params) do
    %{todos: fetch_todos()}
  end

  def render(assigns) do
    ~H"""
    <h1>My Todos</h1>
    <form hx-post="/add_todo" hx-target="#todos">
      <input type="text" name="title" required />
      <button>Add</button>
    </form>
    <ul id="todos">
      <li :for={todo <- @todos}>{todo.title}</li>
    </ul>
    """
  end

  def add_todo(%{"title" => title}) do
    todo = create_todo(title)
    ~H"<li>{@todo.title}</li>"
  end
end ```

*Get started:*

```bash mix archive.install hex nex_new mix nex.new my_app cd my_app mix nex.dev ```

Check out the examples (chatbot with streaming, guestbook, dynamic routes) to see what's possible.

I'd love feedback from the community – what would make this more useful for your projects?