Weekend Fun Coding - 01 : what to do, where to start?

Weekend Fun Coding - 01 : what to do, where to start?

Trying to understand deeply the differences between AuthN, AuthZ implementation using cookies & JWT - setup phase

So, like every monumental task that begins with a single step, so shall this. And, the first path defines what I've set out to achieve.

I've been working on a microservices architecture for work, and one of the points of contention was the implementation of sessions using cookies vs JWT, especially when we have to implement both AuthN (authentication) and AuthZ (authorization.)

So, I thought, why not do a small project which simulates the arch at the rudimentary level, implement AuthN and AuthZ, and have sessions using both Cookie awa JWT. This will give me a detailed understanding of both the implementation and also brush up on some of my rusting skills which do not see action in my daily work.

Yes, a very noble purpose. And, yes, a very selfish purpose too. But, I'm not trying to teach the world anything. This is purely for me, and if it helps someone else out there, then that's just an unintended, but a positive side effect.

So, let's actually begin. Forreal this time.

How many services are we going to have?

So, basically, what I'm trying to achieve is showcased in the below diagram.

Microservices diagram.png

So, as shown above, we have 2 services and 2 DBs. For this use case, we shall use 4 docker containers to emulate real-life environments.

How are we gonna do it?

There will be 4 docker containers deployed with the following.

  1. GraphQL - this will be the API gateway
  2. Node-express - this will be the Users service
  3. PostgreSQL - store data related to Users
  4. Redis - store session data

So, what's stopping you from doing it?

Well, I use Ubuntu for my daily work, and using docker there is a breeze. But, my personal machine is a Windows PC, where frankly, I've not used Docker at all. So, it's going to be interesting to understand how to get Docker up and working on my Windows machine. I hope it will not be drastically different from using it on Ubuntu.

Getting Docker running on Windows

Well, that was easier than expected. Once I installed the Docker desktop, I can basically use WSL to emulate my Ubuntu workflow; running docker through WSL works flawlessly, and it shows up on Docker Desktop as well. That works like a charm.

continued on the next blog...

DISCLAIMER: This is a personal project and might not be the right way to do something. So, please take everything with a grain of salt, and use your own judgement to decide. I'm also open to suggestions to do something better, so if you feel that things can be improved, however trivial that might be, feel free to share. Any and all suggestions are welcome. Peace!