Morzaram

Morzaram

Hey everyone I was wondering what does your basic REST API controllers look like?

I miss the rails way of

  • dry.rb based form validation object
  • using AR directly in the controller for saving
  • rendering response

Instead of the current elixir way:

  • create make a changeset in the schema
  • make an update function in the context for that particular controller method
  • connect the schema to the new function in the context
  • use the context to validate, update and save

How do you all do it? It feels like a lot of extra steps and a lot more functions that rely on each other.

Also with this pattern, I’m wondering how this would work at scale. I’m already feeling the chaos between polymorphism, 3 features, and 5 different background jobs working around polymorphism.

I noticed that theres the (drops)[Elixir Drops 💦 — drops v0.2.1] library which feels like dry.rb which is nice, but something feels off on how to manage context, schemas, etc at scale.

Would love to hear some ideas on how y’all manage this. I’m missing rails a little bit in this aspect, not going to lie.

I know I should ‘stop thinking OOP’ and think that it’s all functions but it feels so abstract. I need a way to organize the functions and the default way feels quite overwhelming. I’ve read the DDD book but this paradigm coding and organization feels like I’m spinning a web of complexity (even though this feels right).

Anyways I know this is a bit of a rant but I’m getting concerned of the future of expanding this project that is slowly growing more and more into something that feels unmanageable.

Any advice?
How do you all manage complexity and things like these?

Still feel so new even though I’ve been writing elixir for a few years now…

Thanks,

Showing Posts 1 to 1

krasenyp

krasenyp

The question is not really about the interface. There are a myriad guides on how to structure a web project in Elixir and Phoenix.

As for REST, I usually decide what hypermedia formats I’m going to support. Is it HAL, JSONAPI, Siren, or something else? Then I implement my business logic as a library.

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
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
kszambelanczyk
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
Trolleger
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
RemyXRenard
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
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
samoloth
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
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
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
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
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

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews