Live since

Scratch

A platform for deploying and browsing experimental web apps. Each web app is a collection of static files and an optional backing API implemented in Python.

Scratch on a phone
What it does

A Home for Small Web Experiments

Advent of Code 2022 summary page with stats for 50 stars, 25 days, 3 languages, 2,406 lines of code, 105 commits, and 5m 37s to run all solutions
01

A Retrospective on Advent of Code 2022

Solutions and reflections for all 25 days, solved over 21 months. Filter days by technique, read each solution, and compare runtime and memory usage.

Joust home screen with a welcome message, a Create a Tournament button, and a field to join with a PIN
02

A Tournament Bracket on Your Phone

Joust runs tournaments for friends. Create a tournament, share a four-character PIN, and join a team. The app seeds a bracket with moneyline odds based on player confidence.

The Liminal Gazette front page with the headline Furnished properties for rent
03

Static Pages with No Build Step

The Liminal Gazette lists standalone HTML pages like newspaper classifieds. Publishing means dropping an HTML file into a folder and adding a row to the index.

By the numbers

At a Glance

8+experiments
2Postgres databases
1Podman container
30+Gazette pages
How it's built

From Laptop to Live Container

  1. RsyncSource to the VPS
  2. MigrationsBackup, then Flyway
  3. Podman BuildNode stages, then Python
  4. Container SwapProxy and Postgres stay up
  5. NGINXHTTPS to Gunicorn

Built with

FlaskGunicornuvPydanticPostgresFlywayReactViteAstroPodman
Key takeaway

One shared Python backend pays off with more experiments. A single set of dependencies, linting rules, and type checks covers every API. Each new app slots in the same way.

Build Notes

Challenges, learnings, and what's next

Challenges

  • Flask does not automatically handle SPA client-side routing. A catch-all route checks whether the requested path maps to a real file on disk and falls back to index.html if not.
  • Now that there are stateful applications on the VPS, Flyway migrations and more complex deployments are needed to avoid data loss or corruption.
  • Some frontends must be built before deployment. This requires more complex container image build logic.

Learnings

  • Stateful experiments use a shared Postgres instance on the VPS, but complexity is limited by giving each app its own database and scoped credentials.
  • Database load can be limited via NGINX. Guestbook posts are capped per IP at the proxy, before they reach the Flask container.
  • One shared Python backend pays off with more experiments. A single set of dependencies, linting rules, and type checks covers every API. Each new app slots in the same way.

Next

  • Automate the React build and copy step, so settlers-react/dist/ no longer has to be copied in by hand after each change.
  • Introduce Redis or another caching system as app traffic increases.

Blog post

Scratch

A single Flask app that hosts a growing collection of small, self-contained web experiments.

Read the full story →
Keep exploring

More Apps