kennethreitz df67749532 Migrate hardcoded data to JSON files for better maintainability
This commit completes a comprehensive data migration, externalizing all hardcoded
theological content from Python modules to structured JSON files in the data/ directory.

## Changes

### New JSON Data Files (3 files, 356 KB total)
- **study_guides.json** (265 KB): 25 complete study guides with 183 sections and 732 verse references
  - 6 categories: Foundational, Character & Living, Biblical Themes, Doctrinal, Thematic, Family
- **word_studies.json** (35 KB): 53 biblical terms with Hebrew/Greek definitions
  - Includes transliterations, meanings, and theological notes for OT and NT
- **verse_commentary.json** (56 KB): 22 verses with detailed theological analysis
  - Includes analysis, historical context, applications, and reflection questions

### Code Refactoring

**routes/study_guides.py** (1,248 lines removed, 85% reduction)
- Replaced 1,070 lines of hardcoded study guide content with JSON loader
- File reduced from 1,463 lines to 215 lines
- Added @lru_cache JSON loaders for performance
- Removed `_get_study_guides_catalog_old()` and `_get_study_guides_content_old()`

**routes/commentary.py** (496 lines removed, 11.7% reduction)
- Replaced 494 lines of hardcoded word studies and verse commentary
- File reduced from 4,222 lines to 3,726 lines
- Added structured JSON loaders with data transformation:
  - `_load_word_studies()`: Converts flat JSON to nested OT/NT structure
  - `_load_verse_commentary()`: Parses verse references into book/chapter/verse hierarchy
- Removed hardcoded `word_studies` (226 lines) and `enhanced_commentary` (268 lines) dictionaries

## Benefits
- **Maintainability**: Non-developers can now edit theological content in JSON
- **Performance**: @lru_cache ensures data loaded once per process
- **Separation of Concerns**: Content separated from application logic
- **Version Control**: Easier to track content changes in structured format
- **Scalability**: Can add new study guides/commentary without code changes

## Testing
- All 252 tests pass
- Verified data structure compatibility
- Confirmed JSON loaders work correctly with existing templates

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 18:10:40 -05:00
2025-11-22 12:10:55 -05:00
2025-11-14 19:24:08 -05:00

KJV Study

A comprehensive web application for deep study of the King James Bible, featuring original language tools, extensive theological resources, and classical scholarly presentation.

Live Site: kjvstudy.org

Features

Bible Reading & Navigation

  • Complete KJV Text - All 66 books, 1,189 chapters, 31,102 verses
  • Fast Search - Full-text search with concordance functionality
  • Cross-References - Comprehensive verse cross-referencing throughout Scripture
  • Verse Linking - Automatic URL generation for easy sharing and bookmarking
  • Random Verse - Discover Scripture serendipitously
  • Verse of the Day - Daily curated verses with reflection questions

Study Tools

Interlinear Bible

Study Guides

Comprehensive 8-section guides with extensive Scripture references:

Biblical Resources

People & Characters:

Themes & Topics:

Historical Context:

  • Biblical Timeline - From Creation through the early Church
  • Biblical Maps - Geographic context for biblical narratives
  • Family Tree - Genealogies from Adam through biblical history with searchable lineages

Design & User Experience

Tufte CSS Styling:

  • Classical typography with serif fonts for optimal readability
  • Sidenotes and margin notes for supplementary information
  • High contrast and generous white space
  • Responsive design that adapts to all screen sizes

Performance:

  • Aggressive caching for instant page loads
  • Optimized for Fly.io deployment
  • Always-on configuration eliminates cold starts
  • Lazy loading of interlinear data

Accessibility:

  • Semantic HTML structure
  • Clear heading hierarchy
  • Keyboard navigation support
  • High contrast text

Tech Stack

Backend:

  • FastAPI - Modern, high-performance Python web framework
  • Python 3.13 - Latest Python with performance improvements
  • biblepy - KJV Bible text library
  • Jinja2 - Server-side templating with custom filters

