Commit Graph

28 Commits

Author SHA1 Message Date
66fd575ad5 feat: implement search-first Bible navigator with touch optimization
Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 19:21:10 +00:00
a688945df2 fix: correct LRU cache eviction and expiration logic in cache-manager 2025-11-11 19:16:43 +00:00
18be9bbd55 feat: add types and IndexedDB cache manager for Bible reader 2025
Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 19:08:31 +00:00
c3cd353f2f feat: implement subscription system with conversation limits
Implement complete backend subscription system that limits free users to 10
AI conversations per month and offers Premium tier ($10/month or $100/year)
with unlimited conversations.

Changes:
- Add User subscription fields (tier, status, limits, counters)
- Create Subscription model to track Stripe subscriptions
- Implement conversation limit enforcement in chat API
- Add subscription checkout and customer portal APIs
- Update Stripe webhook to handle subscription events
- Add subscription utility functions (limit checks, tier management)
- Add comprehensive subscription translations (en, ro, es, it)
- Update environment variables for Stripe price IDs
- Update footer "Sponsor Us" link to point to /donate
- Add "Sponsor Us" button to home page hero section

Database:
- User model: subscriptionTier, subscriptionStatus, conversationLimit,
  conversationCount, limitResetDate, stripeCustomerId, stripeSubscriptionId
- Subscription model: tracks Stripe subscription details, periods, status
- SubscriptionStatus enum: ACTIVE, CANCELLED, PAST_DUE, TRIALING, etc.

API Routes:
- POST /api/subscriptions/checkout - Create Stripe checkout session
- POST /api/subscriptions/portal - Get customer portal link
- Webhook handlers for: customer.subscription.created/updated/deleted,
  invoice.payment_succeeded/failed

Features:
- Free tier: 10 conversations/month with automatic monthly reset
- Premium tier: Unlimited conversations
- Automatic limit enforcement before conversation creation
- Returns LIMIT_REACHED error with upgrade URL when limit hit
- Stripe Customer Portal integration for subscription management
- Automatic tier upgrade/downgrade via webhooks

Documentation:
- SUBSCRIPTION_IMPLEMENTATION_PLAN.md - Complete implementation plan
- SUBSCRIPTION_IMPLEMENTATION_STATUS.md - Current status and next steps

Frontend UI still needed: subscription page, upgrade modal, usage display

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 22:14:22 +00:00
a01377b21a feat: implement AI chat with vector search and random loading messages
Major Features:
-  AI chat with Azure OpenAI GPT-4o integration
-  Vector search across Bible versions (ASV English, RVA 1909 Spanish)
-  Multi-language support with automatic English fallback
-  Bible version citations in responses [ASV] [RVA 1909]
-  Random Bible-themed loading messages (5 variants)
-  Safe build script with memory guardrails
-  8GB swap memory for build safety
-  Stripe donation integration (multiple payment methods)

AI Chat Improvements:
- Implement vector search with 1536-dim embeddings (Azure text-embedding-ada-002)
- Search all Bible versions in user's language, fallback to English
- Cite Bible versions properly in AI responses
- Add 5 random loading messages: "Searching the Scriptures...", etc.
- Fix Ollama conflict (disabled to use Azure OpenAI exclusively)
- Optimize hybrid search queries for actual table schema

Build & Infrastructure:
- Create safe-build.sh script with memory monitoring (prevents server crashes)
- Add 8GB swap memory for emergency relief
- Document build process in BUILD_GUIDE.md
- Set Node.js memory limits (4GB max during builds)

Database:
- Clean up 115 old vector tables with wrong dimensions
- Keep only 2 tables with correct 1536-dim embeddings
- Add Stripe schema for donations and subscriptions

Documentation:
- AI_CHAT_FINAL_STATUS.md - Complete implementation status
- AI_CHAT_IMPLEMENTATION_COMPLETE.md - Technical details
- BUILD_GUIDE.md - Safe building guide with guardrails
- CHAT_LOADING_MESSAGES.md - Loading messages implementation
- STRIPE_IMPLEMENTATION_COMPLETE.md - Stripe integration docs
- STRIPE_SETUP_GUIDE.md - Stripe configuration guide

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 19:37:24 +00:00
79f1512f3a feat: Apple-style donation-focused landing page + Azure OpenAI fixes
Major updates:
- Replace homepage with clean, minimalist Apple-style landing page
- Focus on donation messaging and mission statement
- Add comprehensive AI chat analysis documentation
- Fix Azure OpenAI configuration with correct endpoints
- Update embedding API to use text-embedding-ada-002 (1536 dims)

