CDN-ize Your Projects with Smart CDN @zeit

Hey folks,

Quick introduction

I have been hosting https://simply-debrid.com for a while on virtual/dedicated servers. It has mainly been hosted on Online.net servers. Yesterday I was just going through my google analytics stuff and I got a notification saying that my visitors from Mexico were experiencing slow loads from my website. It came to my mind that I could at least, rather than switching everything into a cloud based CDN approach, being able to swap all static assets to a CDN (Content Delivery Network). This way I could be able to serve those things, cache them the right way to my visitors.

What I have done so far

To be honest taking care about CDN and caching stuff was definitely not my cup of tea. My project is an old from scratch PHP service and out of the core system I recently refresh a bit the design, I am no longer able to rewrite if with fresh new framework everything bundled etc.. So basically few month ago I heard about brotli, a recent new compression tool cooked by facebook. It brand new and it supported by recent browsers too. The idea is to bring brotli instead of gzip for compressing your stuff on the fly. What I did I look into it and added brotli support to my nginx configuration and it went well so far. Please not that you can still keep gzip behind the scene in case brotli is not supported. You can learn more about brotli here: https://github.com/google/brotli

As I was saying I got this message from google analytics, what can I do? So I thought I could start playing with CDN stuff. Few years ago I had some DDoS issues with my website and started adding Cloudflare WAF (Web Application Firewall) and a bunch of other tools that can help you optimize how your website is served. Actually Cloudflare has a CDN solution and provide it for free pretty useful. So since a bunch of things was already setting ip into it (DNS zone etc..). I tried to re-enable things over there but did not manage. I just ended up with a non reachable website but to be honest I did not dug that much to understand the cause of this, but just disabled it and try to think to other solution and of course it has been a time I heard about zeit.co.

Few words about zeit.co

According to me zeit.co is a bunch of great guys that are trying to make developers's life easier through modern programming and applications. They crafted a bunch of things concerning deployment, serverless, CDN and much more. I'm not sure if it's attached to the company but they are heavily active and are also behind the development of Hyper.is an electron-based terminal, next.js the React Framework and many more. Through zeit.co they are giving a bunch of product to make your deployments fingers in the nose.

Smart CDN

So I wanted to have a look to their smart CDN solution. It's crazy.

Click through for source

You can sign up with your Github/Gitlab account, you are gaining access to your repository and then they are setting up everything for you. Once it's done, it's pretty easy you only have to push your assets into the repository. You'll get permanent url + aliases linked to your deployment and your assets are ready to go and SmartCDN cached.

See the dashboard and deployment I did:

You can reach your deployment directly, files and directory will be listed by default. You can override this while putting an index html file or either specifying it through a rule. Learn more here: https://zeit.co/docs/v2/network/directory-listing

Conclusion

As a conclusion, I managed to CDN all of my assets pretty easily with zeit.co. I am now eager to try their hosting solutions or their serverless solution too. I'm inviting you to give it a try, they are doing an amazing jobs to make things happen smoothly, the easy way.