kamranhossain
Best practices to build APIs for mobile apps
For mobile apps in Elixir, Phoenix apps what is the best practice?
Using GraphQL API with Absinthe and consume it with the mobile frontend?
Using a simple REST API and consume it with a mobile frontend?
How LiveView fit in the whole picture?
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project.
My initial shotgu...
New
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog
It says that Fly is going all-in on sprites, which is a worry ...
New
Other Trending Topics
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
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
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
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
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
Latest Phoenix Threads
Chat & Discussions>Discussions
Latest on Elixir Forum
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
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #performance











First 7 of 7 Posts
Eiji
I’m not mobile developer, but I can say one thing … Many companies due to reduce costs does not optimized apps and games well and
COVID-19-related problems shows us that such approach is gonna fail sooner or faster. Depends on country problems with for example overloaded networks are still noticeable.Therefore if I would be able to choose
simple REST APIorGraphQL API(or similar solution) I would not need any time to think about it. Anyway still every solution is best in its own use case. The only thing I can suggest you is to choose wisely based on your project and consumer needs.Personally I don’t like putting
web-based solutions when talking aboutnativeapps. I would useLiveViewonly for browsers. I’m not an expert in security, but generally I’m against embeddingwebapp in browser and delivering it like a normal app. Not sure how it works on mobile devices, but let’s even assume that such browser would be delivered byAndroid… If so what’s with updates?When
LiveViewis aweb-app(notAndroid app) you do not need to worry what browser is using user. However when youdependonbrowserorWebView(wekbit?) you are responsible for updating your dependencies. Now keep in mind that many mobile users does not updates apps often unless they are forced to do so. Therefore in my opinionweb-based solutions inAndroidapp does not makes sense. Obviously same happens even forLiveViewas such dependency (clientJSpart) also needs to be updated (for example last time we got awesome uploads support).kamranhossain
I also think so. I personally prefer GraphQL API instead of REST API.
outlog
I use react native - connect it to a phoenix channel and send all stuff over the channel, you can easily send graphql over the channel if that’s your thing - then you get a thin/small channel(very little code).. I just use normal msgs over the channel, so mine is kinda “thick”/a lot of code in channel..
kamranhossain
Great. Another perspective. I will look into it. Thanks.
factsfinder
Right now I’m using the graphql way like you mentioned. API with absinthe and consume it on UI.
I made a full featured boilerplate (pending tests) of API only Pheonix framework which I’m using in my side project. Give it a check here: GitHub - factsfinder/phoenix_api: This is an api only phoenix framework boilerplate which supports graphql, authentication and aws/backblaze s3 and thumbnailing out the box as of now. · GitHub
I’m pretty sure you can save a lot of time using this.
I’ve only used Phoenix as an API only so far. So not so sure about the live view. But I’ve heard good things about it. However, I think it is limited only to the web side ?
kamranhossain
Thanks for your comment. I will look into
pheonix_apiproject. I like the way absinthe GraphQL API.I have somehow the same opinion on LiveView.
Matsa59
Also it depends of your needs. Do you need real-time app using rest api? Phoenix will be the best choice IMO.
You prefer use GraphQL? You don’t need Phoenix at all (you’ll not use channel, live view …). For real-time app, you can simply use Absinthe subscription (just follow the absinthe QuickStart with plug).
For the main question :
GraphQL offer something really interesting for mobile : selecting data that you need easily (reduce network packet size for example).
Rest allow to create and update things easily. You don’t have to create your « input_object » that can be really painful sometime. (Imagine object A that use B; B use C etc). In rest you just work directly with the data.