Landing Page Features:
- Hero section with tagline "Every Scripture. Every Language. Forever Free"
- Mission statement emphasizing free access
- Matthew 10:8 verse highlight
- 6 feature cards (Global Library, Multilingual, Prayer Wall, AI Chat, Privacy, Offline)
- Donation CTA sections with PayPal and card options
- "Why It Matters" section with dark background
- Clean footer with navigation links

Technical Changes:
- Updated .env.local with new Azure credentials
- Fixed vector-search.ts to support separate embed API version
- Integrated AuthModal into Bible reader and prayers page
- Made prayer filters collapsible and mobile-responsive
- Changed language picker to single-select

Documentation Created:
- AI_CHAT_FIX_PLAN.md - Comprehensive implementation plan
- AI_CHAT_VERIFICATION_FINDINGS.md - Database analysis
- AI_CHAT_ANALYSIS_SUMMARY.md - Executive summary
- AI_CHAT_STATUS_UPDATE.md - Current status and next steps
- logo.svg - App logo (MenuBook icon)

Build:  Successful (Next.js 15.5.3)

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 22:38:19 +00:00
989f231d5a feat: add captcha verification to contact form
Added math-based captcha system to prevent spam on the contact form:
- Created captcha API endpoint with simple arithmetic questions
- Added captcha UI component with refresh functionality
- Integrated captcha verification into contact form submission
- Relaxed spam filters since captcha provides better protection

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 17:53:56 +00:00
9158ffa637 fix: switch contact form to use local SMTP (Maddy) instead of Mailgun
Changed contact form email delivery to use local Maddy SMTP server for better reliability.

**Changes:**
- Created new SMTP service (lib/smtp.ts) using nodemailer
- Configured to use localhost:25 (Maddy SMTP)
- Updated contact API to use smtpService instead of mailgunService
- Installed nodemailer and @types/nodemailer

**Benefits:**
- Simpler configuration (no external API dependencies)
- Local email delivery (more reliable for internal emails)
- No API rate limits or authentication issues
- Direct delivery to contact@biblical-guide.com

**Roundcube still uses Mailgun SMTP** for outgoing emails from webmail interface.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 14:05:16 +00:00
fa72c992f4 fix: ensure books display in biblical order (Old Testament → New Testament)
- Modified offline storage to sort books by orderNum after IndexedDB retrieval
- Fixed book ordering issue where books appeared out of sequence
- Books now consistently display: Genesis → Revelation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-30 12:00:08 +00:00
fee36dfdad feat: improve Bible reader UX with dropdown menu and enhanced offline features
- Replace three separate verse action icons with compact three-dot dropdown menu
  - Bookmark, Copy Verse, and Ask AI now in a single menu
  - Better space utilization on mobile, tablet, and desktop

- Enhance offline Bible downloads UI
  - Move downloaded versions list to top for better visibility
  - Add inline progress bars during downloads
  - Show real-time download progress with chapter counts
  - Add refresh button for downloaded versions list
  - Remove duplicate header, keep only main header with online/offline status

- Improve build performance
  - Add .eslintignore to speed up linting phase
  - Already excludes large directories (bibles/, scripts/, csv_bibles/)

- Add debug logging for offline storage operations

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-30 08:23:22 +00:00
a01b2490dc Implement comprehensive PWA with offline Bible reading capabilities
- Add Web App Manifest with app metadata, icons, and installation support
- Create Service Worker with intelligent caching strategies for Bible content, static assets, and dynamic content
- Implement IndexedDB-based offline storage system for Bible versions, books, chapters, and verses
- Add offline download manager component for browsing and downloading Bible versions
- Create offline Bible reader component for seamless offline reading experience
- Integrate PWA install prompt with platform-specific instructions
- Add offline reading interface to existing Bible reader with download buttons
- Create dedicated offline page with tabbed interface for reading and downloading
- Add PWA and offline-related translations for English and Romanian locales
- Implement background sync for Bible downloads and cache management
- Add storage usage monitoring and management utilities
- Ensure SSR-safe implementation with dynamic imports for client-side components

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-28 22:20:44 +00:00
e4b815cb40 Add Ollama embedding support and improve prayer system with public/private visibility
- Add Ollama fallback support in vector search with Azure OpenAI as primary
- Enhance prayer system with public/private visibility options and language filtering
- Update OG image to use new biblical-guide-og-image.png
- Improve prayer request management with better categorization
- Remove deprecated ingest_json_pgvector.py script

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-28 19:25:49 +00:00
2d27eae756 Enhance RAG system to support multiple vector databases and improve AI chat functionality
- Update vector-search.ts to query all available vector tables per language instead of single table
- Add getAllVectorTables() function to discover all language-specific vector tables
- Enhance searchBibleHybrid() to query multiple tables and merge results by relevance score
- Enhance searchBibleSemantic() to combine results from all available vector databases
- Add comprehensive error handling and logging for vector search operations
- Improve Azure OpenAI content filtering detection and error handling
- Add test-vector API endpoint for database diagnostics and debugging
- Fix environment configuration with complete Azure OpenAI settings
- Enable multi-translation biblical context from diverse Bible versions simultaneously

