I love GraphQL

I've been using GraphQL with Craft since I redeveloped this site, which is quite a while now. But running someone else's GraphQL API is like training wheels.

This feels like the future to me. I spent a really long time (arguably too long) sticking to PHP and ignoring everything else, in spite of PHP's shortcomings, and regretted it when I discovered Ruby (and now PHP is good?! What the heck). I've done the same with Node because I really don't like JavaScript. ES6 offers a lot of improvements but the syntax still feels very messy and inconsistent in places. There are so many ways to declare functions and classes, and they each have little quirks that JS pros will just roll their eyes at me for, but they're there; don't deny it!

But using Node for Apollo and React for a frontend is very nice. I would love to be able to use Ruby for my application logic because it's just so beautiful, but comfort is the enemy of progress!

It takes a while to get things up and running but once you do it's super satisfying. I'm using Apollo Federation (thanks Charlie) to pull in GQL Services from different endpoints to one API, which works really nicely.

The only thing I'm not a huge fan of is using JWT for authentication. I'm used to authentication and authorization being close bedfellows, but that can't be the case here. The approach I'm planning to use is for my gateway to check roles against a user ID, then pass those roles as context to each service so that the service can decide what those roles mean. It also makes token invalidation easier/possible because I can have a "banned" role which, when found against a user, can hopefully reject at the gateway. I'm at the stage with this where I'm just enjoying seeing things working, so I'm not sure if this is any good, but I'm having a laugh!

The one thing I've missed with this new Craft/GQL/React/Docker setup for my site is a playground. Using Craft as a backend makes that pretty tough. I used to do loads of little experiments when this site was on Rails and I miss doing that. I'm currently working on a microservices-based way to track my collections in Animal Crossing. I'll be making a signup and login so that others can use it, then I'll be adding the ability to calculate trades with people to help complete fossil and KK Slider collections.

It's not world-changing stuff, but doing this really helps me to learn new technologies and solve problems before I come up against them at work where taking ages on something costs me money!

I hope to have this all live by next weekend, but it's likely to be a lot sooner because I'm really enjoying it!