When Should you make a custom API and How

John Ex
5 min readMay 8, 2021

--

For the people following my progress, you’ll know I’m making a fun web game and my immediate next step is a backend. Why am I considering using both a custom API and a ready one? And why should you?

This blog is not about whether you should learn to make a custom API or not because I believe it is an essential skill, even if you plan to exclusively use ready APIs. The focus is more on how to decide which to use for each situation.

Ready API

Pros

Ready APIs are great! They allow you to get started immediately with whatever it is you need to do, without having to make it yourself. Someone already did it for you!

This is great because it is time-efficient and most times a stable, bug-free version, with useful features. A good reason to use a ready API is also the security already implemented so you don’t have to figure that out yourself or hire someone!

Another useful thing is that if you use an API for something like signup or payment, it's likely the user will already have an account with information and settings already set. This makes it easy for the users and can oftentimes be a big reason for using something like a Gmail login over a custom one.

You also most times do not have to host and run the program yourself! They have their own servers and domains and formatting for everything that you can just easily use after studying up on the documentation.

Cons

You often have very little control over what you can do with the information, and you can’t add your own functionality to it.

It can cost you a lot of money! Yea everything is ready, the setup security and run of the servers all for you already but that comes at a price. Of course, this depends on how much it gets used and how big the project is, in some cases it could be free.

You are trusting the API owner with information you may not want to expose. Since they have the databases, technically they hold all your information and the information of your users. For projects that need to be kept 100% secret, it is always better to run it on your own servers.

Custom API

Pros

The biggest advantage of a custom API is the ability to make it however you want and remains one of the main reasons for making it manually. It allows you to receive and manipulate or store data however you want and that alone can be a huge thing. You can also make custom responses and error messages. This combined with frontend skills can make something magical and really efficient.

As mentioned above, you can host this on your own server which has many advantages. Security is one since only you can know where the server is located and how it works. Another thing is cost, you can run it on your own server for the cost of electricity or you can get whatever server hosting plan you want which usually ends up being cheaper, in many cases that I have encountered. Lastly running it yourself means you can shut it down and wipe everything whenever you feel like it, or protect against such things.

Cons

You need to make it. This is what pushes people away and understandably so. It is intimidating at first, as every new thing tends to be. It is a really strong tool, which is also why it is complicated at times. You need to study new coding languages, concepts, syntax, logic, etc.

Security and bugs are issues you need to deal with yourself, or you need to hire someone to do it. This is also part of the whole convenience that the ready APIs offer and can be scary to many, however, there are many tools to help against these issues.

No one knows your API and no one will have any previously entered information or accounts. This means starting fresh and making every user manually input the necessary information.

What I am Doing

Now that you have a good idea of what the two are and when each one should be used, why am I using both?

I will be using a custom API for my scoreboard as I do not want to pay for something I can very easily make myself. I also need a very specific type of scoreboard that will interact with the user's information to show whose score is linked to each user. Additionally, I will be constantly updating this and need to make sure I have full control and nothing limiting me from accomplishing the goals and features I am aiming for.

On the contrary, I need a simple but effective login system that is secure and also is something that people are already familiar with so that they won't have to make a new account, instead they can log in with an existing one. Since I do not need any customization and I do not want to deal with security, the ready API option is a really good choice here.

How to Start

There are many technologies and methods you can use and it really depends on what exactly you're trying to get out of it.

My recommendation is to make a custom Rails API as it uses Ruby which is a really easy language to learn and use, especially with the rise of Python, it will be an easy transition for most people.

I will also highly recommend learning SQL as it is very useful to understand how databases work and how you could make a powerful one of your own. Many resources exist for learning and maintaining a backend, which is also why I highly encourage people to just give it a try or at the very least understand how everything works.

Conclusion

The main takeaway of this blog is that there is a place for both options and in many cases, a combination of both is the best method. I consistently use both types of APIs and I always find new reasons to use them. It should be a given by now that you should be prepared to use either of the two or both which is why I say learn both! Happy coding!

--

--