In today’s era, data privacy is a critical concern that can have severe repercussions for companies if not handled properly. Furthermore, a lot of large multinational company are using our data accumulated from search engines for advertising purposes, raising the question about what can we do to protect our online privacy and browsing experience? Inspired by Network Chuck and Tim Berners-Lee’s influential book, “Weaving the Web”, I decided to build my own privacy-focuesed browser using PyQt5 and deploy a secure search engine in the cloud.

Introduction

With this idea in mind, I start to diverge my research on the problem statement by collecting feasible soluntions from Google, Youtube and ChatGPT. Ultimately, I made the decision to deploy the privacy-focused search engine, SearXNG on Google Cloud, connecting it to my domain, search.woonyee.net, then build a local web browser using PyQt5 with Home Page as search.woonyee.net. The ultimate goal is to package the browser into an executable (.exe) application.

Deploying SearXNG into Google Cloud

Opting for Google Cloud was driven by my curiosity to explore alternatives to the often complex EC2 configurations of AWS. So in Google Cloud, I configured a VM instance with Ubuntu 20.04 as my operating system, a choice I was familiar with from previous experiences. After VM is deployed, I realised that they have SSH-in-browser…. Which is a pleasant surprise because I don’t think EC2 has that. (But later I have been told AWS Lightsail has this feature as well, so I guess I’m just not up-to-date :’) Anyways, I used the SSH-in-browser, git clone SearXNG-docker repository into /usr/local directory. Not to forget, do remember to sudo update and upgrade your operating system before starting your project. Then install docker :D I followed the installation steps detailed in https://github.com/searxng/searxng-docker under How to use it. Edited the .env file, generated secret key and docker-compose up. Good thing about SearXNG is they don’t generate a user profiles about us when we search something. SearXNG will remove private data from requests going to search services and result page. It will not send any cookies to external search engines. Each time we search on SearXNG, it will create a random browser profile for every request. There are several types of search engines we can choose from the list as well, all we need to do is just edit the settings.yml based on the documentation! Lastly, I configured a static external IP address on Google Cloud and set up the necessary Cloud DNS Rules and Zones.

Tadaaaaa! 1

PyQt5 for the Local Browser

Having successfully set up the search engine, my focus shifted towards developing a locally built private browser that would minimize unnecessary data collection. PyQt5 is something I found online when I am searching for ways to build my own browser. It is a set of Python bindings for cross-platform C++ libraries that provide high-level APIs for modern desktop and mobile systems. So there are publicly available functions that I can use to bring my own browser to life. To establish the foundation of my browser, I turned to functions like QMainWindow, QToolBar, QAction, and QApplication. These essential components allowed me to shape the browser’s user interface, refine its layout, and add interactive elements to enhance user navigation and browsing experience.

The completed appearance is as follows:

2

Package the PyQt5 into .exe

To make the PyQt5-based browser more accessible to user, I tried to find packager that is compatible with PyQt5 and that’s when I stumbled upon PyInstaller. So I pip install PyInstaller, then run this in another python file:

import PyInstaller.__main__

PyInstaller.__main__.run([
    'index.py',
    '--onefile',
    '-w'
])

After around 1 minute, my .exe is in the dist folder! It looks exactly the same as the previous picture, except for the fact that I can just click the .exe to run it instead of running the Python script every time I want to use it.

Conclusion

In conclusion, the journey of building this has been rewarding. I had the chance to explore new tech products, fuse them together, and tailor them to my needs. It was a fun experience to delve into the project, get my hands dirty, and accomplish something meaningful. Until next time, happy browsing :D