simple-web-app

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 9df59880a76b927ba04c0b36ec5c1f5aee7ca43d
parent aaafbad6381ecd892a85003397a8d10df77d104a
Author: Silas Brack <silasbrack@gmail.com>
Date:   Sun,  7 Jun 2026 20:35:39 +0200

chore: fix source URL, add seed script

- Point footer source link to Forgejo
- Add scripts/seed.sh for generating sample posts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Diffstat:
Ascripts/seed.sh | 96+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtemplates/application.html | 2+-
2 files changed, 97 insertions(+), 1 deletion(-)

diff --git a/scripts/seed.sh b/scripts/seed.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env bash +set -euo pipefail + +TRAILBASE_URL="${TRAILBASE_URL:-http://127.0.0.1:4000}" +AUTH="${TOKEN#Bearer }" + +post() { + local title="$1" url="$2" text="$3" published="$4" + local domain="" + if [ -n "$url" ]; then + domain=$(echo "$url" | sed 's|https\?://\(www\.\)\?||;s|/.*||') + fi + + local url_field="null" + [ -n "$url" ] && url_field="\"$url\"" + local domain_field="null" + [ -n "$domain" ] && domain_field="\"$domain\"" + + curl -s -X POST \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json" \ + "${TRAILBASE_URL}/api/records/v1/story" \ + -d "{\"title\":\"$title\",\"url\":$url_field,\"text\":\"$text\",\"domain\":$domain_field,\"published\":\"$published\",\"language\":\"en\"}" > /dev/null + echo " + $title" +} + +tag() { + curl -s -X POST \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json" \ + "${TRAILBASE_URL}/api/records/v1/story_category" \ + -d "{\"news_item_id\":$1,\"category_id\":$2}" > /dev/null +} + +echo "Seeding stories..." + +post "Show: I built a link aggregator with Rust and Trailbase" "" \ + "After trying several backend frameworks, I settled on Trailbase for the auth and data layer, with a custom Rust frontend using Axum and Askama templates. FTS5 search, HTMX for voting." \ + "2026-06-07T15:00:00Z" + +post "SQLite is the only database you need for most web apps" \ + "https://www.sqlite.org/whentouse.html" "" "2026-06-07T13:00:00Z" + +post "Ask: What is your preferred way to handle auth in a side project?" "" \ + "I have been going back and forth between rolling my own JWT auth, using OAuth providers, and using something like Trailbase or Supabase. What do you all use?" \ + "2026-06-07T11:00:00Z" + +post "The unreasonable effectiveness of simple HTML" \ + "https://www.swyx.io/simplicity-economy" "" "2026-06-07T08:00:00Z" + +post "NixOS: declarative infrastructure as code for your servers" \ + "https://nixos.org/guides/how-nix-works" "" "2026-06-07T06:00:00Z" + +post "Why we moved from microservices back to a monolith" \ + "https://www.primevideotech.com/video-streaming/scaling-up-the-prime-video-audio-video-monitoring-service-and-reducing-costs-by-90" "" \ + "2026-06-06T18:00:00Z" + +post "Full-text search with SQLite FTS5" \ + "https://www.sqlite.org/fts5.html" "" "2026-06-06T12:00:00Z" + +post "The web does not need JavaScript frameworks" \ + "https://htmx.org/essays/a-real-world-react-to-htmx-port/" "" "2026-06-05T18:00:00Z" + +post "Show: Self-hosting everything on a single Hetzner box" "" \ + "Running NixOS on a Hetzner dedicated server with nginx, Forgejo, MediaWiki, a mail server, and now this link aggregator. All managed through a single flake." \ + "2026-06-05T12:00:00Z" + +post "Rust error handling is beautiful" \ + "https://blog.burntsushi.net/rust-error-handling/" "" "2026-06-04T18:00:00Z" + +post "Ask: How do you manage secrets in NixOS?" "" \ + "I have been using sops-nix with age keys derived from SSH host keys. Works well but curious what others are doing. Anyone using vault or agenix?" \ + "2026-06-04T12:00:00Z" + +post "WireGuard is massively simpler than OpenVPN" \ + "https://www.wireguard.com/papers/wireguard.pdf" "" "2026-06-03T18:00:00Z" + +post "The small web is beautiful" \ + "https://benhoyt.com/writings/the-small-web-is-beautiful/" "" "2026-06-02T18:00:00Z" + +post "Nix flakes are not the future of Nix, they are the present" \ + "https://determinate.systems/posts/nix-and-flakes" "" "2026-06-02T12:00:00Z" + +post "Show: A minimal HN clone in under 2000 lines of Rust" "" \ + "Axum for routing, Askama for templates, Trailbase for the database and auth, rusqlite for FTS5 search. No JS framework, just HTMX for the interactive bits." \ + "2026-06-01T12:00:00Z" + +echo "Seeding tags..." +tag 1 1; tag 1 3 +tag 3 2 +tag 5 3 +tag 9 1; tag 9 3 +tag 11 2; tag 11 3 +tag 15 1; tag 15 3 + +echo "Done! Seeded 15 stories with tags." diff --git a/templates/application.html b/templates/application.html @@ -27,7 +27,7 @@ <div id="content">{{ content|safe }}</div> </main> <footer class="site-footer"> - <a href="https://github.com/silasbrack/simple-web-app">Source</a> + <a href="https://git.fnarglebeast.com/silas/simple-web-app">Source</a> </footer> </body> </html>