Guy14

Guy14

(p)repair project – JSON:API specification integration

Hello,

Long abstract

I made a first post 10 months ago about my project, and my beginnings in programming.

So I’m creating a project from scratch (since about 10 months, with 3 months dedicated on totally other stuff).

I am accompanied by my brother, who is a master full-stack developer (in my eyes, but not only). But he doesn’t get much time, since he is already full-time working for a company, and already have a great professional investment with them.

He guides me on the app architecture, then I write code, push commits and merge requests that he verifies, send me questions and comments back, and so we advance like that.

So we chose Elixir as a programming language, with Phoenix as a framework for the backend. And because the projects turns to be a (native) mobile app at first, we chose FlutterFlow to design and get the frontend quickly working. Then we will be able to get all the generated Dart code from this low-code tool, and to polish the frontend regarding our needs. But it’s not at all a priority for now, as we can get things working fine in a simpler and (most importantly) faster way.

We’ve advanced on backend code, and I learned a lot (and still have a loooooot to learn) about programming.

To be honest, programming is still not a passion (as it is for my brother), but a mean to achieve my vision through a concrete project. But I also admit it can be pleasant to code when you find solutions to problems you encounters, and learning new things everyday is a pleasant journey (but it don’t makes you live, nor makes the world turns better).

Short abstract

We’ve creating a project with:

  • a backend using Elixir - Phoenix
  • a frontend using Dart - Flutter (currently FlutterFlow to gain time)

The frontend communicates with the backend and receives responses through a JSON REST API.

As it is painful to modify API calls on the frontend (even more in a low-code tool I guess, because a lot of actions are done with clics on an interface, so you can’t easily search/replace), we want to stabilize the API.

After researches with my brother, we decided to rely on the JSON:API specification, which looks very complete, to avoid too much thinking on what we need now and should need in the medium-term.

It is also important for us to have a good API documentation for 3 reasons:

  • it is faaaaar easier to integrate API call definitions to FlutterFlow with an OpenApi / Swagger file than without (OpenApi 3.0 required)
  • it is a good mean for us to visualize the current features of our API
  • it would be useful in the future if we want to share our API with third parties

After other researches, we found tools that may be useful to our project:

Questions

What do you think about our API strategy?

Do you have experience / feedbacks on currently using one or many of these libraries?

Do you have other experiences to share on using JSON:API specification on Phoenix?

If we go this way (with these libraries), does some of you already updated PhoenixSwagger to generate OpenApi 3.0 documents instead of 2.0?

EDIT: I’ve just seen this post OpenApiSpex - OpenAPI / Swagger 3.0 for Plug APIs that I haven’t seen in my previous researches. I start to read it. All feedbacks on my case are still very welcomed :slight_smile:

Most Liked

dimitarvp

dimitarvp

Have you considered GraphQL? Absinthe is a very mature library.

zachdaniel

zachdaniel

Creator of Ash

JSON:API is a good spec. Not a great spec, but AFAIK it’s the best option out there at the moment. Ash users get the benefits automatically through AshJsonApi, which mitigates most of the cost of supporting the spec, but I think even if I was going to hand-write against the spec it would be better than nothing.

zachdaniel

zachdaniel

Creator of Ash

Yes, that’s one of the primary benefits of Ash is that you design the application once and the APIs come for free, graphql or json api.

Guy14

Guy14

No worries @zachdaniel , it’s always good to exchange, and for me to have feedbacks.

I recently realized how annoying could be repetitive code writing for authorization tests so I got interested into Elixir macros for the first time. I am forced to admit it was worth the time to learn new things and apply them for maybe a full day, rather than writing almost same tests for many controllers. And this is certainly a huge gain of future time when modifications will be needed on these tests for any reason (and it will happen for sure).

I took the time to read your blog articles on declarative design and an incremental approach about it. It seduces me on that way, for sure, even if I’m just a bit scared about my current capabilities to properly write such engines. I think it requires more thinking time. But perhaps it’s the key for implementing new features faster in the future.

And to be honest, my brother is always advocating declarative design (he’s using NixOS, so I am) since many years from now, so maybe it’s already time to upgrade our project code, even before the MVP launch… I’ll try to keep you updated on our project’s choices!

dimitarvp

dimitarvp

Possible, but not necessarily. You can still get away with a normal API token but sadly yes, putting the plugs and basically the boilerplate in place that’s required for that to work is more than what you’d do with only plugs.

Where Next?

Popular in Questions Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
kostonstyle
Hi all I want to have a unix time, from the current time plus 1 hour. DateTime.now + 1 hour How to get it in elixir? Thanks
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement