DEV Community

I built a popular open source API project, Ask Me Anything!

Paul Hallett on February 19, 2020

I recently blogged about how I built PokeAPI, a very popular open source API. A lot of new developers often encounter this early on in their career...
Collapse
 
bashunaimiroy profile image
Bashu Naimi-Roy

What is something you wish more people knew about the interaction between mental health challenges and creating/maintaining a project like this?

Collapse
 
phalt profile image
Paul Hallett

Well, I think that if I had been more experienced with my mental health, then I would have noticed my manic obsessive tendency to build the original project and I might have stopped myself, thus never having actually built PokeAPI. So it's a bit of a double edged sword - I created PokeAPI in part to avoid the issues with my deteriorating mental health.

I would say this: mental health affects people in a lot of different ways, and it's hard to deal with it. It takes a lot of time to reach some plateau of normalcy, let alone being properly happy. If working on a project for days and days gives you focus and happiness, then do it, but don't let it consume you. Don't ignore the pain you're feeling.

Collapse
 
adbrsln profile image
Muhammad Adib Ahmad Roslan

just read the article. it was inspiring. may i know the PokeAPI current servers specifications that manages to handles those 25 milions requests permonth ?

Collapse
 
phalt profile image
Paul Hallett

It's all cached data on firebase. We cache the results for 24 hours, and the API is hit enough that a large majority of the requests are just returning the cached result!

Collapse
 
xieweizhi profile image
Weizhi Xie

Is it expensive for this amount of requests using Firebase?

Thread Thread
 
phalt profile image
Paul Hallett

We cache all the api results, as they never change we can do that. So we only pay for functions that run - i.e. - the first time a function runs to return data, after that it is a cached result. So around $10USD a month.

Collapse
 
ayyappa99 profile image
Ayyappa

I was totally amazed to see the volume its handling currently! Great work!
I would like to know what measures you usually take to stop abuse or any sort of DDoS attacks as the API seems to be public.

Collapse
 
phalt profile image
Paul Hallett

Cloudflare provides a free tier that blocks a tonne of malicious traffic for us. I guess there is not much to exploit so we're quite lucky when it comes to DDOSing, it's almost always innocent young developers accidentally spamming the server.

Collapse
 
ayyappa99 profile image
Ayyappa

Thanks for the details. Do you have any recommendations on protecting a public api from DDoS attacks? I haven't found a direct way with Cloud Flare to protect a REST API, where as I see they have good details for protecting a website though.

Thread Thread
 
phalt profile image
Paul Hallett

Set your DNS up with Cloudflare, it'll deal with 90% of issues. You can also set up rate limiting in your project. We used to do rate limiting by IP address.

Collapse
 
xngwng profile image
Xing Wang

Fascinating. Who are biggest users of this Pokemon APIs? What are some of the applications that they build on top of it? Which application do you like most?

Collapse
 
phalt profile image
Paul Hallett

I believe nearly all of the users are students, at least the largest majority. Quite a few simple services like pokedex.org runs off the API too.

Collapse
 
pre6_ profile image
Pratik • Edited

How to create Apk of python code

Collapse
 
phalt profile image
Paul Hallett

What you're probably after is how to package a python program, this is a good guide: packaging.python.org/