Frontend:

  • Tufte CSS - Edward Tufte-inspired classical design
  • Vanilla JavaScript - Minimal client-side code for enhanced functionality
  • Semantic HTML - Accessible, well-structured markup

Infrastructure:

  • Docker - Containerized deployment
  • Fly.io - Production hosting with global CDN
  • uv - Fast Python package management

Installation

Prerequisites

  • Python 3.13 or higher
  • uv package manager

Local Development

  1. Clone the repository

    git clone https://github.com/kennethreitz/kjvstudy.org.git
    cd kjvstudy.org
    
  2. Install dependencies

    uv sync
    
  3. Run the development server

    uv run kjvstudy-org
    
  4. Open your browser

    http://localhost:8000
    

Docker Development

# Build the image
docker build -t kjvstudy .

# Run the container
docker run -p 8000:8000 kjvstudy

# Or use docker-compose
docker compose up

Deployment

Fly.io Deployment

The application is optimized for Fly.io with:

  • 2GB RAM, shared CPU (2 cores)
  • Always-on configuration (min 1 machine)
  • Preloaded interlinear data for fast responses
  • Health checks and automatic recovery
# Install Fly CLI
curl -L https://fly.io/install.sh | sh

# Login to Fly
fly auth login

# Deploy
fly deploy

# View logs
fly logs

# SSH into machine
fly ssh console

Environment Variables

PYTHONUNBUFFERED=1              # Immediate log output
PYTHONDONTWRITEBYTECODE=1       # Skip .pyc files
PRELOAD_INTERLINEAR=true        # Load interlinear data on startup

Project Structure

kjvstudy.org/
├── kjvstudy_org/
│   ├── server.py              # Main FastAPI application
│   ├── kjv.py                 # Bible text access
│   ├── cross_references.py    # Cross-reference data
│   ├── topics.py              # Topical index
│   ├── interlinear_loader.py  # Greek/Hebrew data
│   ├── reading_plans.py       # Bible reading plans
│   ├── templates/             # Jinja2 templates
│   │   ├── base.html         # Base template with Tufte CSS
│   │   ├── verse.html        # Individual verse pages
│   │   ├── study_guides.html # Study guide templates
│   │   └── ...
│   └── static/               # Static assets
├── Dockerfile                # Container configuration
├── fly.toml                  # Fly.io deployment config
├── pyproject.toml            # Python dependencies
└── README.md                 # This file

Contributing

We welcome contributions! Areas where you can help:

Development:

  • Backend optimization and new features
  • Frontend improvements and accessibility
  • Mobile app development
  • API development for external integrations

Content:

  • Theological review for accuracy
  • Additional study guides and resources
  • Original language expertise (Greek/Hebrew)
  • Historical and cultural context

Design:

  • UI/UX improvements
  • Accessibility enhancements
  • Mobile experience optimization
  • Print stylesheet development

Documentation:

  • Tutorials and how-to guides
  • API documentation
  • User guides
  • Translation to other languages

Roadmap

Planned Features:

  • Multiple Bible translations (ESV, NASB, NIV)
  • User accounts with note-taking and highlighting
  • Bible reading plans with progress tracking
  • AI-powered commentary generation
  • Mobile applications (iOS/Android)
  • Prayer journal integration
  • Scripture memorization tools
  • Community discussion forums
  • Live streaming integration for Bible studies

License

This project is open source and available under the ISC License.

Acknowledgments

  • King James Bible (1769) - The foundational text
  • FastAPI Community - Excellent web framework
  • Edward Tufte - Design philosophy and CSS inspiration
  • Open Source Community - Tools and libraries that make this possible

"Study to shew thyself approved unto God, a workman that needeth not to be ashamed, rightly dividing the word of truth." — 2 Timothy 2:15 (KJV)

S
Description
No description provided
Readme ISC 146 MiB
Languages
Python 45.5%
HTML 41.2%
JavaScript 9.9%
CSS 3.3%