Building My Own API-Based Name Server

I recently built my own API-based name server and let me tell you, it was a ride. I thought it would just be a matter of spinning up a server, writing some code, and pointing domains to it. But as always, the internet has a way of teaching you lessons in the hardest possible way.

When I first started, I went with Namecheap for my domain. I knew I needed to set up custom name servers, so I pointed my domain to my VPS. Everything looked fine at first until I realized nothing was resolving. Hours of debugging later, I stumbled across the concept of glue records.

Glue records are one of those things you don’t even know exist until you’re stuck banging your head against the wall. Basically, when you want to run your own name servers on the same domain you’re hosting, the registrar needs to know the IP addresses of those name servers directly. Otherwise, the whole system ends up chasing its own tail. On Namecheap, that meant manually creating glue records for ns1 and ns2 with their corresponding IPs. Once I did that, everything magically started working.

With DNS working, I moved on to building the API side of things. I decided to use PHP and MySQL because they’re reliable and fast to set up. My API handles the usual domain records (A, CNAME, MX, etc.) and stores everything in a database. The name server itself queries MySQL and responds in real time, so everything stays flexible and dynamic.

The last piece of the puzzle was turning this into something people could pay for. I integrated Stripe for monthly subscriptions, which was surprisingly straightforward. Stripe’s PHP library made it easy to hook into the billing side, manage subscriptions, and lock down accounts that don’t pay. Now the service feels like a real product rather than just another side project.

What started as a small experiment turned into a full DNS service with API control and built-in billing. The biggest takeaway for me was how important those little registrar details like glue records are. Without setting that up, none of this would have worked.

I learned DNS the hard way, but now I have my own API-based name server running in production and customers can actually sign up and use it. And honestly, that feels pretty amazing.

https://endpointdns.com - Give it a try for FREE, with premium accounts for just $5/mo!