Backend autocomplete algorithm using Flask + Trie Nodes 🔍
The code in this repository contains a global state server, and a client CLI to access the server.
The server uses a trie object (a tree of linked character nodes) to store keywords in a set.
The client CLI uses HTTP GET requests to send commands to the server and retrieve information from the server.
The application is hosted through PythonAnywhere, but requirements/procfiles are included in the source for easy deployment to AWS, GCP, Azure, Heroku, etc.
Server: Flask Client: none Additionally, procfile and deployment requirements can be found here.
Some Final Thoughts
Prior to starting this project, my only knowledge of backend development consisted of a few YouTube videos that I had watched on Flask. I did not know how to deploy a web application, let alone devise a system to fulfill client requests comprehensively. In addition, the recursive structure of linked character nodes was not easy for me to visualize. I found myself stepping through testcases on a whiteboard more than actually coding. In retrospect (given more time), I would have written this in Nodejs because of its efficiency with real-time applications. But at the end of the day, Flask was still a very solid choice for the backend.
Here are some of the most notable things I learned:
- How HTTP GET and POST requests work
- Deploying web applications using Git repositories
- Code working locally ≠ the behavior of the same code when deployed
- To my surprise, Python is an extremely viable tool for object oriented tasks