What is Elixir's actively developed alternative for Ruby's Sinatra or Python's Flask?

I think Sugar falls in this category, but that isn’t well maintained / actively developed.

Note: I’m looking for simplicity, not speed/performance.

I made a nice little micro service by leaving out the parts of Phoenix I didn’t need: Persistence, HTML templates, etc.

2 Likes

I’d love to hear more about it.
Can you tell me in short, how you did that. I know how to leave out HTML and templates, but how did you leave out the Persistance?

have you looked at Raxx? Raxx - Interface for HTTP webservers, frameworks and clients (1.0 now released!)

8 Likes

Take a look at Phoenix’s “Plug” configuration in the router. It’s a nice explicit declaration that makes it easy to remove what you don’t want. Here’s an example from my micro-service. In a “normal” web app, these would each be much longer:

  pipeline :redirects do
    plug(:accepts, ["html"])
  end

  pipeline :api do
    plug(:accepts, ["json"])
  end

2 Likes

Same for Phoenix.Endpoint

1 Like

FWIW, plus also ships with Plug.Router which provides a similar API to Sinatra, except template rendering.

8 Likes

“You mean plug also ships…”?

Thank you!

Dear José Valim, what do you suggest to be used for a very SIMPLE api endpoint, and what to be used as an alternative to Sinatra?
A stripped version of Phoenix, Plug, Raxx or something like trot / maru?

You can always use Cowboy directly. Or if performance doesn’t really matter then you can use httpd.

I’m interested in why it is implied that Phoenix is big or complex and that you need to trim some of it…

I’ve done an API gateway with Phoenix. Sure, Sinatra/Sequel combo were a little easier to start with, but only barely. What time you save in initial setup you pay back when you get to 20+ endpoints.

Pretty weird to say that Phoenix needs to get reduced even further.

What are your issues with it?

2 Likes

Because for many people compare Phoenix to Rails, and Rails are HUGE. And from that comparison comes expectation(?) or belief that Phoenix is something similar, huge library that does all the magic in some arcane ways. So I would say that this is a little bit product of Phoenix marketing.

Interesting. Still though, it’s a non-factual claim. So to directly assume it without some checks leads to a slightly unproductive discussion with the person who assumes wrongly about Phoenix.

So in this thread my goal would be to ascertain why is Phoenix deemed undesirable.

Your assessment is quite correct, but there are still things in a default phoenix bootstrap, which you might not need. E.g. if all you provide is a small rest api you can strip out all the channel/pubsub/websocket stuff.

1 Like

I use https://github.com/elli-lib/elli for everything. It is Erlang but would work fine from Elixir and has many years of many production deployments.

3 Likes