juicycleff / ultimate-backend

Multi tenant SaaS starter kit with cqrs graphql microservice architecture, apollo federation, event source and authentication
https://juicycleff.github.io/ultimate-backend-docs
MIT License
2.62k stars 408 forks source link

NEW ARCHITECTURE PROPOSAL #70

Open juicycleff opened 4 years ago

juicycleff commented 4 years ago

I have a new proposal to change the entire architecture to decoupled services and by that, I mean services not tied to APIs directly. For example, in the current implementation and design, the services are closely tied to GraphQL and that was the plan from the beginning, but moving forward, that will change and doing so we can have better control of our services. and graphql should be one means of talking to the services. below is a diagram of how the new architecture should look like. I would need your contributions is you are willing to share

Ultimate Backend Diagram

juicycleff commented 4 years ago

Again the to level Graphql gateways can be omitted in this design giving for flexibility .on how much of your API you need in graphs or rest and the likes @av8ta @fabiofdsantos would love to hear your take on this

juicycleff commented 4 years ago

You can like this new design

fabiofdsantos commented 4 years ago

I believe this new architecture makes more sense to build a generic starter kit..

juicycleff commented 4 years ago

As of today I have migrated to project to the new architecture. I'm still writing tests. I will make a push to a V2 branch this weekend. Stay safe

juicycleff commented 4 years ago

Here is the new architecture https://github.com/juicycleff/ultimate-backend/tree/next . I Will add a multitenant project service to show multi-tenancy. You will notice things are more cleaner with a lot less boilerplate code. It should be out by tomorrow with test and DevOPS working. The GraphQL mutation API is also rewritten in a cleaner way mind you. In some circumstances, the mutation API structure in the master branch is better. Look at issues involved with GraphQL mutation namespace

Role-based access control, as well as tenant access token API, has been rewritten to match modern-day API key spec.

juicycleff commented 4 years ago

Who uses Kubernetes and CoreDNS as a service registry?

juicycleff commented 4 years ago

Note next branch has been merged to master

kamranblueeast commented 3 years ago

Any one tried with consul configration in docker-compose.yml?

kamranblueeast commented 3 years ago

Hi @juicycleff , I am stuck at configring consul in docker-compose.yml. Any directions?

cemeheeb commented 3 years ago

@kamranblueeast for me, next steps solved issue:

  1. Define network in docker-compose: `networks: backend: driver: bridge ipam: driver: default config:

    • subnet: 172.172.0.0/24`
  2. Setup IP address for consul and define env variable CONSUL_HOST like below: ` consul: networks: backend: ipv4_address: 172.172.0.201 container_name: consul ports:

    • "8400:8400"
    • "8500:8500"
    • "8600:53/udp" image: consul command: ["agent", "-server", "-bootstrap", "-ui", "-bind={{ GetInterfaceIP \"eth0\" }}", "-client", "0.0.0.0"] environment:
    • CONSUL_HOST={{ GetInterfaceIP \"eth0\" }} labels: kompose.service.type: nodeport kompose.service.expose: "true" kompose.image-pull-policy: "Always" `
  3. In every apps/service/src/bootstrap-development.yaml, also need to replace localhost to ${{CONSUL_HOST}}: consul: host: ${{CONSUL_HOST}} port: 8500

Note after change apps/service/bootstrap-development.yaml you must rebuild docker image. I am not expert in docker and in this repo, but this helped me.

kamranblueeast commented 3 years ago

@cemeheeb thanks, let me try with this one.

kamranblueeast commented 3 years ago

@cemeheeb, if you can explain point 1? and after setting networks:backend as you set in point 2, it prompts me network undefind error.

duniapay commented 3 years ago

anyone still working on this ?