Good evening and welcome to another "Phildini Livetoots a talk already given"

Tonight: @carlton's #DjangoConUS2024 talk: "API Maybe: Bootstrapping a Web Application circa 2024"

https://djangotv.com/videos/djangocon-us/2024/api-maybe-bootstrapping-a-web-application-circa-2024-with-carlton-gibson/

#SlowpokeLiveToot

API Maybe: Bootstrapping a Web Application circa 2024 with Carlton Gibson

The last couple of years seem to have changed everything. Particularly with HTMX, but also related technologies like Alpine.js and Tailwind CSS, we've rapidly gone from a world where seemingly the only option was "API First". This is the story of bootstrapping a new application in these latter days. On …

DjangoTV.com

As an aside: we're very lucky to have @carlton in the #Django community. The combination of being extremely technically capable and a good speaker is so rare.

#SlowpokeLiveToot

In the 2018 world, things were very API First, maybe API only.

Strong separation between FE and BE.

In 2024, we're back to HTML over the wire, with HTMX, Turbo, Unpoly, etc

But also: we're now outside of ZIRP phenomenons (I can't wait to see how Carlton is linking these)

The thesis: If you lean hard into Django, you can produce excellent results without spending double on engineering.

#Django is the perfect framework for the post-ZIRP world.

#DjangoCon

The current generation of fast-site tools (HTMX, Tailwind, alpine.js) encourages good Locality of Behavior for your code.

Good Locality of Behavior helps you go faster.

BUT!

This is a starting point, not a destination.

#DjangoConUS2024

The more you can hold the Locality of Behavior against aggressive DRY, the faster you can move (somewhat counterintuitively)

This isn't to say: don't DRY your code often. It's saying DRY can be premature optimization.

#Django has a _grain_ a way that it wants you to work to make things as smooth as possible.

One library from @carlton that works with Django's grain is Neapolitan.

It's a quick way to get a working CRUD for any model.

It provides the views and the hooks and the templates you need to get started and customize.

After with-the-grain CRUD views, look closer at the Django Template system.

There's so much forward motion on components in templates, and a blooming of libraries to help you write them.

And the glue here is HTMX and template partials

django-template-partials makes this even easier by not making you create full templates for every snippet you want to return. you can define partials in a full template.

All of this together lets you stay in one template file and one view file for longer.

This is Locality of Behavior and lets you move faster!

#DjangoCon

When you take all of this with alpine.js and #Django forms, you save yourself ever having to serialize back and forth in JSON. It's just formdata in both directions

What does the future hold?

We need to think more about async and collaborative editing, especially in the #Django admin.

Performance and latency is getting more critical every year, especially if you're hosted in one AZ / DC. Maybe Template Caching and Edge Compute solves some of these problems?

Integrations! We need to move past thinking of just REST, and think about BI use cases that are read and filter heavy.

And that's the talk! It was great to see @carlton preaching the way I've wanted to build web apps for years. Basically everything I've built at @galaxybrain and @civicband is JS light and we move _fast_.

The biggest project for us right now is #CivicBand, and a new #Django-powered app for search alerts is coming _very_ soon.

If you want to support me doing more threads like these, or support the development of #CivicBand's Django apps -> https://opencollective.com/civicband

#SlowpokeLiveToot

CivicBand - Open Collective

Opening up local government data for everyone.