heroPhoto by Mathieu Stern on Unsplash

Cost Driven Development

Are you a fellow software engineer who had great product or business ideas then abandoned them? Have you been put off the idea due to hosting and running costs? I think we can all agree that it would be a shame if a million pounds idea got buried due to early-stage costs. At the same time, we need to do our best to navigate the money-grabbing realities of SaSS and platforms out there. Sure, a few pounds for a domain here and a few pounds to spin up a server there might not sound much on their own. However, when combined, they could quickly deplete our savings, which is not what we want. Continue reading, and I'll be sharing some of my thoughts and tips around how to cheaply or even create side projects for free.

Developing software is cheap when it only requires our time

As developers, we are the perfect group of people to experiment and trial digital business/ideas with extremely little commitment, which essentially boils down to our time. Countless open source libraries are at our disposal to speed up prototyping and coming up with an MVP from our idea. Maybe one of these projects will become the opportunity for you to quit the day job, make a lot of money, take control, or whatever your dream may be. We should understand how lucky we are; business people with ideas who lack technical skills can only dream of our situation.

Of course, building any product can be complex and time-consuming. If we want to make a quality product loved by users, it is even more challenging and demanding. However, this doesn't change the fact we don't need capital to create Proof Of Concepts (POC) to try out business or product ideas. As we all know, hiring us developers is expensive.

Now, we've established the fact being software developers give us a massive edge over everyone else. What stands between us and the idea we have is simply time. So, what are the other costs we need to consider?

Hosting an application is expensive

Since it is so cheap for us to work on side projects, I tend to work on poorly considered projects. Despite this, it is still an excellent exercise because I'm learning in the process, and I can showcase these projects to people. I'm a big fan of the concept "succeed even when you fail", whereby mixing in some learning, you are guaranteed to walk away with a smile even when the business or product idea does work out. For example, creating a side project using Svelte may not reach the Facebook level of success. Still, by the end, the enhanced Svelte skill might be excellent if a Svelte job opportunity presents itself.

These "low cost" personal projects often lead to a large number of apps created. Naturally, we'd want to share them with the world considering we put in time and energy. However, hosting these applications often comes with some costs. It could be as essential as domain names, Continuous Integration (CI) pipeline, etc. I would categories these costs in two ways: 1) baseline fees, these are the charges that you cannot avoid, e.g. minimum requirement to ensure the application is running, 2) usage fees, cost that increase with usage.

The first cost category is easy to predict but hard to avoid. The good news is that these costs tend to be on the cheaper side. That is as long as you are flexible, e.g. you can probably pick a domain name that's as cheap as a few pounds or more than thousands. For an unproven side project, I'd personally lean on the cheaper side and get a domain that's "good enough".

The second category is harder to predict, but often there'll be a free-tier. Unless you are getting some decent traffic or load to the application, it is unlikely to cost too much. Just be careful because these tiers are there to draw you in, so it doesn't take much for the cost to rack up, e.g. someone might decide to crawl your site a few times or DDoS it for fun will send your bill rocketing. On the other hand, if the product is attracting legitimate users, which increases cost, this could be problematic if there isn't a business model to generate revenue.

This is where Cost-saving Driven Development comes in

What do I mean by Cost-saving Driven Development? As the name suggests, we are putting cost as the absolute centre when designing and writing software. In my opinion, projects that aren't sustainable on their own isn't worth having. Thus minimising cost shouldn't be one of the goals; it is the only goal. Is a portfolio of applications that costs hundreds of pounds a month to run worth having around, on the odd chances some mystical future employer stumbles on to it? I would argue a Github portfolio might be better in this case. Take some screenshots and videos to demo your work if the codebase by itself is too boring on its own.

It is too easy to create a technical design and solution to a convoluted and expensive problem in today's environment. There are so many SaSS products out there waiting to grab hold of our wallets, failing that there are the big boys in town. Yes, I'm looking at you AWS, Google Cloud, etc. Did you know that Amazon gets 70% of its profit from AWS alone (Where the money is really made at Amazon)? Guess where the money came from? That's right, businesses and individuals like us.

Unlike a profitable business, as individuals, we don't have lots of money to splash around. Personally, I have very little incentive to throw money at several projects that I don't know will succeed or not. I'd probably be better off to invest that money in the stock market. Therefore, the cost is always the first thing I think about when I work on a side project.

I have dedicated a whole section below on a list of my favourite services and platforms for creating side projects. But here are some general tips that might lead to some cost savings:

  • Instead of buying a domain for each product, use one domain name for all of them. E.g. I could use *.hao.dev to host different apps.
  • Consider bring in some revenue to support more popular projects. Get donation, sponsorship, advertising, or any other way you can think of and bring in some money to pay for the bills.
  • Researching all the tools and services can be tedious and time-consuming. Reading comparison articles can be a fast and effective way to get a rough idea of the best options out there.
  • Search around for promotions, free credits or sign up discount codes to maximise your allowances or benefits. Services and platforms often use these techniques to bring in new customers.

Another take on Cost-saving Driven Development from a professional angle

