Blog

How I built a name generator with domain check

A business name you love is worth very little if the .com belongs to someone else. So when I built Namesake, a free name generator with domain check built in, the check had to sit right next to each name. You describe your business in a sentence, you get forty names with a reason each one fits, and every name shows whether its .com, .ai, .io and .co are registered. The rule behind that check is the part I care about most: it reports what the registry said, or it says it couldn't check. It never guesses.

Why a guess is worse than no answer

Picture it. You find a name you like, the row says the .com is open, and you start sketching a logo. Then you go to buy the domain and it's gone. That's worse than having no check at all, because the check talked you into it.

Namesake has four answers for a domain, and only four: checking, taken, not registered yet, and couldn't check. A status on screen is only ever what my server got back from a registry. A timeout, a rate limit, a registry having a bad minute: all of those show as "couldn't check," with a "Check again" button under the list.

I also chose the words with care. Namesake says "not registered yet" instead of "available," because the registry knows whether someone holds the name today. It doesn't know what a registrar will charge you or whether someone grabs it tonight.

How the domain check works

There are two ways to ask a registry about a domain.

The modern one is RDAP, a lookup protocol most registries run over plain HTTPS. IANA, the group that keeps the list of domain endings, publishes a file saying which RDAP server answers for each ending. My server fetches that file once and keeps it. After that, checking a .com means asking the right registry for that domain and reading the status code. A 404 means nobody has registered it. A 200 means it's taken. Anything else means "couldn't check."

The older one is WHOIS, and .io and .co still only answer that way. WHOIS is a plain text conversation on port 43: you open a connection, send the domain, and read back whatever the registry prints. Namesake asks the registries' own servers directly. If the reply has a "Domain Name:" line, the name is taken. If it says something like "not found" or "no match," it's open. Any other reply is "couldn't check." I also stop reading past 64 KB, since a normal answer is a few KB and anything bigger isn't a normal answer.

Keeping the registries happy

A name generator hands out forty names a round. If every visitor fired four lookups for each of those, the registries would start saying no, and my honest "couldn't check" would show up all day. Most of the work went into asking less.

  • The list asks for .com only. Each row in the list shows the .com first. When you open a name, the detail panel asks for all four.
  • Repeat questions share one answer. If two people check the same name at the same moment, the server sends one request and both get the result.
  • Answers are kept for ten minutes. The server keeps recent results in memory, and the Vercel cache serves repeats too. A "couldn't check" is never cached, because it's worth trying again.
  • Each registry gets a short line. At most four lookups per registry run at once, each with a 3.5 second limit. If 24 are already waiting, the next one gets "couldn't check" right away instead of making you sit behind someone else's long list.
  • Only Namesake's own pages can ask. The domain endpoint turns away requests from other sites, so another page can't use my server to run its own lookups.

What leaves your browser

When Namesake checks a domain, the only thing sent is the domain itself, like example.com. It goes to IANA's list and to the registry for that ending. Your description and your IP address stay out of it. Namesake sets no cookies, and the names you save stay in your browser.

This came out of the same habit behind my cookieless analytics: send the least that does the job, then write down exactly what that is on the privacy page.

What I'd tell anyone building a domain check

If you're adding a domain check to your own tool, three things saved me the most grief.

  • Treat "unknown" as a real answer. Give it its own label and its own retry button. Folding it into "available" is the bug that costs your users money.
  • Cache the settled answers and skip the rest. Taken and open don't change minute to minute. Errors do.
  • Read the registry's list instead of hard-coding servers. IANA's file tells you where to ask, and it stays current without you.

The whole check is two short files in Namesake's repo, one for RDAP and one for WHOIS, plus a list of four endings. Namesake runs as its own app under beaconfrontier.com, the way I described in how I run multiple Next.js apps on one domain.

Try it on your own idea

Open Namesake, describe your business in one sentence, and pick a name from the forty. The domain check runs on its own, and you'll see what each registry said before you fall too hard for a name.