Taure

Taure

Nova - a web framework for the entire BEAM (Erlang, Elixir, and LFE)

Hey everyone!

I wanted to share Nova, a web framework built on Erlang/OTP that works natively with Erlang, Elixir, and LFE. If you’ve ever wanted a web framework that leans into OTP rather than
abstracting over it, Nova might be worth a look.

Why Nova?

Nova is an OTP-native web framework. Your application is a proper OTP app with supervision trees and releases from the start. It uses Cowboy under the hood and provides a familiar
MVC-style controller pattern – controllers are just functions that take a request map and return tuples:

%% Erlang
index(_Req) → 
Q = kura_query:from(pet),
{ok, Pets} = my_repo:all(Q),
{json, #{data => Pets}}.


Elixir – same pattern, same framework

def index(_req) do
q = :kura_query.from(:pet)
{:ok, pets} = MyRepo.all(q)
{:json, %{data: pets}}
end


Since everything on the BEAM compiles to the same bytecode, you can mix and match languages freely. Write your router in Erlang, your controllers in Elixir, your templates in LFE –
Nova doesn’t care.

Getting started with Elixir (Mix)

Install the generator

mix archive.install hex nova_new

Scaffold a new project

mix nova.new my_app
cd my_app
mix deps.get
iex -S mix


Your app is running at http://localhost:8080. That’s it.

For Erlang users, there’s an equivalent rebar3 workflow:

rebar3 new nova my_app
cd my_app
rebar3 nova serve


What’s in the ecosystem?

Nova isn’t just a web layer. There’s a growing set of tools around it:

  • Kura – an Ecto-inspired database layer for Erlang/OTP. Schemas, changesets, migrations, queries, associations. Works with PostgreSQL via pgo. If you know Ecto, Kura will feel
    familiar.
  • nova_test – testing utilities and request builders
  • opentelemetry_nova – automatic OpenTelemetry instrumentation
  • Code generators – rebar3 nova gen_resource pets scaffolds a full CRUD controller, schema, migration, and routes
  • OpenAPI – auto-generate OpenAPI specs from your routes with built-in Swagger UI

A real example: pet_store

Here’s what a full CRUD controller looks like using Nova + Kura. This is from the pet_store example app:

Schema:

-module(pet).
-behaviour(kura_schema).
-include_lib(“kura/include/kura.hrl”).
-export([table/0, fields/0, primary_key/0]).

table() → <<“pets”>>.
primary_key() → id.
fields() → 
[
#kura_field{name = id, type = id, primary_key = true, nullable = false},
#kura_field{name = name, type = string, nullable = false},
#kura_field{name = species, type = string, nullable = false},
#kura_field{name = breed, type = string},
#kura_field{name = age, type = integer}
].


Controller:

create(#{json := Params} = _Req) → 
CS = kura_changeset:cast(pet, #{}, Params, [name, species, breed, age]),
CS1 = kura_changeset:validate_required(CS, [name, species]),
case pet_store_repo:insert(CS1) of
{ok, Pet} → 
{status, 201, #{}, #{data => Pet}};
{error, #kura_changeset{errors = Errors}} → 
{status, 422, #{}, #{errors => Errors}}
end.


Router:

routes(_Environment) → 
[#{prefix => “/api”,
security => false,
plugins => [{pre_request, nova_request_plugin, #{decode_json_body => true}}],
routes => [
{“/pets”, fun pets_controller:index/1, #{methods => [get]}},
{“/pets”, fun pets_controller:create/1, #{methods => [post]}},
{“/pets/:id”, fun pets_controller:show/1, #{methods => [get]}},
{“/pets/:id”, fun pets_controller:update/1, #{methods => [put]}},
{“/pets/:id”, fun pets_controller:delete/1, #{methods => [delete]}}
]}].


The changeset pattern (cast → validate → insert) will be very familiar to anyone coming from Ecto/Phoenix.

Features at a glance

  • Plugin pipeline – composable middleware with pre_request / post_request hooks, configurable per route group
  • WebSockets – first-class support via nova_websocket behaviour
  • PubSub – distributed pub/sub via OTP’s pg module, works across clustered nodes
  • Sessions – built-in session management (ETS-backed by default)
  • Security middleware – per-route authentication/authorization callbacks
  • Hot reload – rebar3 nova serve watches files and recompiles on change
  • Sub-applications – mount Nova apps under path prefixes, like Rails engines

Learn more

  • The Nova Book – a full walkthrough building a blog platform from scratch, covering routing, plugins, Kura (schemas, migrations, CRUD), WebSockets, pub/sub, testing, OpenAPI, and
    deployment
  • pet_store example – a complete Nova + Kura REST API demo
  • Hex package (v0.13.7)
  • HexDocs
  • GitHub

https://github.com/novaframework/nova

Most Liked

Taure

Taure

Update: What’s new in the Nova ecosystem

Kura 1.2 — Full ORM feature parity

Kura has come a long way. The latest release brings features you’d expect from a mature database layer:

Subqueries & CTEs:

%% Find users with more than 5 posts
Sub = kura_query:from(post),
Sub1 = kura_query:group_by(Sub, [author_id]),
Sub2 = kura_query:having(Sub1, {count, ‘>’, 5}),

Q = kura_query:from(user),
Q1 = kura_query:where(Q, {id, in, {subquery, Sub2}}).

Window functions:

Q = kura_query:from(post),
Q1 = kura_query:select_expr(Q, “ROW_NUMBER() OVER (PARTITION BY author_id ORDER BY inserted_at DESC) as row_num”).



UNION/INTERSECT/EXCEPT, query scopes, optimistic locking, insert_all with RETURNING, and prepare_changes for pre-repo callbacks — all there now.

Test sandbox:

%% Each test runs in a rolled-back transaction — no cleanup needed
kura_sandbox:checkout(my_repo),
%% …run tests…
kura_sandbox:checkin(my_repo).



Cursor streaming for large result sets via kura_stream — DECLARE CURSOR / FETCH in batches, so you don’t load a million rows into memory.

Hikyaku — Mailer library for Erlang

New library, composable email builder with pluggable adapters:

Email = hikyaku_email:new(),
Email1 = hikyaku_email:from(Email, {<<“My App”>>, <<“noreply@app.com”>>}),
Email2 = hikyaku_email:to(Email1, <<“user@example.com”>>),
Email3 = hikyaku_email:subject(Email2, <<“Welcome!”>>),
Email4 = hikyaku_email:html_body(Email3, <<“Hello”>>),
{ok, _} = hikyaku_mailer:deliver(my_mailer, Email4).



Ships with adapters for SMTP (via gen_smtp), SendGrid, Mailgun, Amazon SES (with built-in AWS Sig V4 signing — no extra deps), plus Logger and Test adapters for dev/test. Behaviour-based, so writing your own adapter is straightforward.

rebar3 nova gen_auth — Auth scaffolding in one command

rebar3 nova gen_auth

Generates 9 files: Kura migration (users + tokens tables), user schema with registration/password/email changesets, accounts context module, Nova security callback, session/registration/user controllers, and a Common Test suite covering all
flows.

You get: POST /api/register, POST /api/login, DELETE /api/logout, GET /api/me, PUT /api/me/password, PUT /api/me/email — with bcrypt hashing, constant-time comparison, and SHA256-hashed session tokens with 14-day expiry. Similar to what mix
phx.gen.auth gives you.

Arizona — LiveView for Erlang (early days)

This one’s still in active development (requires OTP 28+). Compile-time template optimization via parse transforms, differential rendering over WebSocket, variable dependency tracking for surgical DOM
updates.

mount(_MountArg, _Req) → 
arizona_view:new(?MODULE, #{count => 0}, LayoutOrNone).

render(Bindings) → 
arizona_template:from_html(~“{get_binding(count, Bindings)}”).

handle_event(~“increment”, _Params, View) → 
State = arizona_view:get_state(View),
State1 = arizona_stateful:put_binding(count,
arizona_stateful:get_binding(count, State) + 1, State),
{[], arizona_view:update_state(State1, View)}.



Three template syntaxes (HTML, Erlang terms, Markdown), stateful and stateless components, slot-based composition, and a JS client with pushEvent/callEvent APIs.

Where Next?

Popular in Announcing Top

tmbb
I’ve published the first version of my Makeup library. It’s a syntax highlighter for Elixir in the spirit of Pygments, Currently it highl...
New
josevalim
Hi everyone, We would like to announce that Plataformatec is working on a new MySQL driver called MyXQL. Our goal is to eventually integ...
New
josevalim
Yes, yet another parser combinator library! Most of the parser combinators in the ecosystem are either compile-time, often using AST tra...
159 19228 141
New
mplatts
With HEEX released we decided to start a components library using Tailwind CSS - check it out here: Petal Components. We also have a boi...
New
bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
384 13736 119
New
Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
hpopp
After just over two years in development, this latest version of Pigeon is what I finally consider done in regards to my original vision ...
New
scohen
Lexical Lexical is a next-generation language server for the Elixir programming language. Features Context aware code completion As-you...
New
anshuman23
Hello all, I have been working on my proposed project called Tensorflex as part of Google Summer of Code 2018.. Tensorflex can be used f...
New
pkrawat1
Hey guyz We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it. Have...
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 47930 226
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement