lucidarch / laravel

[DEPRECATED] See https://github.com/lucidarch/lucid

Home Page:https://lucidarch.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How about GraphQL and CommandBus?

elymatos opened this issue · comments

Hi, thanks for the god job!
I'm considering LUCID adoption, but my current app uses GraphQL and CommandBus (via Tacitian). I'm wondering how these pieces come in the LUCID architecture. Any suggestions?
Thanks,
Ely

Hello Ely, and sorry for the late reply.

CommandBus is an extremely similar approach to what LUCID provides, except that the naming conventions of the classes are enough to communicate code structure and the relationship between the different components. Moving from one LUCID project to another will make you feel like home instantly due to the familiarity with naming and code placements.

GraphQL on the other hand, is completely independent from what LUCID is trying to provide. However, you may come up with an abstract and reusable pattern that helps you achieve deep GraphQL integration in your application.

My only experience with GraphQL is with the GitHub API, here's how i structured it:

  1. In src/Data/GitHub
    Screenshot 2020-09-14 at 10 58 39 PM

We have the Queries folder where we write queries in .graphql files so that we get the full IDE compatibility such as code completion, syntax check, code lint and most importantly using schema files.

  1. There's src/Data/GitHub/Client

Responsible for the communication back and forth with the GitHub API.


Of course, none of these classes should be called directly within a Feature class, but instead to be wrapped by Jobs that return value objects, a.k.a. Entities in our case.

Have you had a similar experience? how did you structure it eventually?