Username checker template

  • Node.js
  • Express

Block offensive usernames at signup, including profanity hidden inside a longer name.

A Node.js and Express app that checks a username for profanity before someone can claim it. Type a username and it tells you whether it’s clean or offensive, even when the word is buried in a longer name with numbers or underscores. Try names by hand, or call the route from your signup form.

The username checker app running

What it does

Finds hidden profanity
Catches offensive words inside longer usernames, like a slur followed by numbers.
One yes-or-no answer
Returns a simple flag, so your signup form can accept the name or ask for another.
Keeps your key private
The page calls your own server, which holds the key and limits each visitor to 10 checks a minute.

How it works

The route that checks a username.

server.js
// GET /api/check?username=
app.get('/api/check', async (req, res) => {
  const username = str(req.query.username, 64);
  if (!username) return res.status(400).json({ error: 'Enter a username.' });

  try {
    const data = await callApi('usernameprofanity', { query: { username } });
    res.json({ success: true, username: data.username, isProfane: data.isProfane });
  } catch (err) {
    res.status(err.status || 502).json({ error: err.message });
  }
});

See the whole file on GitHub

Deploy it

  1. Get a free API key

    The free plan includes 200 credits a month, no card needed. Create your key.

  2. Deploy it

    Click Deploy to Vercel. Vercel copies the repo to your GitHub account and asks for APIVERVE_API_KEY: paste your key there.

  3. Open your app

    Vercel builds it and gives you a live URL, usually in about a minute. Every push to the repo redeploys it.

Try the Username Profanity API — the call this template makes

Request
GETapi.apiverve.com/v1/usernameprofanity?username=b00bs
Query parameters
Verification
Format

No key required to try it. Get a key to use it in your app.

Example
{
  "status": "ok",
  "error": null,
  "data": {
    "username": "b00bs",
    "isProfane": true
  }
}

Build your own with Username Profanity. Start with 200 free credits. One key unlocks all 300+ APIs.

Explore the catalog

300+ APIs on the same key and the same response shape.

Browse all APIs