2
0 Comments

I'm compiling Django templates to SPA like UI for a better experience

I'm proposing a way a single developer can make use of Django simplicity and ship faster. Same goal as HotWire but an easier way and more Django friendly.

My approach is to use already existing resources from the Javascript ecosystem and refactor how Jinja templating is done. This way, the developer doesn't have to change the existing code much but it simply compiles your template into Javascript. Then we use Javascript Dom events and store manager (Redux) to maintain states.

Generally, you get to write Django code as usual but the result template is rendered as javascript, and that way we can make it reactive such as in React and VueJS.

Summary: Django reactive proposes compiling templates to javascript objects for easy data states management and rendering using the same principles used in SPA frameworks.

This project is at a very early stage and not usable yet but worth following it at https://github.com/felixcheruiyot/django-reactive

Here is a demo video link: https://youtu.be/wBQjXse6b7M

Note we have four templates rendered using Django views. Adding a new item to todo updates the other two views on the same page.

With Django reactive, the way you write your Django will not change. The way Jinja is compiled changes. The flow is Template > Data > Javascript Objects > Reactivity.

Your feedback is highly appreciated.

posted to Icon for group Developers
Developers
on January 19, 2021
Trending on Indie Hackers
How to rank #1 on ChatGPT? User Avatar 111 comments I Tested Agenmatic for Finding Customers in Communities — Here’s What I Learned User Avatar 63 comments I built a startup-idea scanner. It just told me none of my 3,400 ideas are easy wins. User Avatar 51 comments A chat assistant that runs your server so you don't have to live in the terminal User Avatar 43 comments Building a Shopify bundles app for stores with real fulfillment: here's the wedge User Avatar 42 comments I recorded myself using 200+ indie SaaS products cold. Here are the 7 conversion killers that keep showing up. User Avatar 29 comments