spring-petclinic / spring-petclinic-graphql

PetClinic Example based on GraphQL
Other
212 stars 123 forks source link

Drop frontend for spring-graphql version? #38

Closed nilshartmann closed 2 years ago

nilshartmann commented 2 years ago

Hi,

I'm going to upgrade the spring-graphql branch to latest spring boot and spring-graphql versions soon (waiting for SB 2.7.0 M3 to be released).

And now I'm wondering, if we should remove the react frontend from the example at all and only provide the backend (like spring-petclinic-rest is doing).

Reasons:

  1. If one wants to have an example for spring-graphql the backend is enough, we can enable graphiql, so anyone can try the graphql API without a "real" frontend.
  2. We can focus on the backend, add more examples, maybe even some more "real-world" usecases (for example perforamnce optimization, integrating other APIs etc)
  3. The current frontend is React and Apollo specific. While this is not an uncommon setup imho (Java/Spring + React + Apollo) it's not a setup everyone uses. Others are using Angular or Vue or using other GraphQL client frameworks than Apollo... So the frontend only helps some people and also it doesn't help understanding spring-graphql at all (I think).

As an alternative we could provide frontends in own projects, as the spring-petclinic-angular project is doing for the spring-petclinic-rest backend.

I really enjoyed building the React frontend and still think it's a good demonstration of a powerful tech stack, I think it's too much for this spring-petclinic-graphql example 😢

What do you think?

arey commented 2 years ago

Hi Nils,

I agree with what you are suggesting. Keeping a frontend could be interesting. The frontend part could me move to a dedicated spring-petclinic-react which requires a GraphQL backend.

By the way, now that we have an official Spring GraphQL project, does it make sense the spring-graphql branch become the main/master branch?

nilshartmann commented 2 years ago

Hi Antoine,

thanks for your response.

Before pushing spring-graphql to main/master (should we rename to main then?) I'd suggest to update to latest Spring Boot 2.7 Milestone. As I'm currently having some time, I'm already doing the update here on a local branch, think I will finish it, when Spring Boot 2.7M3 soon will be released. As part of the upgrade I also could create a spring-petclinic-react (or spring-petclinic-graphql-react) and move the existing client to that project.

arey commented 2 years ago

Yes we could now use the main branch name and set it to the default one. I still never do that, but let's try. It's ok for me that you are using the latest Spring Boot Milestone. And I'm ok for the name spring-petclinic-graphql-react (but we could rename spring-petclinic-angular to spring-petclinic-angular-rest). I think you have the permission to create a new repo.

nilshartmann commented 2 years ago

Thanks a lot for your repsonse, Antoine! I will do so. If I'm having not enough permissions or other problems, I'll ping you again :)

nilshartmann commented 2 years ago

Good morning @arey ,

on the spring-graphql branch I already removed the configuration for mysql and postgres, so that branch only contains the hsql example 😬.

I removed postgres and mysql config, because I changed the hsql schema slightly and also created more sample data and hadn't had the time to adjust the config for the other DBs as well.

But: do you think we actually need mysql and postgres config? I'm a little bit unsure, because if one wants to learn how "GraphQL for Spring" works, there is imho no need for using another database, because spring-graphql doesn't matter about a concrete database (esp. if we use Spring Data JPA that abstracts the DB anyway). Personaly I find having multiple configurations a little distracting because it shifts the focus away from the "real" things needed for GraphQL . Also that means more work for us to maintain and complicates testing.

If you disagree, I'll re-add the config for postgres and mysql and adjust it with the changes I already did for hsql schema.

What do you think?

arey commented 2 years ago

Hi Nils, Supporting a production ready database like PostgreSQL or MySQL could be interesting and reassure some developers. But if you don't have time, no problem, it could wait an external contribution. Personally, for sample applications like Petclinic I'm only using HSQL or H2 database.
Thus it's OK for me

nilshartmann commented 2 years ago

Thanks for your feedback!

Then I will focus on hsql / h2 first.