case when

A responsive web app in 150 lines of Python

At the time of this writing, there's quite a bit of volatility in both markets and tech.

I feel it's unwarranted.

It's a rare event when technology comes together to enable things that were never before possible. We're currently experiencing such an event.

If I were to show you this app, you'd probably think, "OK, some webdev spent a morning and wrote himself a guestbook. Whoop de doo. It's not even that good."

The interesting things:

  1. I'm not a webdev (and I don't really know CSS),
  2. I wrote the app in 150 lines of Python,
  3. It only took a few hours.

Building with AI

That might seem trivial: "OK, a devrel can do his job... round of applause," but imagine that same productivity lift applied to every engineer on the planet. Applied to every entrepreneur / indie builder. Applied to every semi-technical founder who could never quite code, but now has the resources.

I think the next few years will be very interesting.

So how did I do it?

Using Jeremy Howard's new framework, FastHTML, Claude, and Replit.

Disclaimer: I work in developer relations at Replit.

By adding the FastHTML docs to Claude, I was able to create a project that:

  1. Eliminated cold-start for a new framework,
  2. Allowed me to iterate on layout / CSS rapidly,
  3. Let me focus on the tech and functionality instead of the boring stuff.

The iteration process was simple: prompt Claude, evaluate the response, make sure it worked, prompt Claude again with revisions. Once I got to a place where Claude wasn't helpful, I dug in and made tweaks using what I'd learned through prompting.

This brings me to a larger point on AI-assisted coding: you can absolutely learn to code with AI, it just looks different from reading a textbook or following a tutorial. It's more hands-on, interactive, and exciting.

Learning with AI is more like discovering a map in Fog of War (thanks DH for the inspo) than being hand-held through information you don't really need to learn.

The app

The app itself is straightforward: there's a form that accepts user inputs. Records are written to a key-value database (one-line import in Replit), enabling persistent data.

With HTMX, I can update the results on submit using routes defined in my main.py file. FastHTML makes the whole thing straightforward if you're used to looking at Python, but also intuitive if you're not. The main route, @rt("/", methods=["GET"]), is structured similarly to that of an App.jsx, where we return the components that comprise the main app.

If you'd like to take a look at my code, check it out on Replit here. If Replit's not your thing, it's also available on GitHub here, but note that the app is written to run on Replit, so you'll need to refactor the key-value db if you'd like to run it elsewhere. FastHTML comes with some pretty great SQLite interfaces.

This was a fun project and a great toy example, but I can't wait to see what else I'll build. Maybe something closer to a production app or service.

#ai #claude #data #engineering #python #replit #webdev