Skip to main content

Simplifed Protocols

Design idea I 🧠

I proposed two major changes to turn the website into a single-page app (SPA): (i) on the frontend, convert all the prior Django HTML templates into web components and (ii) on the backend, replace python code to change it from returning HTML elements to returning JSON data upon API requests from the SPA. This proposed idea can make the codebase much cleaner.

Before my work​

BeforeRefactor

As shown in the figure above, the previous frontend relies on Django HTML templates to render the pages, which requires requests to the backend handlers for template data or even Django form elements. Although some Lit elements have been introduced to the app, they are used as parts of Django templates, leading to a complicated code structure.

After my work​

AfterRefactor

As shown in the following figure, the new design produces a more intuitive and cleaner component diagram. This makes future development and maintenance easier.