Best practices to build api's in phoenix?

Hi, I have been working on elixir and phoenix for 2 years now. I have been only designing API from that time. But I always feel that I’m not following the best way to build api’s. It’s like whenever I’m checking someone else code it always looks different. So if anyone has a project in mind or share with me something which can help in this it would be a great help.


Seconding this. I’m just learning Elixir now and finding resources on best practices for API development with Phoenix has been very difficult.

Things like error management style, authentication, structuring return values with fallback controllers, etc.

Hoping the framework authors can point us to great resources or coordinate better documentation efforts - I’d love to contribute to a guide for this!


I would also love to contribute if someone guide us or start something

1 Like

The json:api specification might be a good starting point -

There is an Elixir parser here which looks good

1 Like

If you’ll be using graphql you might want to check out Ben’s book: Craft GraphQL APIs in Elixir with Absinthe (Pragprog) :023:

It’s actually a topic I’ve seen crop up a few times, and so if you aren’t intending on using graphql, it might be worth posting here: Your ideas for Elixir book authors and content creators (or, if you want to get PragProg’s attention, we have a similar thread on Devtalk in a section where one of the PragProg editors is active (we actually created the section after a conversation with her).

Other than that it might be worth checking out our API tag as we’ve had quite a few threads relating to the topic :003: #api