webassembly alternatives and similar packages
Based on the "Framework Components" category.
Alternatively, view webassembly alternatives based on common mentions on social networks and blogs.
-
ex_admin
ExAdmin is an auto administration package for Elixir and the Phoenix Framework -
phoenix_html
Phoenix.HTML functions for working with HTML strings and templates -
phoenix_ecto
Phoenix and Ecto integration with support for concurrent acceptance testing -
react_phoenix
Make rendering React.js components in Phoenix easy -
absinthe_plug
Plug support for Absinthe, the GraphQL toolkit for Elixir -
phoenix_live_reload
Provides live-reload functionality for Phoenix -
params
Easy parameters validation/casting with Ecto.Schema, akin to Rails' strong parameters. -
phoenix_pubsub_redis
The Redis PubSub adapter for the Phoenix framework -
dayron
A repository `similar` to Ecto.Repo that maps to an underlying http client, sending requests to an external rest api instead of a database -
rummage_phoenix
Full Phoenix Support for Rummage. It can be used for searching, sorting and paginating collections in phoenix. -
phoenix_token_auth
Token authentication solution for Phoenix. Useful for APIs for e.g. single page apps. -
sentinel
DEPRECATED - Phoenix Authentication library that wraps Guardian for extra functionality -
plug_rails_cookie_session_store
Rails compatible Plug session store -
phx_component_helpers
Extensible Phoenix liveview components, without boilerplate -
filterable
Filtering from incoming params in Elixir/Ecto/Phoenix with easy to use DSL. -
multiverse
Elixir package that allows to add compatibility layers via API gateways. -
access pass
provides a full user authentication experience for an API. Includes login,logout,register,forgot password, forgot username, confirmation email and all that other good stuff. Includes plug for checking for authenticated users and macro for generating the required routes. -
better_params
Cleaner request parameters in Elixir web applications ๐ -
scrivener_headers
Scrivener pagination with headers and web linking -
phoenix_pubsub_rabbitmq
RabbitMQ adapter for Phoenix's PubSub layer -
plug_checkup
PlugCheckup provides a Plug for adding simple health checks to your app -
plug_rest
REST behaviour and Plug router for hypermedia web applications in Elixir -
Votex
Implements vote / like / follow functionality for Ecto models in Elixir. Inspired from Acts as Votable gem in Ruby on Rails -
trailing_format_plug
An elixir plug to support legacy APIs that use a rails-like trailing format: http://api.dev/resources.json -
phoenix_html_simplified_helpers
Some helpers for phoenix html( truncate, time_ago_in_words, number_with_delimiter, url_for, current_page? ) -
plug_canonical_host
PlugCanonicalHost ensures that all requests are served by a single canonical host.
Learn Elixir in as little as 12 Weeks
Do you think we are missing an alternative of webassembly or a related project?
README
WebAssembly
DSL for creating html structure straight with Elixir blocks:
use WebAssembly
builder do
html do
head do
meta http_equiv: "Content-Type", content: "text/html"
title "example"
end
body do
div class: "container", id: :content do
ul do
for index <- 1..3, do:
li "item #{index}"
end
random = :random.uniform(10)
if random == 5 do
text "Lucky! You got five"
end
end
span [style: "smiling"], "that was nice"
end
end
end
This results in a deeply nested list (aka iolist) which you can flatten or (better!) send to the socket as it is (via Plug & Cowboy for example).
Now what can be concluded from the example above:
- you produce HTML elements by using macros inside
builder
block - non-void element can be used with "flat" content argument or with a
do
-block - element with a
do
-block means nesting - inside such a
do
-block you have access to full Elixir syntax - element attributes go first (but are optional), then the content
- attributes are Elixir keywords
- underscores in attribute keys are translated to dash signs
- you can omit brackets around attributes when using
do
-block, but not when using flat form - void HTML elements correspond to macros with attributes only,
like
meta
above - if you want to emit just text without surrounding html tags,
simply use
text
macro.
For me it's beautiful. What about you?
Why?
- to have views in pure Elixir, without HTML templates
- to utilize Erlang's approach: you can feed sockets with iolists instead of one big binary produced by template engine
You can possibly mix different styles: code small snippets in WebAssembly and feed them to your partial templates, finally using your template engine to render the whole page.
Usage
WebAssembly is published on Hex, so just add {:webassembly, "~> 0.6"}
to your deps and :webassembly
to your apps in the mix.exs
.
Using it with Plug is a no-brainer - you just pass the doc to send_resp/3
:
defmodule Plugged do
import Plug.Conn
use Plug.Router
use WebAssembly
plug :match
plug :dispatch
get "/" do
doc = builder do
html do
body do
text "hello from Plug!"
end
end
end
conn
|> put_resp_content_type("text/html")
|> send_resp(200, doc)
end
end
API details are available at hexdocs.
TDD
WebAssembly aims to have 100% test coverage.
Type Safety
As for releases 0.3.0
and above WebAssembly dialyzes with no warnings.
Thanks
Loosely inspired by Markaby.
License
The code is released under the BSD 2-Clause License.
*Note that all licence references and agreements mentioned in the webassembly README section above
are relevant to that project's source code only.