Commit Graph

1492 Commits

Author SHA1 Message Date
kennethreitz 1cb9586b4d WIP: Response handling patches for turboAPI Rust server
The Rust HTTP core always returns application/json content-type
regardless of the content_type field in the response dict. This is a
fundamental limitation of turboAPI's current Rust server - it was
designed for JSON APIs, not template-rendered HTML sites.

HTML content is correctly generated but served with wrong content-type,
causing browsers to download instead of render pages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 00:57:18 -04:00
kennethreitz 3c9f4a134b Accept query params on static file routes for cache-busting URLs
turboAPI passes query string params as kwargs to handlers. Add **kwargs
to static file handlers so cache-bust params like ?v=30f664df don't
cause 500 errors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 00:50:05 -04:00
kennethreitz 4bc4440c63 Add static file serving routes and fix Response handling for turboAPI
turboAPI's Rust server doesn't serve mounted StaticFiles, so add
explicit routes for /static/{file} and /static/{subdir}/{file}.
Also patch ResponseHandler to properly extract body/content-type
from Response objects instead of JSON-serializing them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 00:48:49 -04:00
kennethreitz a8b94a723f Inject Starlette Request into turboAPI handlers for template rendering
Monkey-patch turboAPI's route registration to wrap handlers that expect
a Request parameter with a Starlette-compatible Request object built
from the Rust server's raw HTTP data. Also skip unsupported middleware
during Rust server initialization instead of failing.

This enables all HTML template routes to work alongside the JSON API
routes under turboAPI's Zig/Rust HTTP core.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 00:45:21 -04:00
kennethreitz bab27364fc Integrate turboAPI as FastAPI replacement for Zig-powered HTTP performance
Replace FastAPI with turboAPI across the entire codebase:
- Swap all imports from fastapi to turboapi (TurboAPI, APIRouter, HTTPException, etc.)
- Keep starlette imports for Jinja2Templates and StaticFiles (not yet in turboapi)
- Remove unsupported `example=` params from Query/Path declarations
- Update entry point to use turboapi's native server (app.run())
- Update test clients to use turboapi.testclient.TestClient

The app loads successfully with all 200+ routes registered. turboAPI's
Zig HTTP core provides significant throughput improvements over uvicorn.

Note: turboAPI's TestClient has limited support for Request injection
and Query defaults, causing some test failures. The actual server
runtime handles these correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 00:38:03 -04:00
kennethreitz 4deb3b0201 Disable caching on homepage to keep verse of the day fresh
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 00:29:07 -04:00
kennethreitz 1199b7f972 Pre-render resources, stories, topics, and study guides as static pages
Expand static site generation from ~1,277 to ~1,902 pages by adding:
- 40 resource category pages (biblical-angels, parables, etc.)
- 25 resource detail pages (apostles, prophets, women, etc.)
- 29 Bible stories + 26 kids versions
- 36 topic pages
- 12 reading plan pages
- 36 study guide pages

