Journey of building a Saas product – Demo Hosting

People says that building software is cheap. There is no up-front cost of material, essentially our margin is near 100% excluding human cost. This is partly also why I have chosen this path to walk on my entrepreneur journey.

Despite being relatively cheap in many aspect. In this world of technology, there are many company that offer free trial or even free to use up to a certain limit. This has even greatly enable us to work lower our upfront cost even greater especially when we have not even earning from it, yet need some platform to show case our development. You’ll have to spend some effort in researching and finding the platform that suits you, which eventually when things turn fruitful, start supporting them.

In this chapter, I’ll be sharing on Heroku which currently have support for NodeJS as well. Their instruction to get started is easy to follow and get it up and running. Here is the link for that.

The limitation of the free version here as shown, I am able setup my demo site to last life time, as long as I don’t have a large base of user want to test my application, and they don’t run 24/7.

Once you have done follow the example web. It’s time to dig deep. How to configure our existing software to work on the Heroku’s server-less architecture. If you have been trying out with NodeJS, i am pretty sure most of the tutorial guide you enough to use localhost to view your web page. Bringing the application to server-less is another steps further, yet not too much configuration is needed.

For a start. In most of the application, you’ll need to be listening to certain port.

Example localhost:8080. Which this value is hard-coded somewhere is your code. This need to be change into using environment variable.
var port = process.env.PORT || 8080;

In server-less application. The configurations is manage through the environment variable, which is supplied by provider through certain interface. For a NodeJS use case you are likely will want to run this as NODE_ENV=production. In some case, you can even set NODE_PATH for the relative path root.

Another thing to highlight on the serverless, is the database and file storage. In our usual usage, that database is connected to localhost or sqlite and the file save is normally relative to where the application is running. This can’t be applied anymore in the server-less application.

For database storage, there are plenty of service available. And Heroku itself also have offer free usage of Postgresql of limited record usage. Like I mention earlier, the path to this is again advisable to set through the environment variables.

For file storage, this is where services like Amazon S3, dropbox etc is needed for us to save user upload content to a know location we can retrieve. Then again, you can get free limited number of storage once again if your diligent enough to source for free stuff :). In NodeJS, this is easy to port too, when there is tons of plugins and library to used and call their API.

As for my current system, no upload is needed, and I don’t mind the SQLite is reset every time the dyno went to sleep, since is just a demo site. When I do upgrade this, I’ll update this in the future content when the time comes.