Last Updated: February 25, 2016
·
424
· alexanderg

Domainhacks

Coming up with good domain names is hard. This Node.JS script takes the hassle out of finding them by using the built in dictionary, which is available on every mac by default. Simply define the top level domains you want the script to consider (e.g. co for every .co, io for every .io domain etc.), save it and run it using node domainhacks.js.

var fs = require('fs');

var words = fs.readFileSync('/usr/share/dict/words', {
    encoding: 'utf8'
}).split('\n');

var tlds = ['co', 'com', 'io', 'de', 'it'];

var results = [];

for (var i = 0; i < words.length; i++) {
    var wordArray = words[i].split('');
    for (var j = 0; j < tlds.length; j++) {
        var tld = tlds[j];
        var lastLetters = wordArray.slice(-tld.length).join('');
        if (lastLetters === tld) {
            wordArray.splice(-tld.length, 0, '.');
            results.push(wordArray.join(''));
        }
    }
}

console.log(results);

This script is also available as a GitHub Gist. One liner for the command line: curl "https://gist.githubusercontent.com/alexanderGugel/9e9067231cb4abbb130e/raw/df0f576e2c8822f898cb6e4d0f6289563c0e7169/domainhacks.js" > domainhacks.js && node domainhacks.js

What you can expect to get as output:
... 'tro.co', 'tro.de', 'trypanoci.de', 'trypanosomaci.de', 'Tryparsami.de', 'tuberculi.de', 'tuch.it', 'Tunn.it', 'turb.it', 'Tur.co', 'tur.co', 'tur.io', 'turm.it', 'turnsp.it', 'turpitu.de', 'turs.io', 'twaybla.de', 'twelfhyn.de', 'Twelfthti.de', 'twelvehyn.de', 'twil.it', 'tw.it', 'twybla.de', 'twyhyn.de', 'tyrannici.de', 'ubiqu.it', 'ullu.co', 'unacqu.it', 'unaptitu.de', 'unassuetu.de', 'unba.it', 'unbarrica.de', 'unbef.it', 'unbeti.de', 'unb.it', 'unbla.de', 'uncertitu.de', 'un.co', 'uncounterfe.it', 'uncru.de', 'un.de', 'undeci.de', 'undelu.de', 'underb.it', ...