Also skip 404s gracefully (56 resource slugs lack backing data)
and exempt localhost/testclient from rate limiting so the generator
doesn't throttle itself.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 15:10:58 -05:00
kennethreitz c1f7ee766b Limit search results to 50 to fix slow page rendering
Search for common terms like "love" returned 363+ results, causing
the Jinja2 template to render 222KB of HTML (~8s on shared CPU).
Capping at 50 results drops render time to ~0.4s locally.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 22:02:34 -05:00
kennethreitz 2ab3dfa142 Add static site generation with nginx + hardened FastAPI sidecar
Pre-render ~1,277 high-traffic HTML pages (homepage, books, chapters)
at build time and serve them directly via nginx. All other routes
(verses, search, API, PDFs, Strong's) fall through to a FastAPI
sidecar. If the sidecar crashes, nginx continues serving static
pages and health checks.

Also harden the FastAPI app against the memory/crash issues:
- Switch from bare uvicorn to gunicorn with uvicorn workers
- Add --max-requests worker recycling to prevent memory leaks
- Add --timeout to kill hung workers
- Add per-IP rate limiting middleware (10 req/s, burst of 50)
- Add request timeout middleware (30s max per request)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:59:34 -05:00
kennethreitz c0825705d2 Reduce Fly.io resource usage and harden robots.txt
- Downscale VMs from performance-2x/4GB to shared-cpu-2x/2GB
- Set min_machines_running to 0 for autosleep
- Disable interlinear preload to prevent OOM kills
- Reduce workers from 4 to 2
- Add crawl-delay of 5s and block PDF/old verse-of-the-day crawling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 15:24:10 -05:00
kennethreitz fd9e89f565 Fix blocking I/O operations in async route handlers
Wrapped blocking file I/O and CPU-bound operations with
asyncio.to_thread() to prevent blocking the event loop:

- about.py: stats() and cross_references_index() now compute
  in thread pool (extensive JSON loading and iteration)
- commentary.py: commentary_index() file I/O in thread pool
- misc.py: OG image fallback read_bytes() in thread pool

These routes perform heavy file I/O (reading 66+ JSON files,
iterating 31k verses) which would block all other requests
if run in the async context directly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 13:11:40 -05:00
kennethreitz 5514218320 Use asyncio.to_thread for OG image generation
Pillow image generation is CPU-bound, so run it in thread pool
via asyncio.to_thread() to avoid blocking the event loop.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 13:06:08 -05:00
kennethreitz edecac493b Add dynamic OG image generation for social sharing
- New og_image.py module generates custom 1200x630 social images
- Images include verse title, subtitle, verse text, and branding
- Caches generated images to disk for performance
- Routes: /og/verse/, /og/chapter/, /og/book/, /og/topic/, /og/story/, /og/guide/
- Updated templates: verse, chapter, book, topic, story, study guide
- Images use Georgia serif font matching site typography
- Cream background (#fffff8) and green accent (#4a7c59)

When shared on social media, pages now show custom preview images
with the actual verse text instead of the generic site image.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 13:03:46 -05:00
kennethreitz 5e00af78b7 Add SEO schema improvements (BreadcrumbList, Book schema)
- Add BreadcrumbList JSON-LD schema to verse, chapter, book, topic,
  study guide, and story detail pages for rich SERP breadcrumbs
- Add Book schema to book pages with chapter count and authorship
- Add Article schema to topic detail pages
- All key content pages now have proper structured data for search
  engines to understand site hierarchy

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 12:56:08 -05:00
kennethreitz 2fbf1822b8 Fix resource detail page mobile viewport scaling
Added missing mobile media query to make max-width elements
(description, verse text, intro text) expand to 100% on mobile,
preventing the zoomed-out 55% width issue.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 12:51:33 -05:00
kennethreitz b50ea3176d Remove family tree links from verse of the day page
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 12:49:32 -05:00
kennethreitz 18fcb49bfd Remove family tree links from homepage verse of the day
The epigraph on the homepage now displays plain verse text without
the link_names filter, keeping the display cleaner.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 12:33:09 -05:00
kennethreitz 90067abdb2 Fix interlinear page header/nav width to match content
Removed 55% max-width constraints on page-header, breadcrumb, and
chapter-nav so they span the full width of the interlinear-page
container (90%).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 17:06:50 -05:00
kennethreitz d320d62f4a Fix interlinear word detail popup in dark mode
Added explicit [data-theme="dark"] styles for the word detail popup
which was showing a white background on dark theme.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 16:50:51 -05:00
kennethreitz 4fcefd91de Fix all remaining Galatians shallow commentary
All 149 verses now have:
- 600+ char analysis with 3+ Greek terms
- 200+ char historical context (specific, not generic)
- 3 verse-specific questions (no generic patterns)
- Verse quotes in <strong> tags
- <br><br> paragraph breaks

Eliminates all 130 remaining severe issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 15:05:21 -05:00
kennethreitz c8627c8cb7 Fix Galatians shallow commentary completely
All 149 verses now have:
- Greek terms with transliterations
- 500+ char analysis with <br><br> breaks
- Verse-specific questions (no generic patterns)
- Specific historical context

Key fixes: Chapters 3-4 expansion, generic question replacement

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 14:38:14 -05:00
kennethreitz d9f7f23359 Fix remaining shallow commentary in Galatians, 1 Timothy, Romans
- Galatians 3-6: Complete all 104 remaining verses
  (justification by faith, fruit of Spirit, Hagar/Sarah allegory)
- 1 Timothy: Fix 83 verses with Greek terms and depth
  (elder qualifications, godliness with contentment)
- Romans 13-14, 16: Fix 61 verses missing Greek terms
  (government submission, disputable matters, greetings)

All Pauline epistles now have scholarly commentary.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 14:08:16 -05:00
kennethreitz 69c51b2e4d Regenerate 1 Thess, 2 Tim, Galatians, Ephesians commentary
Progress on remaining Pauline epistles:
- 1 Thessalonians: All 89 verses complete (rapture passage 4:13-18)
- 2 Timothy: Chapters 2-4 complete (3:16-17 inspiration)
- Galatians: Chapters 1-2 complete (45 verses)
- Ephesians: Partial progress

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 13:38:13 -05:00
kennethreitz 5e737eb517 Regenerate Colossians, 2 Thess, Titus, Philemon commentary
Complete scholarly rewrites with:
- Greek terms with transliterations throughout
- Colossians: Christ hymn (1:15-20), fullness of deity, heresy refuted
- 2 Thessalonians: Man of sin, restrainer, work ethic
- Titus: Elder qualifications, grace teaches godliness
- Philemon: Brotherhood transcends slavery, gospel transformation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 13:12:02 -05:00
kennethreitz 3ee59f4d4c Regenerate Philippians commentary with scholarly depth
Complete rewrite of all 104 verses with:
- Greek terms with transliterations throughout
- Special depth for Christ hymn (2:5-11) - kenosis theology
- Direct verse quotes in <strong> tags
- 2-3 paragraph analysis per verse
- Historical context (Roman colony, prison setting)
- Key themes: joy in suffering, pressing toward mark,
  citizenship in heaven, contentment in Christ

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 12:50:43 -05:00
kennethreitz 2916563032 Regenerate 2 Corinthians commentary with scholarly depth
Complete rewrite of all 256 verses with:
- Greek terms with transliterations throughout
- Direct verse quotes in <strong> tags
- 2-3 paragraph analysis per verse
- Historical context (painful visit, super-apostles, collection)
- 3 verse-specific reflection questions
- Key themes: comfort in affliction, new covenant glory,
  treasure in earthen vessels, reconciliation, grace in giving,
  spiritual warfare, thorn in flesh, sufficient grace

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 12:27:24 -05:00
kennethreitz fddd4325ed Regenerate 1 Corinthians commentary with scholarly depth
Complete rewrite of all 437 verses with:
- Greek terms with transliterations throughout
- Direct verse quotes in <strong> tags
- 2-3 paragraph analysis per verse
- Historical context (Corinthian culture, factions, gifts)
- 3 verse-specific reflection questions
- Key themes: wisdom vs. foolishness, body metaphor, love chapter,
  resurrection, spiritual gifts, Lord's Supper

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 11:57:52 -05:00
kennethreitz d686a982f9 Regenerate Romans commentary with scholarly depth
Complete rewrite of all 433 verses with:
- Greek terms with transliterations (ἀγάπη, δικαιοσύνη, πίστις, etc.)
- Direct verse quotes in <strong> tags
- 2-3 paragraph analysis per verse
- Historical context for each verse
- 3 verse-specific reflection questions
- Reformed theological perspective
- Christ-centered interpretation

Replaces shallow, templated content detected by detection script.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 11:25:24 -05:00
kennethreitz 3b8b47d96b Fix 36 extra verse commentary entries + improve Romans commentary
Remove invalid verse entries that exceeded actual Bible verse counts:
- 1 Chronicles 13:15-25 (11 entries) - chapter only has 14 verses
- 1 Chronicles 15:30-52 (23 entries) - chapter only has 29 verses
- Acts 12:28 (1 entry) - chapter only has 25 verses
- Ezra 3:14 (1 entry) - chapter only has 13 verses

This brings commentary from 31,138 to exactly 31,102 verses (100% coverage).

Also includes enhanced Romans commentary with deeper theological analysis,
Greek word studies, and improved reflection questions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 11:07:49 -05:00
kennethreitz 6a2212d078 Restore validate_data.py script
Accidentally deleted in previous cleanup. Required by test_data_validation.py.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 10:49:47 -05:00
kennethreitz 5cc61774ba Add shallow commentary detection script
- Detects generic templated questions, boilerplate historical
  sections, missing Greek/Hebrew terms, short analysis, and
  templated patterns
- Found 1,911 verses with severe issues (3+ problems)
- All affected books are Pauline epistles
- Export list of problem verses to scripts/shallow_verses.txt

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 10:46:59 -05:00
kennethreitz 9c476e3582 Add shallow commentary detection script
Detects:
- Generic templated questions
- Boilerplate historical sections
- Missing Greek/Hebrew terms
- Short analysis sections
- Templated analysis patterns

Usage:
  python scripts/detect_shallow_commentary.py           # Full scan
  python scripts/detect_shallow_commentary.py --worst   # Only 3+ issues
  python scripts/detect_shallow_commentary.py --book romans

Found 1,911 severe cases (3+ issues) mostly in Romans, 1-2 Corinthians

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 10:45:27 -05:00
kennethreitz 194a905868 Improve Romans 9:13 commentary - proper treatment of divine election
- Added Greek terms with transliterations (ēgapēsa, emisēsa, kat' eklogēn prothesis)
- Explained Hebrew idiom of 'love/hate' as preferential choice
- Connected to Malachi 1:2-3 source and context
- Reformed theological perspective on unconditional election
- Historical context from Augustine through Reformation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 10:42:52 -05:00
kennethreitz 92be820bd2 Complete Acts, Deuteronomy, Zechariah - Bible now 100% complete!
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 10:41:46 -05:00
kennethreitz 818c702ef0 Clean up scripts 2025-12-09 10:26:20 -05:00
kennethreitz 6a49bce606 Complete Bible commentary - Joshua, Psalms, Zechariah, Amos, John, Malachi, Ezra, Mark, Jonah, SoS, Esther, Jeremiah, 3 John
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 09:29:48 -05:00
kennethreitz ed7e16d11a Clean up temp scripts 2025-12-09 08:25:40 -05:00
kennethreitz 05745fd3d0 Add Luke, Zephaniah, Joel gaps (64 verses) - batch 34 partial
Running total: ~5,200 verses this session

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 08:25:30 -05:00
kennethreitz e4df3148d5 Clean up temporary scripts 2025-12-09 05:12:44 -05:00
kennethreitz 2399f6504d Add Ezekiel, Numbers, Matthew, Judges, Isaiah, Ecclesiastes, Job gaps (~600 verses) - batch 33/100
Running total: ~5,142 verses this session

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 05:12:26 -05:00
kennethreitz 831e47a243 Add Jeremiah, Isaiah, Deuteronomy, Luke, Micah gaps (466 verses) - batch 32/100
Running total: ~4,542 verses this session

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 04:42:01 -05:00
kennethreitz d775c01cf2 Fix Zechariah 1:14 gap - gaps complete!
Running total: ~4,076 verses this session

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 04:13:05 -05:00
kennethreitz b13739f9bf Add Zechariah + Zephaniah gaps (123 verses) - batch 31/100
Running total: ~4,075 verses
Existing gaps nearly complete!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 04:10:39 -05:00
kennethreitz ec7ce95fbf Add Psalms final gaps + Song of Solomon (225 verses) - batch 30/100
Running total: ~3,952 verses

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 03:45:21 -05:00
kennethreitz be6c64551b Add Psalms 74-89, 109 gaps (194 verses) - batch 29/100
Running total: ~3,727 verses

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 03:21:51 -05:00
kennethreitz 1666fb9996 Add Psalms 38, 78, 81, 94, 118-119, 137, 139, 144 (198 verses) - batch 28/100
Running total: ~3,533 verses

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 03:09:13 -05:00
kennethreitz 108129dd2b Add Numbers, Proverbs 25-31, Psalms 119/139 (158 verses) - batch 27/100
Running total: ~3,335 verses

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 02:58:28 -05:00
kennethreitz 0090d0a68e Add Numbers 8-10, 17, 19, 28-32, 34-36 + Proverbs 27 (182 verses) - batch 26/100
Running total: ~3,177 verses

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 02:48:54 -05:00
kennethreitz 2e4b1c756a Add Numbers 7, 10, 15-16, 18, 22, 26, 33 + Obadiah (199 verses) - batch 25/100
Running total: ~2,995 verses (approaching 3,000!)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 02:33:28 -05:00
kennethreitz fa8386cd35 Add Matthew, Micah, Nahum, Numbers (152 verses) - batch 24/100
Running total: ~2,796 verses

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 02:13:11 -05:00