Tested: Romanian chat works excellently with rich biblical context and verse citations
Issue: English requires vector table creation - 47 English Bible versions exist but no vector tables

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 07:21:59 +00:00
1054f5d817 Add Mailgun admin tools and contact API 2025-09-24 13:59:26 +00:00
3b34d7518b Fix admin authentication cookie handling
- Updated verifyAdminAuth to check for adminToken cookie in addition to Bearer token
- Added fallback to parse cookie from request headers when cookies() API fails
- This fixes admin dashboard login issues where authentication was failing

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 10:06:29 +00:00
4303e48fac Fix Next.js 15 compatibility and TypeScript errors
- Update API route handlers to use async params for Next.js 15 compatibility
- Fix MUI DataGrid deprecated props (pageSize -> initialState.pagination)
- Replace Material-UI Grid components with Box for better compatibility
- Fix admin authentication system with proper request parameters
- Update permission constants to match available AdminPermission enum values
- Add missing properties to Page interface for type safety
- Update .gitignore to exclude venv/, import logs, and large data directories
- Optimize Next.js config to reduce memory usage during builds

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 09:54:13 +00:00
95070e5369 Add comprehensive page management system to admin dashboard
Features added:
- Database schema for pages and media files with content types (Rich Text, HTML, Markdown)
- Admin API routes for full page CRUD operations
- Image upload functionality with file management
- Rich text editor using TinyMCE with image insertion
- Admin interface for creating/editing pages with SEO options
- Dynamic navigation and footer integration
- Public page display routes with proper SEO metadata
- Support for featured images and content excerpts

Admin features:
- Create/edit/delete pages with rich content editor
- Upload and manage images through media library
- Configure pages to appear in navigation or footer
- Set page status (Draft, Published, Archived)
- SEO title and description management
- Real-time preview of content changes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 07:26:25 +00:00
39b6899315 Complete admin dashboard implementation with comprehensive features
🚀 Major Update: v2.0.0 - Complete Administrative Dashboard

## Phase 1: Dashboard Overview & Authentication 
- Secure admin authentication with JWT tokens
- Beautiful overview dashboard with key metrics
- Role-based access control (admin, moderator permissions)
- Professional MUI design with responsive layout

## Phase 2: User Management & Content Moderation 
- Complete user management with advanced data grid
- Prayer request content moderation system
- User actions: view, suspend, activate, promote, delete
- Content approval/rejection workflows

## Phase 3: Analytics Dashboard 
- Comprehensive analytics with interactive charts (Recharts)
- User activity analytics with retention tracking
- Content engagement metrics and trends
- Real-time statistics and performance monitoring

## Phase 4: Chat Monitoring & System Administration 
- Advanced conversation monitoring with content analysis
- System health monitoring and backup management
- Security oversight and automated alerts
- Complete administrative control panel

## Key Features Added:
 **32 new API endpoints** for complete admin functionality
 **Material-UI DataGrid** with advanced filtering and pagination
 **Interactive Charts** using Recharts library
 **Real-time Monitoring** with auto-refresh capabilities
 **System Health Dashboard** with performance metrics
 **Database Backup System** with automated scheduling
 **Content Filtering** with automated moderation alerts
 **Role-based Permissions** with granular access control
 **Professional UI/UX** with consistent MUI design
 **Visit Website Button** in admin header for easy navigation

## Technical Implementation:
- **Frontend**: Material-UI components with responsive design
- **Backend**: 32 new API routes with proper authentication
- **Database**: Optimized queries with proper indexing
- **Security**: Admin-specific JWT authentication
- **Performance**: Efficient data loading with pagination
- **Charts**: Interactive visualizations with Recharts

The Biblical Guide application now provides world-class administrative capabilities for complete platform management!

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 12:01:34 +00:00
Claude Assistant
d4b0062521 Implement comprehensive homepage improvements and SEO optimization
Major homepage and SEO enhancements based on optimization document:

**Homepage Content Updates:**
- Updated H1 titles with SEO-optimized text for both RO/EN
- Enhanced hero descriptions with targeted keywords
- Improved feature descriptions for better clarity
- Updated daily verse section with keyword-rich titles
- Added new footer description with SEO focus

**SEO Implementation:**
- Added dynamic metadata generation with locale-specific SEO
- Implemented Open Graph tags for social media sharing
- Added Twitter Card metadata for enhanced sharing
- Integrated Schema.org JSON-LD structured data
- Set up hreflang tags for international SEO
- Added canonical URLs to prevent duplicate content
- Included targeted keywords for both languages

