NewAPIVerve Academy: free courses and certifications anyone can verify.Explore the Academy →

Password Generator Template

  • Next.js
  • TypeScript

Generate strong passwords and passphrases, then check how strong any password is before you use it.

A Next.js app that makes strong passwords. Choose random passwords or readable passphrases, set the length and character sets, and get five at a time with one-click copy. A strength check scores any password and shows what it has and what it lacks. Use it as a standalone tool, or lift the route to suggest passwords on your own sign-up form.

The password generator app running

What it does

Passwords or passphrases
Random passwords from 8 to 64 characters, or passphrases of 3 to 8 capitalized words you can actually remember.
Your character rules
Toggle uppercase, numbers and symbols, and leave out look-alikes such as l, 1 and O, 0.
Strength check
Scores any password on a five-step meter with a checklist of length, character mix, runs and repeats.
Never caches a password
Generated passwords are never cached, and strength answers are cached under a SHA-256 hash rather than the password.
Keeps your key private
The browser only talks to your own API route, which holds the key and limits each visitor to 10 requests a minute.

How it works

The strength check: cached by hash, then guarded, then one call to Password Strength.

app/api/password/route.ts
if (mode === 'check') {
  const password = str(params.get('password'), 128);
  if (!password) return fail('Enter a password to check');

  const key = `check:${createHash('sha256').update(password).digest('hex')}`;
  const hit = fromCache(key, TTL_MS);
  if (hit) return Response.json(hit);

  const blocked = guard(request);
  if (blocked) return blocked;

  return respond(async () => {
    const data = await callApi('passwordstrength', { query: { password } });
    toCache(key, data);
    return data;
  });
}

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 Password Generator API — the call this template makes

Request
GETapi.apiverve.com/v1/passwordgenerator?count=10&length=30&complexity=strong
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": {
    "passwords": [
      {
        "password": "aOwqDh0ZK*P;!M|%oiFYJ!IK%TMXQO",
        "length": 30,
        "metadata": {
          "type": "random",
          "complexity": "strong"
        },
        "analysis": null
      },
      {
        "password": "Wo:)*V2nMakoVI78[fKu|QDI.E45p|",
        "length": 30,
        "metadata": {
          "type": "random",
          "complexity": "strong"
        },
        "analysis": null
      },
      {
        "password": "%XqlsK2qN.9>*&jk6gYIG.[aE,hiRc",
        "length": 30,
        "metadata": {
          "type": "random",
          "complexity": "strong"
        },
        "analysis": null
      },
      {
        "password": "WQNY0{R~(G99uc&i62Mve).n<|xt=F",
        "length": 30,
        "metadata": {
          "type": "random",
          "complexity": "strong"
        },
        "analysis": null
      },
      {
        "password": "2$m-&z9!5$c3QlxQP{h#@0x~'M/h]T",
        "length": 30,
        "metadata": {
          "type": "random",
          "complexity": "strong"
        },
        "analysis": null
      },
      {
        "password": "y]e_H)/z2yzbr{4C&hHOb[Q:#/$Hml",
        "length": 30,
        "metadata": {
          "type": "random",
          "complexity": "strong"
        },
        "analysis": null
      },
      {
        "password": "+iZ,<<+_MR:jJ,JbXTN*3Z,xLo'=@E",
        "length": 30,
        "metadata": {
          "type": "random",
          "complexity": "strong"
        },
        "analysis": null
      },
      {
        "password": "x=e6H^U;ajD+)h5Z8$7Wy)^Ob8ERw'",
        "length": 30,
        "metadata": {
          "type": "random",
          "complexity": "strong"
        },
        "analysis": null
      },
      {
        "password": "+p!SGSnR*JNl}/[#oVQy~ZxtoZU}F+",
        "length": 30,
        "metadata": {
          "type": "random",
          "complexity": "strong"
        },
        "analysis": null
      },
      {
        "password": "%h:23-bMb0;?QWL)chKm8{>%)mN:EO",
        "length": 30,
        "metadata": {
          "type": "random",
          "complexity": "strong"
        },
        "analysis": null
      }
    ],
    "count": 10
  }
}

Build your own with Password Generator. 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