pmjoe
In case I need to build a JSON API is Phoenix overkill? I don’t quite like the way Phoenix is structured, it remembers me a lot Rails, and given the fact that I just need to expose an JSON API, is Phoenix overkill? Or let me put better, do you see any limitations on using Plug and a router directly?
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hubertlepicki
Phoenix is using Plug. If you’re okay with hooking up everything yourself, there’s no problem just going with Plug, and Cowboy/Bandit directly.
I would not do it, and most people would not do it too probably, because it may prove to be extra work nobody wants to do, and end result being inferior to what Phoenix provides out of the box anyway, but people have free will and if - for example - it’s a learning exercise - go for it!
LostKobrakai
It’s so interesting how on the one hand people ask for more and more structure guidance within phoenix and then on the other hand it’s held against it.
There’s two parts to the structure discussion. There’s your business logic, where phoenix really doesn’t care what you do. And there’s the my_app_web layer, where again phoenix doesn’t care, but I’d argue conventions are useful for the next person and having worked on other phoenix projects might give you a leg up. Ultimately you can setup your files in whatever structure you want still.
Even though a JSON api won’t necessarily use all the features of phoenix I still think there are a few very useful ones, which would be missing in a bare bandit/plug setup, like the code reloader, features of the router/endpoint and their testing helpers, all the url handling/generation stuff phoenix provides, the error page, …
tomkonidas
Usually I would reach for phoenix, but on occasion I have used bandit/plug for simple cases. For example I have an application and want to just expose 1-2 endpoints (like a health check or something of that sort.) I would find it overkill to pull phoenix deps in just for that, but if I am building something and expect to add more routes, I would just start with phoenix. You could generate the project without many of the other things you dont need, see JSON and APIs — Phoenix v1.8.8
dimitarvp
You change the file structure any way you see fit. You have 99% freedom. Very little in Phoenix firmly expects this or that in that particular file (if any at all; now I can’t remember).
Phoenix or any framework is an overkill if you have like 2-10 endpoints and you don’t expect the app to change or expand anytime soon, or ever. As @tomkonidas said, if you expect expansion, go for Phoenix. Otherwise you can do fine with just Plug. I’ve done it successfully. It’s a little extra work but at small scales it does not matter and yeah, much less dependencies (though how much is that a true objective positive remains a forever open question).
BartOtten
Use Phoenix. Maybe you get some overhead but also a lot less to plump yourself.
And this is the only thing I ever used a bare server app for.
Most time of development was spend at research to minimize the payload.
Ask yourself: What makes you the most productive? A custom solution with no guidance (for you and your fellow (future) devs) or a fleshed out framework with guides all over the place? Quite sure Phoenix is the answer.
dimitarvp
Well in this case I am not sure Elixir, or any dynamic language, is a good idea at all.
Just use https://gofiber.io/, you can make an “app” with 3 endpoints literally in 15 minutes. Single binary, cross-compilation supported out of the box, faster than Elixir too (if that even matters for these bare apps).
BartOtten
Does it come with ETS and supervisors? Also much easier to be able to use Cachex.
So maybe that other option is even faster but the load test failed too make impact. In the end the load testing company i worked for (so could go full scale for free) ran out of agents. And we ran tests for (inter)national voting events so it was not a small scale (virtual) server park.
Now I think of it, initially there was confusion if the test was pointing at the right IP, as I was looking at the load charts for CPU and memory and they did not seem to respond to the ramp up phase
Productivity wise, I think the Elixir app nailed it and as it passed the test with flying colors…
dimitarvp
I don’t think we are talking micro apps here anymore then.
FlyingNoodle
An entire phoenix application can fit into a single file with roughly 60 lines of code, including dependencies, router, etc.
Like… how much smaller do you want it?
I will post a code snippet when I’m on my computer.
BartOtten
There is this one too
https://github.com/wojtekmach/mix_install_examples/blob/main/phoenix.exs