simple-web-app

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

commit 9dec5975bee49ac67ccfa3a66d7c8d3d80121ca3
parent 90486b5dd24369cd615a0505e916662ae4f4162d
Author: Silas Brack <silasbrack@gmail.com>
Date:   Sun,  7 Jun 2026 22:48:38 +0200

docs: trim README to stable content only

Remove project structure listing and tech stack details that
go stale. Keep principles, dev setup, and build commands.

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

Diffstat:
MREADME.md | 91++++++++++++-------------------------------------------------------------------
1 file changed, 13 insertions(+), 78 deletions(-)

diff --git a/README.md b/README.md @@ -1,28 +1,14 @@ # Simple Web App -A link aggregator (HN clone) built with Rust, Axum, Askama, and Trailbase. - -Live at [simple.fnarglebeast.com](https://simple.fnarglebeast.com). - -## Tech Stack - -- **Axum** — Web framework -- **Askama** — Type-safe HTML templating -- **Trailbase** — Auth, record APIs, and SQLite storage -- **HTMX** — Voting without full page reloads -- **FTS5** — Full-text search via a WASM guest component +A link aggregator built with Rust, Axum, Askama, and Trailbase. ## Principles 1. **Explicit over clever** — Code reads top-to-bottom. A new reader should understand what a function does without chasing through layers of indirection. - -2. **Pure functions** — Isolate decision logic from I/O. Functions like `time_ago`, `hot_score`, `extract_domain`, and `parse_tags` take data and return data with no side effects. - -3. **Linear flow** — Handlers read as sequential steps: authenticate, fetch data, build view, respond. No callbacks or deep nesting. - -4. **Minimize shared state** — `AppState` holds only the trailbase URL and an HTTP client. Everything else is passed explicitly. - -5. **Minimize indirection** — No traits, no dependency injection, no "in case we swap implementations later." Direct function calls throughout. +2. **Pure functions** — Isolate decision logic from I/O. +3. **Linear flow** — Handlers read as sequential steps: authenticate, fetch data, build view, respond. +4. **Minimize shared state** — Pass values explicitly. +5. **Minimize indirection** — No traits or abstractions "in case we need to swap later." ## Development @@ -30,74 +16,23 @@ Live at [simple.fnarglebeast.com](https://simple.fnarglebeast.com). nix develop cargo run # start server cargo watch -x run # auto-reload +trail run # trailbase (separate terminal) ``` -Trailbase runs separately: - -```bash -trail run -``` - -## Type Generation - -Types are auto-generated from the Trailbase schema: - -```bash -./scripts/generate-types.sh -``` - -Requires `trail` and `quicktype` (both in the dev shell). - -## Seeding +## Scripts ```bash -TOKEN=$(trail user mint-token <email>) ./scripts/seed.sh +./scripts/generate-types.sh # regenerate Rust types from trailbase schema +TOKEN=$(trail user mint-token <email>) ./scripts/seed.sh # seed sample data ``` ## Building ```bash -nix build # app binary -nix build .#trailbase # trailbase binary -``` +nix build # app binary +nix build .#trailbase # trailbase binary -The WASM search guest must be built separately: - -```bash -cd guests/rust -cargo build --target wasm32-wasip2 --release +# WASM search guest (must be built separately) +cd guests/rust && cargo build --target wasm32-wasip2 --release cp target/wasm32-wasip2/release/search_guest.wasm ../../traildepot/wasm/ ``` - -## Project Structure - -``` -simple-web-app/ -├── src/ -│ ├── main.rs # Entry point -│ ├── config.rs # Environment configuration -│ ├── state.rs # AppState (trailbase URL, HTTP client) -│ ├── error.rs # Error types -│ ├── routes.rs # Route definitions + static file serving -│ ├── templates.rs # Askama template structs -│ ├── trailbase.rs # Trailbase API client functions -│ ├── trailbase_types.rs # Auto-generated types (quicktype) -│ ├── db/mod.rs # View models (StoryWithMeta, CommentWithMeta) -│ └── handlers/ # Route handlers -│ ├── auth.rs # Login, register, verification -│ ├── feed.rs # Hot/new/top feeds -│ ├── story.rs # Story detail, submit, edit -│ ├── comment.rs # Comments, replies -│ ├── vote.rs # HTMX voting endpoints -│ ├── search.rs # FTS5 search (via WASM guest) -│ ├── user.rs # User profiles -│ └── tag.rs # Tag pages -├── templates/ # Askama HTML templates -├── static/ # CSS, htmx.min.js, preload.min.js -├── guests/rust/ # WASM guest for FTS5 search -├── traildepot/ # Trailbase config, migrations, WASM components -├── schemas/ # JSON schemas for type generation -├── scripts/ # seed.sh, generate-types.sh -├── trailbase.nix # Nix derivation for trailbase binary -└── flake.nix # Nix flake (build, dev shell, checks) -```