The original code that goes with this video I think did Go dirty.
If you have Docker installed, it takes care of the setup for you in a Dockerized environment, which allows you to get it up and running quickly & easily.
The only requirement is that you have Docker installed (you do not need golang
, tmpl
, sqlc
or any other project dependencies installed locally).
In terminal, cd
to the project directory, and then type:
make dev
The first time you run this command, it may take a bit of time to build the Docker image, and download all of the appropriate packages, and cache them locally.
Then just navigate to http://localhost:4321
in your browser, and the project will be up and running.
If you have Task and Go 1.23.3 installed you can run the following:
task tools
task -w
- 321LOC of Go across 6 files (including HTTPServer) and ~125LOC of Templ across 3 files for UI. Could be one of each but tried to match the spirit of the original.
- Templ could be shorter but expanded lines for readability.
- Pretty sure it's the smallest codebase of any of the apps in the original.
- Metrics
- I'm pretty sure it's the fastest (queries take < 1ms on my machine)
- Smallest memory footprint (19MB sustained) of any of the apps in the original.
- It handles speculation rules asynchronously for precaching the pokemon images.
- Use pure Go SQLite so N+1 queries are not a problem.
- It's a single binary with no dependencies.
- Datastar
- One time cost of 12KiB of JS.
- Handles all UI interactions and backend communication.
- The version is ALL the plugins we are only using a handful of them for this demo
- No websockets, just normal HTTP requests that can work on HTTP 2/3.
I hope this clear up why it's not
~ Theo