Andrei

Andrei

Hi

I’ve been contemplating this issue for quite some time and haven’t come across with a good solution and was wondering on your viewpoints and how you’d tackle this problem in the most efficient way possible.

The Problem:

I have many different projects built with Elixir/Phoenix and some are on the way to being released. If I only had 1-2 disconnected apps this would not be a problem.

During the years I’ve added a variety of bits and pieces such as a user management. CMS, Payment processing, accounting, invoicing and a variety of tasks which I’ve had in different libraries and programming language.
IN order not to “reproduce” the same functionality on all application I even created a phoenix library which installed such as phx.gen.auth.
HOWEVER due to my fiddling with many different technolgies on frontend (switching between tailwind, bulma, pure css + others), backend processing, even elixir apps, server side, cloudwise (kubernetes)
I soon found out that managing such a library created too many dependencies and it complicated the workflow enormously. Backwards compatibiity, upgrades, bugfixes and differences in Elixir, Erlang and PHoenix AND other libraries upgrades and deprecations made it impossible to actually get anything done over the array of the majority of the projects as the dependency cycle grew. Ex: I’ve had 2 apps implode 2 times because of a Nebulex upgrade which was not immediately visible in the authentication system (seconds changed to milliseconds, users kept getting logged out in a few minutes).

A HUGE FRICTION OCCURRED AND FRUSTRATION ENSURED. I even gave up the library concept after 3 years of hard work and decided to go anew with the projects with the latest phoenix. But i’m constantly finding I need certain bits here and there and the library idea is still around because of this.

I’ve tried umbrella apps, monoliths, the library approach and can’t quite find a sweet spot. Because I feel that the productivity/efficiency/capabilities system is kind of “missing”. The ONe thing I’m mostly missing is a plugin system akin to systems such as PHP have. Or even the Tcl’s dynamic interpreter stuff which means pushing changes accross systems is almost seamless.

I was thinking that the admin interface should be built on something totally different and that it could look identically on all apps to minimize this friction in the event of using a central reusable library model. What are your thoughts on this?

Latest Ideas

I was considering building a central microservice system which would instead do all of these things to minimize friction.
The idea would be that it would communicate with an API where i’d be able to build as simple library to handle this.
THe “problem” i’m facing is for payment processing and online shop i’d have to redirect from App A → App B → App C → App B → App A

  • App A (Any App making usage of the microservice)
  • App B( MicroService)
  • which would redirect to the payment processor (App C) Which could also mean a more complex architecture because there’s also a gateway in between

This would probably confuse the end users as iframes aren’t really that good.
An option I thought about was to add a subdomain which redirects to App B (the microservice) without it being “visible” to the end user. Although the API communication would still need to occur.
This would greatly simplify everything as I’d only have to manage the API library instead of the whole cycle of dependencies and I’d keep
I’d also like for a way to interconnect with the system such as that user info may be available accross platforms.

What are your thoughts on this?

Thanks.

Showing Posts 1 to 1

lud

lud

You could put an app in front of all your services. The browser would only talk to that app, and that app would call the different services.

We have a similar pattern, it is an had oc implementation of the Saga Orchestrator Pattern:

  • The frontend sends a message to start some operation. In your case that would be a payment.
  • The elixir app creates the operation in database and starts a workflow
  • The workflow talks to some service to validate the payment and get some technical data
  • The workflow then talks to some other service to create a payment URL with your provider, and sends the URL back to the frontend (in our case we send those updates with an async message queue, but you could wait in the original HTTP request to get the response directly)
  • At some point the workflow has finished its work and stops
  • The user pays on the bank payment page
  • The user is redirected to your frontend (or you receive a workflow). That is sent to your elixir app that will start the workflow with the new payload, load the operation state, and continue a few steps until it is done.

Note that at each step you must persist state if you want to resume from there in case of crash.

Also, in case of error, your workflow state must remember each step it has executed in order to be able to run compensations. For instance if the followed steps were this: create_payment -> bank_payment -> mark_order_paid -> error Then you should run compensations: cancel_order -> refund -> mark_payment_failed.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
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
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
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
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
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
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
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews