From release (0.4.3) install is simplified by using hex.pm.
$ mix archive.install hex raxx_kit
$ mix raxx.kit my_app
...
Get started:
cd my_app
iex -S mix
View on http://localhost:8080
View on https://localhost:8443 (uses a self signed certificate)
Raxx is a different abstraction than Plug. Phoenix is built around Plug. From what I’ve seen the Raxx abstraction aligns more closely with the HTTP protocol.
Ace is used instead of Cowboy.
From a full stack perspective someone gravitating in front end matters to Vue.js in the “Vue.js vs React” discussion would likely gravitate towards Phoenix - until the Plug abstraction gets in the way.
Raxx seems more for control enthusiasts who don’t mind assembling their own framework in order to have “not a shred of bloat” in their system and prefer an abstraction more closely aligned with HTTP.
I especially liked how the streaming upload looked like a short-lived process handler.
For the moment I wouldn’t disagree with this. However there is no reason an opinionated batteries included framework couldn’t exist on top of Raxx. In exactly the same way phoenix extends plug.
The important thing to me is the abstraction. That is why I have decided to focus on making Raxx rock solid over developing a framework.
A bit delayed in response but I will try make some comments
Phoenix is MVC by default. Raxx.Kit makes no assumptions about the model layer. I consider this good practice after reading about hexagonal/onion/clean architecture
If you value referential transparency in your runtime program then try Raxx. If you aren’t sure why functional programmers are so bothered with that then stay with phoenix.
I have found it easier to wrap typespecs around a Raxx program that a Phoenix one because more of the behaviour of the system is exposed through args and return values of a function.
yes
In fact I would recommend just using Raxx documentation directly which explains how to add it to an existing project.
Dialyzer as part of the CI test suite
Presence. Though Phoenix.Presence is a nicely extracted library you can use that with a Raxx project.
Recent release of Raxx, added the Raxx.View and Raxx.Layout modules.
These are used in generated project and templates include example of interpolating server variables into HTML and JavaScript.
Action Handler
defmodule MyApp.WWW.HomePage do
use Raxx.Server
use MyApp.WWW.Layout, arguments: [:title]
@impl Raxx.Server
def handle_request(_request = %{method: :GET}, _state) do
title = "Raxx.Kit"
response(:ok)
|> render(title)
end
def handle_request(request = %{method: :POST}, _state) do
case URI.decode_query(request.body) do
%{"name" => name} ->
greeting = "Hello, #{name}!"
response(:ok)
|> render(greeting)
_ ->
response(:bad_request)
|> render("Bad Request")
end
end
end
Template
<main class="centered">
<section class="accent">
<h1><%= title %></h1>
<form action="/" method="post">
<label>
<span>tell us your name</span>
<input type="text" name="name" value="" autofocus>
</label>
<button type="submit">Submit</button>
</form>
<h2>Find out more</h2>
<nav>
<a href="https://github.com/CrowdHailer/raxx">SOURCE CODE</a>
<a href="https://elixir-lang.slack.com/messages/C56H3TBH8/">CHAT</a>
</nav>
<%= javascript_variables title: title %>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
app.show(title)
})
</script>
</section>
</main>
p.s. is there any way to get .eex syntax highlighting?
Project generator updated to use Raxx 0.17.0 and Ace 0.18.0.
The latest versions of these projects introduces a separate behaviour for simple servers, Ones where a complete request is transformed to a complete response; and streaming servers.
Small fix for a bug introduced with Elixir 1.9 where Mix task raxx.new would fail in all cases due to a changed return value for Mix.Generator.create_directory.