How GistScript works under the hood

January 27, 2016

GistScript is the home for all those important scripts we cannot build a standalone app for. It’s a convenient and reliable place to safely store, run and schedule scripts in the cloud. Read the previous post about it.

I said before GistScript was born out of a necessity.
As you may know, when we developers have a problem to solve we over engineer things a bit. Be it making a simple alarm clock that turns into a fully customizable dashboard with built-in custom themes and plug-in or a straightforward WordPress website turned into a WordPress framework. Believe me these things exist!

I have learned over the years that over engineering things in the beginning often kills products. I say this because I’ve had it so many times leading my previous dev team. The focus should be to find the best solution to a problem, fast.

I tried my best with GistScript and I think a made quite a good job.

I started really simple, you can only execute ruby scripts because they can be evaluated out of the box by any Rails application. I know, evaluation sucks but let me get to that in a moment.
I believe users would love to write stuff in their own language but for two reasons I decided to go with Ruby first:
1) I simply didn’t need anything else. I use ruby all the time and setting up a rails app is a breeze, especially on heroku.
2) Ruby is very popular and versatile and if anything I wanted to turn my idea into a product as easily as possible and test if there was some interest in it.

Scripts are saved into the database, in plain text. I know what you’re thinking, I know how bad this is. Heroku doesn’t allow any file to remain on their servers for more than a couple hours, they soon get trashed out. The easiest way to save those scripts was keeping them in the database. This will be improved over time.

I execute scripts using the eval method. You’re sad, I can understand. By now however you get the sense of what the challenges in building a product are; sometimes you have to craft something very quickly just to understand if the direction is right, then you improve.
EVAL IS EVIL. I am trying though to secure the environment in which every script is executed using safe bindings that provide you a playground in which you cannot break things too bad :)

For scheduling I’m currently using the default heroku scheduler application which is doing the job.
For email notifications I’m using theĀ  postmark plug in available in heroku.
For SMS notifications I like twilio very much and I’ve made sure to setup a custom implementation of it using their awesome gem (sms notifications are going to be released soon)

Let’s write down GistScript’s tech stack:
– Server: heroku, rails application
– Web application: Ace editor
– Database: Mysql
– Email notifications: zoho mail + Postmark
– SMS notifications: Twilio and its gem

I would love to hear what you think of GistScript and of its tech. Just shoot in the comments, I’m here.