Taure

Taure

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

Showing Posts 1 to 1

Taure

Taure OP

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.

— All posts loaded —

Where Next? Top

Trending in Announcing Top

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews