DEV Community

Yunhan
Yunhan

Posted on • Originally published at babynamepick.com

Building a Baby Name Search That Handles Starting Letters Well

When parents know they want a name starting with a specific letter, they need a fast way to browse. Here's how we built letter-based search for BabyNamePick.

Why Letter-Based Browsing Matters

A surprising number of parents start their name search with a letter. Maybe they want siblings with matching initials, or they have a family tradition of J-names. Our analytics showed names starting with J are the most searched letter category.

The Implementation

Rather than a simple alphabetical filter, we built a system that considers:

1. Cultural Distribution

Not every letter is equally represented across cultures. J-names are abundant in English and Spanish but rare in Chinese or Thai. Our filter shows the cultural breakdown so parents understand what they're browsing.

// Group names by origin for each letter
const letterGroups = names
  .filter(n => n.name.startsWith(letter))
  .reduce((acc, name) => {
    acc[name.origin] = (acc[name.origin] || []).concat(name);
    return acc;
  }, {});
Enter fullscreen mode Exit fullscreen mode

2. Gender Balance

Some letters skew heavily toward one gender. We show the gender split upfront so parents can quickly assess if the letter works for their needs.

3. Meaning Clusters

Within each letter, we group names by meaning themes. Parents browsing J-names might discover that many J-names across cultures share meanings related to grace, God's gift, or youth.

Performance Considerations

With 2,000+ names, client-side filtering is fast enough. We pre-sort the data at build time using Next.js static generation:

export async function generateStaticParams() {
  return letters.map(letter => ({ letter }));
}
Enter fullscreen mode Exit fullscreen mode

This gives us instant page loads for every letter while keeping the bundle small.

What Surprised Us

The most popular starting letters aren't what you'd expect:

  1. J — James, Julia, Jasmine, Juan
  2. A — Alexander, Amelia, Aria
  3. S — Sofia, Sebastian, Sakura
  4. M — Maya, Muhammad, Mateo

Letters like Q, X, and U have fewer names but higher engagement per page — parents browsing rare letters are more intentional.


BabyNamePick — free AI baby name generator with 2,000+ names from 46 cultures.

Top comments (0)