domain name generation domaingistry

Building A Domain Name Generation Web Application and CLI

One of the most difficult things to do is getting names for your website or even your business. You may not think this is an issue until you try searching for a name and the domain name is already taken  whaaat!! Yeah you will have to try and try several options before you can  arrive at one you may like.

So what if we can build a simple app that can automatically generate domain names for us. Let us start with building a line of domain name generation apps. And as I always do we will build one app idea in three or more ways.

We will build

  • a web application
  • a command line application(CLI)
  • a GUI.
  • a package

Let us begin.

The Problem: Difficulty getting domain name for our site and business

Our Aim and Solution: To build a domain name generation application.

Our Plan:

  • Get a list of all domain name extensions i.e. [.com,org,edu,ai,io]
  • Build a system to generate the names with these extensions
  • Save our results
  • Name our line of apps with a unique name that has not been used.
  • Publish and watch

The Name of Our Apps: DomainGistry

Don’t worry this name has not been taken yet

Building The Domain Name Generation Web Apps with Flask and Python

Our web app (DomainGistry Web App) will have a front end built with bootstrap and our back-end built with flask.

Flask is a powerful python micro-framework useful for building web applications with simplicity. Hence we will be using flask for our back-end. You can download flask on your system with

pip install flask

The  simple code for the backend is as follows

from flask import Flask,render_template,request

# Initialize App
app = Flask(__name__)

# List of Domain Extensions
new_domain=[]
extra_domain=[]
common_domain=[]
prefix_domain=[]
suffix_domain=[]


@app.route('/')
def index():
return render_template('index.html')

@app.route('/generate',methods=['POST','GET'])
def generate():
if request.method == 'POST':
old_text = request.form['raw_text']
raw_text = "".join(old_text.lower().split(" "))
shuffled_text = shufflize(old_text.lower())
word_tokens = len(old_text.split(" "))
char_len = len(raw_text)
word_stats = 'Tokens:{},\nCharacters:{}'.format(word_tokens,char_len)
cust_list_new = ['{}.{}'.format(raw_text,i) for i in new_domain ]
cust_list_common = ['{}.{}'.format(raw_text,i) for i in common_domain ]
cust_list_extra = ['{}.{}'.format(raw_text,i) for i in extra_domain ]
cust_list_prefix = ['{}{}.com'.format(i,raw_text) for i in prefix_domain ]
cust_list_suffix = ['{}{}'.format(raw_text,i) for i in suffix_domain ]
cust_list_shuffled = ['{}.{}'.format(shuffled_text,i) for i in common_domain ]

return render_template('index.html',raw_text=raw_text,old_text=old_text,
cust_list_new = cust_list_new,
cust_list_suffix=cust_list_suffix,
cust_list_prefix=cust_list_prefix,
cust_list_extra=cust_list_extra,
cust_list_common=cust_list_common,
cust_list_shuffled=cust_list_shuffled,
word_stats=word_stats)


if __name__ == '__main__':
app.run(debug=True)

The most important aspect of our app involves how to generate the names and we solved this by

  • Iterating through our list of domain extensions using a python for loop
  • Concatenating it to a our term in a string format.(You can use f-string or string format if you want)
  • Using a list comprehension to store our results
  • Exporting our list to our front end.

For the Front-End we used bootstrap and created a simple form to receive our term or name  as shown in this code.

So we have built a simple domain name generation web application called DomainGistry Web App.

The entire code can be found here

You can get the full video tutorial on the YouTube – JCharisTech.

 

Let us move on to the next part of building a CLI of the same idea with JavaScript.

Building A Domain Name Generation CLI [DomainGistry] with Commander.js and Node.js

Unlike our previous app, this is going to be built with JavaScript, [we will build one with CLICK in python for python lovers].

So what we need is

  • Node.js
  • Commander.js
  • Chalk.js

Commander.js is a simple to use CLI package that allows us to create command line applications. Of course there are several packages we can use for this same idea, such as caporal.js,vorpal.js gluegun,etc., but we will use commander for now.

You can check out the full video tutorial here.

To get our DomainGistry – Domain Name Generation CLI on your system, you can install it using NPM as follows

npm install domaingistry

Feel free to try it out.

Thanks for reading and stay tune for more line of apps. If you need help working with this app you can contact me according.

pip install domaingistry

By Jesse E.Agbe(JCharis)

Jesus Saves@JCharisTech

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *