how-we-do-cool-things (2 Part Series)
We @ coolLabs are working on several ideas simultaneously and it's really hard to keep everything in our heads. So what are we doing then?
Personally, I write notes / todos a lot. It helps me to focus when I start coding, or if I found some bug on the way but I cannot fix it ASAP, I just quickly write it down and get back to it later.
I have limited time to work on my projects - mostly when my kids are sleeping, because if they are not, I'm having fun with them. That means I need to concentrate more on what to do when I'm coding!
I used Google Keep for a while, it was good, but after I came up with the mission of coolLabs, I decided to write a similar application, but with our mission in mind.
It's called coolNote, try it!
As this was our first application which uses backend & database, I had to figure out a lot more for it than I expected in the beginning.
All the things that I build now, needs to be usable by our future applications aswell, so I had to think everything twice at least!
- Do we use API or Websocket server? (Both!)
- How the authentication process should work?
- How we structure our codebase to be able to integrate our future apps faster and easier?
- How the database schemas should look like?
And if you read about our mission, then you probably guess what is the major problem we need to solve:
- How should we do and simplify our builds & deploys of our frontends and backends? We do not want to do manually.
I used REST API backend in the beginning, but in a short time I realized that it would be much more efficient to use websockets and also the features I would like to add later on will be easier with it - where real time communication needed.
So we built a REST API for services like authentication & a Websocket server for real time, two-way communication, each of them with good code structure to be able extendable easier.
This is our first application where the user can login, so I had to create some kind of authentication method in such way that we can use for all of our applications aswell.
We needed an SSO-like authentication - if you login to one of our application, you are logged in to all of our apps in that browser. It is a super user experience in my opinion.
That's when our login service was born.
The full code is under 100 lines, exactly 58. Cool right?
If you visit the page directly and sign in, you will be redirected to our main page, nothing interesting, but if you would like to experience the full process, try it in coolNote.
When I started coding this app - before the mission of coolLabs was totally clear - we used Heroku for our Node.js backend and Netlify for our frontends.
The deploy process was awesome, but they are using AWS (?! not 100% sure) for hosting.
After some days of thinking, I figured out a solution. We call it:
(The name is not permanent 😆. The service only available for us at the moment, but we are thinking of publishing it.)
Our development process is the same as it was with Heroku and Netlify.
We just push code to git and through Gitlab and Github webhooks the service builds, redeploys our applications and configures our reverse proxy! (All of the code are bundled into a docker container, no mather if we define a Dockerfile or not, reachable only through the reverse proxy!)
It even notify us through Discord!
(Yes, 2 seconds to redeploy our API - it is using the super cache mechanism of Docker and some custom caching methods for special cases)
It costs us $5 / month, not free as Heroku/Netlify, but still a fair price 😃.
I will write about this in a separate blog post. I think it's worth one with more technical details.
The frontend code is open sourced.
Thanks for your time!
See you later!
Next on the coolLabs blog:
coolify - Our own Heroku-ish and Netlify-ish service!