What's so special about Minimal Weather now?

Minimal Weather

Minimal Weather does a cool trick, which is updating the app icon when you check the weather. That's a good thing, it helps you knowing what to wear to go out.

One of the new tricks it has, is showing you an umbrella if there's a chance of rain in the next 8 hours. That way you can be aware of rain before going to work.

And one of the most important things: it's open source!: https://github.com/elcuervo/minimalweather

Also, it changes colors based on the comfort temperature, so you will know if you have to get a coat or not ;).

Hot and cold

The technology behind it:

The icon update

icon

The concept is pretty easy actually. Apple provides a link rel='apple-touch-icon', their version of a favicon.

That's the special icon that the iOS device uses in the home screen.

I started some experiments and then realized two things:

  1. The icon is read every time the app gets loaded and probably checked against any old version.
  2. MobileSafari supports data-url content.

Then I started this idea with some goals, to not use any images, as simple as possible and as little backend as possible.

The truth behind the idea

Initially I started with a pure HTML5 + javascript implementation. Using browser geolocation and canvas + a really pretty typography.

The problems

But things didn't work as well as I was expecting. The geolocation being asynchronous proved to be too slow as an information source to render the icon and allow the device to store the icon I was generating.

Also using the typography in the canvas element wasn't reliable enough, some times the generated canvas didn't include the weather icons because of the loading + rendering time.

Language

Go

Weapon of choice: Go

The backend of the application is written in Go. I chose Go for several reasons:

Geolocation

Go

Weapon of choice: Maxmind

If you take a look to the code you'll realize that there's an IP geolocation but when you use the app it asks you to allow HTML5 Geolocation.

The reason behind it is simple: The first time you use the app it will use your IP address and save the result in a cookie, then the geolocation starts and if for some reason the geolocation and the ip cities are different it will refresh the cookie with the new value. That way I'll save some requests to the IP geolocation service.

Javascript

Javascript

Weapon of choice: Vanilla Javascript

I know that there are amazing libs out there and I really tried to apply them to Minimal Weather but I found a huge overhead in development and in the final product, so I'm using vanilla JS. The only place where a lib is used is to do a geolocation check and I chose zepto for this.

Keeping things simple is what allows this app to exist. A quick execution helps the canvas to be generated. Little overhead makes this developer happy.

Database

Redis

Weapon of choice: OpenRedis

The database Minimal Weather uses is Redis thanks to the OpenRedis guys. There are a few reasons on why using Redis. One of these reasons is because I really like it but besides that, the key expiration helped me a lot to handle the weather, ip and location caches.

Thanks to:

I can only make this project thanks to friends that hunt bugs and give me amazing feedback. Love you guys.