Components for building an interactive webapp.

In this post I'll discuss the ingredients necessary for building a simple and interactive webapp. Note that the current article is not a comprehensive tutorial for building a webapp, rather it presents a discussion to help choose a light-weight and reusable tech stack.

Before getting into choosing the tech stack and frameworks for the app, we'll need an overview of the architecture of the app. The most fundamental elements of any webapp are the backend, frontend and the interface. The backend is where we store our data and/or do some analysis. More often than not the backend is not accesible to the users (for example when the data is really valuable for us or when the analysis is a secret recipe). The frontend is where we present the results of our analysis in a meaningful way to the user. In an interactive webapp the user is provided with the capability to retreive a new set of results by changing some options provided to them (like a dropdown menu or a search bar we find in many websites). Finally, the interface part acts as a medium of communication between the frontend and the backend. Refer to this article for more details on understanding architectures employed to build user interfaces.

The current app uses MySQL, Python and Pandas as the backend. The frontend is composed of bootstrap, jquery and d3.js. Flask is the webframework (interface) used. The complete code for the app is hosted on my github account.

The tech stack

Process outline

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Test bootstrap template</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap core CSS -->
    <link href="static/bootstrap/css/bootstrap.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="static/bootstrap/css/starter-template.css" rel="stylesheet">
    <script src="static/jquery-1.10.2.min.js"></script>
    <script src="http://code.jquery.com/jquery.min.js"></script>
    <script src="static/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
  <div class="container">
    <div class="starter-template">
      <h1>Tester App</h1>
      <p class="lead">Base template</p>
    </div>
  </div>
</body>
</html>
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
@app.route("/")
def starter():
    return render_template('index.html')

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