As software engineers, costs aren't something we consider in our jobs until the middle management level. Therefore, it is understandable for developers not to think about cost and cost-saving. I find there are always many options to achieve the same goal using various techniques. For example, I implemented search functionality on this blog utilising a SaSS service called algolia, which focuses on searching instead of building a search API myself. I could have implemented a serverless API that performs searches and returns relevant results. Taking a step further, there are even ways to generate a JSON file during the build stage, which then can be used as a "fake" search API (see https://github.com/sw-yx/netlify-plugin-search-index). All of these approaches have their benefits and drawbacks. We should always consider them all, then made an informed decision.

I once heard a client saying that their company AWS bill was £2 million a month. Why? Unused servers and other cloud resources are significant contributors. Allocating too much resource is a common problem as well. In my opinion, costs should be at the centre of cloud infrastructure. Each pound spent should be intentional and be reviewed after a while to see if it still makes sense. The more mature engineering teams have reporting setup to see where the costs are coming from, but too often, cost is a byproduct and not a constraint.

One of the reasons why companies and business have a massive "tech" bill is because people often blindly following approaches defined as the "common approach" or "best practices" by companies or industry experts. In these situations, teams would disassociate cost from the technical implementation details altogether. If option A saves the company thousands of pounds and option B is slightly more brutal to work with but free, shouldn't we consider both options before jumping on the first one and calling it a day?

As engineers, we are constantly told it is better to over-engineer and cater for possible unexpected developments later. Based on my personal experience, I'm not sure this is true. Over-engineering is expensive in terms of development time. Additional unknown factors and the extra architecture setup are reflected in the cost to accommodate potential future changes.

Part of me thinks it is unfair that we make fun of business people who always talk about costs, want things done yesterday and has no regard for software quality. Aren't we also a little hypocritical to value code quality over time and never consider the cost side?

cost time quality diagram

I think many people jump on the latest trend without really considering the actual benefits for the company or business, whilst others refuse to move on from the tech stack they are familiar with. It isn't good to be in either of the two extremes. Instead, we should all aim to be somewhere in the middle.

I think putting cost at the centre will allow people to have more concrete debates about technical implementations instead of opinion battles. In dev chats, people often argue over different approaches and require a higher power to intervene when they reach a stalemate. For example, someone might say, "We should go with SSR because it performs better on low-end devices". Someone else will argue, "CSR can be optimised to work just as well". By considering cost, the conversation might look like this, "SSR will cost £x and add additional complexity to our approach, whereas CSR cost 1/10 that much but may need longer development time to optimise the performance on low-end devices". Placing a limitation such as cost will facilitate discussion and reduce the scope of possibilities makes sure people are no longer arguing about ideologies and talking about practical solutions.

Introducing limitation doesn't remove our ability to innovate. Rather, it pushes us to find ways around those constraints. There's a quote I love from the book How to Take Smart Notes: "the limitation of canvas does not reduce the artistic expression of artists".

Here are the best cheap or free services I'm using

The services I use are either free or has a basic free-tier. I have checked and made sure the allowances given as part of the free-tier is more than enough for side projects. If you get close to them, then maybe it is worth considering monetising these projects to cover the extra costs?

My workflow is straightforward, and I usually start working on a project idea in CodeSandbox. It is as easy as opening up my browser on any machine, and then I could start coding away. The path of least friction is critical for me at this stage of the process, where the most important thing is to visualise the idea. It is possible to create web apps like this, and CodeSandbox will host it for free. My advice is to move into local development as more files and computation will cause a slowdown.

Once the project has a few pages, this is when I'd migrate the code into a Github repository. Since they made private repository free a couple of years ago, there is no reason to go with anything else. Gitlab, Bitbucket, and other alternatives are all fine too but I always end up coming back to Github.

My go-to choice for CI and CD pipeline is Netlify. I am getting close to the CI build allowance. When I go over it, I might decide to pay for this as it has made my life so much easier. The only other real competitor to Netlify is Vercel. Of course, Github actions is also very competitive, but Netlify and Vercel are more straightforward, more powerful, and there's something nice about having a dedicated CI pipeline.

Netlify and Vercel also come with other added benefits such as On-Demand Environments (ODE), essentially creating a preview for each pull request you make, allowing you to test out the app before merging the code to master. They both host the static files (e.g. HTML, JavaScript, and more). They have built-in CDNs for custom domains, redirects, etc.

Netlify and Vercel support analytics, but both platforms have it under paid-tiers. I decided to stick with Google Analytics for now because it is... you guessed it, free! There are also a number of other alternatives with better privacy promises, e.g. Matomo. On the other hand, Segment seems to be a popular choice for businesses.

I use a headless CMS for storing my data if I'm creating an application that is content-heavy. My top choice right now is Prismic with Contentful at a close second. If the application needs to store user-generated data, my go-to database service is FaunaDB.

I have covered some of these services in more depths here: Awesome tools to use in personal projects.

Summary

As a software engineer, I love to experiment and work on personal projects, with the dream of one day creating a product that goes viral. Needless to say, this is both a luck-based exercise as it is through hard work. It will take many, many attempts at different ideas to be successful. Any failed experiments can be costly if we are not careful, not just our time and energy but may even leave our pockets empty. So it makes sense for us to make minimising cost our number one priority. Only by taking the financial burden off our shoulders can we enjoy the process of working on personal projects. Knowing that if the project isn't successful, we have nothing to lose, only valuable experience and learning to gain, is comforting and motivating.

Finally, based on my personal experience with cost-saving, there's a point where it'll give diminishing returns. Don't end up spending months researching the cheapest way to do something. Just be pragmatic and practical with this whole concept.