**Technical Improvements:**
- Migrated from Docker to PM2 deployment
- Removed Docker files and updated deployment scripts
- Updated README with PM2 instructions
- Fixed console log cleanup for production
- Added proper favicon with Next.js app directory
- Increased memory limit to 4GB for better performance
- Updated port configuration to 0.0.0.0:3010
- Set Romanian (/ro) as default locale with proper redirects

**Translation Updates:**
- Enhanced Romanian translations with SEO-optimized content
- Updated English translations with matching SEO improvements
- Added new 'seo' namespace for metadata translations

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-22 18:40:21 +00:00
andupetcu
98c17d69bc Build fixes: offline-safe fonts, Next.js API route type updates, TS strict errors resolved, MUI import cleanup, chat markdown wrapper, Azure OpenAI typing, caching key + chapter API id types, and misc error-logging typings. 2025-09-22 17:07:31 +03:00
andupetcu
196ca00194 Fix authentication state persistence and admin role display
- Implement complete authentication system with JWT token validation
- Add auth provider with persistent login state across page refreshes
- Create multilingual login/register forms with Material-UI components
- Fix token validation using raw SQL queries to bypass Prisma sync issues
- Add comprehensive error handling for expired/invalid tokens
- Create profile and settings pages with full i18n support
- Add proper user role management (admin/user) with database sync
- Implement secure middleware with CSRF protection and auth checks
- Add debug endpoints for troubleshooting authentication issues
- Fix Zustand store persistence for authentication state

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-21 01:06:30 +03:00
andupetcu
5ddf62e5cf Vector schema per version: add ai_bible schema with per-version tables (bv_<lang>_<abbr>) in Python ingest; dynamic table resolution in vector-search with fallback to legacy table; sample pgAdmin queries printed. 2025-09-20 19:08:11 +03:00
andupetcu
88b251c100 Fix Edge-incompatible middleware; set Node runtime on Prisma/pg routes; add full Romanian Bible import + converter; import data JSON; resync RO bookKeys; stabilize /api/bible/books locale fallback; restart dev server. 2025-09-20 18:01:04 +03:00
andupetcu
500066450d Improve home page layout and typography
- Fix feature cards layout: 2 columns desktop, 1 mobile with consistent sizing
- Add Google Fonts: Merriweather for headings, Lato for body text
- Improve card content structure and spacing
- Center feature cards and stats section for better alignment
- Group all card content (icon, title, description) in single container
- Set fixed card dimensions (400px max width, 280px height)
- Add text overflow handling for descriptions (3 lines max)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 16:23:34 +03:00
andupetcu
51248b24f7 Update color palette and improve UI aesthetics
- Apply new teal-based color palette (#009688, #00796B, #B2DFDB)
- Update secondary color to accent yellow (#FFC107)
- Replace Material-UI loading states with proper animations and skeletons
- Remove ugly gradient background, replace with clean white
- Update all gradients to use new color scheme
- Improve text colors for better readability (#212121, #757575)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 16:04:02 +03:00
andupetcu
a0969e88df Implement complete multi-language support with Romanian/English
- Added next-intl for internationalization with Romanian as default locale
- Restructured app directory with [locale] routing (/ro, /en)
- Created comprehensive translation files for both languages
- Fixed Next.js 15 async params compatibility in layout components
- Updated all components to use proper i18n hooks and translations
- Configured middleware for locale routing and fallbacks
- Fixed FloatingChat component translation array handling
- Restored complete home page with internationalized content
- Fixed Material-UI Slide component prop error (mountOnExit → unmountOnExit)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 15:43:51 +03:00
andupetcu
dd5e1102eb Implement Azure OpenAI vector embeddings for Romanian Bible
- Add pgvector support with bible_passages table for vector search
- Create Python ingestion script for Azure OpenAI embed-3 embeddings
- Implement hybrid search combining vector similarity and full-text search
- Update AI chat to use vector search with Azure OpenAI gpt-4o
- Add floating chat component with Material UI design
- Import complete Romanian Bible (FIDELA) with 30K+ verses
- Add vector search library for semantic Bible search
- Create multi-language implementation plan for future expansion

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 15:18:00 +03:00
andupetcu
3b375c869b Add complete Biblical Guide web application with Material UI
Implemented comprehensive Romanian Biblical Guide web app:
- Next.js 15 with App Router and TypeScript
- Material UI 7.3.2 for modern, responsive design
- PostgreSQL database with Prisma ORM
- Complete Bible reader with book/chapter navigation
- AI-powered biblical chat with Romanian responses
- Prayer wall for community prayer requests
- Advanced Bible search with filters and highlighting
- Sample Bible data imported from API.Bible
- All API endpoints created and working
- Professional Material UI components throughout
- Responsive layout with navigation and theme

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 14:10:28 +03:00