A modern React-based web application for reading the Vietnamese Bible translation "Kinh Thánh Bản Dịch 2011" (KTBD 2011).
Live site: https://ktbd2011.com/
- 📖 Complete Old and New Testament with all 66 books
- 📱 Mobile-responsive design optimized for all screen sizes
- 🔄 Tab-based navigation (Read & About sections)
- 📚 Accordion-style book and chapter navigation
- ⚡ Fast loading with Vite bundling
- � Smart local storage caching with 5-minute refresh intervals
- 🌐 Offline support with fallback to cached content
- 🚀 Optimized performance with TanStack Query (React Query v5)
- 🎨 Bootstrap 5 UI components with custom styling
- 📡 Real-time online/offline status monitoring
- React 18 - Modern React with hooks and concurrent features
- TypeScript - Type-safe development
- Vite 4 - Lightning-fast build tool and dev server
- React Bootstrap 2.10 - UI component library
- React Router v6 - Client-side routing with modern API
- TanStack Query v5 (React Query) - Server state management
- Axios - HTTP client for API requests
- Local Storage API - Client-side caching and offline support
- Firebase Hosting - Fast, secure web hosting
- Firebase Tools - Deployment automation
- TypeScript 5 - Static type checking
- Vite - Module bundler and development server
- Bootstrap 5 - CSS framework
The application implements a sophisticated caching and offline strategy:
- 5-minute cache expiry - Fresh content while maintaining performance
- Offline-first approach - Always check local storage before network requests
- Graceful degradation - Falls back to cached content when offline
- Intelligent cache invalidation - Automatic refresh cycles
- Online detection - Monitors network connectivity status
- Timeout handling - 5-second request timeout with fallback
- Error resilience - Uses cached data when network requests fail
- Background updates - Refreshes data while showing stale content
- Stale-while-revalidate - Shows cached data instantly, updates in background
- Infinite cache retention -
gcTime: Infinity
for offline support - Smart refetching - On window focus, network reconnect, and intervals
- Type-safe queries - Full TypeScript integration
- Node.js (v18 or higher)
- npm or yarn package manager
- Clone the repository:
git clone https://github.com/quangnguyen17/ktbd2011.git
cd ktbd2011
- Install dependencies:
npm install
# or
yarn install
- Start the development server:
npm run dev
# or
yarn dev
The application will be available at http://localhost:3000
npm run dev
- Start development servernpm run build
- Build for productionnpm run preview
- Preview production build locallynpm run typecheck
- Run TypeScript type checkingnpm run deploy
- Build and deploy to Firebase
npm run build
Deploy to Firebase Hosting:
npm run deploy
ktbd2011/
├── public/ # Static assets
│ └── app-icon.png # Application icon
├── src/
│ ├── About.tsx # About page component with app information
│ ├── Read.tsx # Main Bible reading component with accordion UI
│ ├── index.tsx # Application entry point with routing and providers
│ ├── hooks.ts # TanStack Query hooks for data fetching
│ ├── dataSource.ts # Bible books metadata and structure
│ ├── storage.ts # Local storage utilities and caching logic
│ ├── index.css # Global styles and custom CSS
│ └── react-app-env.d.ts # TypeScript environment declarations
├── firebase.json # Firebase hosting configuration
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── tsconfig.node.json # TypeScript config for Node.js tools
├── vite.config.ts # Vite build configuration
└── index.html # HTML entry point
- Sets up React Query provider with optimized configuration
- Implements React Router with tab-based navigation
- Defines main layout with
TabBar
component - Handles route management and navigation state
- Renders complete Old and New Testament books
- Implements nested accordion UI for books and chapters
- Handles dynamic content loading with React Query hooks
- Provides intuitive chapter-by-chapter reading experience
- Displays app information and author details
- Provides links to iOS and Android native apps
- Contains contact information and acknowledgments
- Bottom navigation bar with active state highlighting
- Responsive design for mobile-first experience
- Clean, accessible tab switching interface
// Core hooks available:
useBook(testamentId: string, filename: string) // Fetch individual book content
useOldTestament() // Get Old Testament metadata
useNewTestament() // Get New Testament metadata
useOnlineStatus() // Monitor connectivity
LocalStorage.getBook()
- Retrieve cached book contentLocalStorage.setBook()
- Store book content with timestampLocalStorage.isCacheValid()
- Check cache expiry status- 5-minute cache TTL with timestamp-based validation
- Complete metadata for all 66 Bible books (39 Old Testament, 27 New Testament)
- Vietnamese book names and corresponding JSON filenames
- Testament organization and book ordering
- Initial Load: Check local storage for cached content
- Online Check: Verify network connectivity status
- Network Request: Fetch fresh data from Google Cloud Storage
- Cache Update: Store new content in local storage with timestamp
- Fallback: Use cached data if network request fails
- Background Refresh: Update data every 5 minutes while showing stale content
- Network timeouts: 5-second timeout with graceful fallback
- Offline mode: Automatic fallback to cached content
- Missing cache: Clear error messaging when no offline data available
- Retry logic: 2 automatic retries for failed requests
- React plugin enabled
- Development server on port 3000
- Optimized build output for production
- Static hosting from
dist
directory - SPA routing with catch-all rewrites
- Optimized for single-page application behavior
- Strict type checking enabled
- Modern ES modules support
- React JSX transformation
- Code Splitting: Automatic route-based splitting
- Tree Shaking: Unused code elimination
- Minification: Optimized production bundles
- Caching Headers: Browser and CDN optimization
- Local Storage: Reduced network requests
- Background Updates: Non-blocking data refresh
We welcome contributions to improve the KTBD 2011 application! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes following the existing code style
- Test your changes thoroughly
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature/your-feature-name
- Submit a pull request
- UI/UX improvements
- Performance optimizations
- Accessibility enhancements
- Mobile experience improvements
- Additional language support
- Testing coverage
- Modern Browsers: Chrome, Firefox, Safari, Edge (latest versions)
- Mobile Browsers: iOS Safari, Chrome Mobile, Samsung Internet
- Progressive Web App: Installable on mobile devices
- Offline Support: Full functionality without internet connection
This project is licensed under the MIT License - see the LICENSE file for details.
- KTBD 2011 Vietnamese Bible translation
- MS Đặng Ngọc Báu - Lead translator and project maintainer
- Email: [email protected]
- Facebook: MS Đặng Ngọc Báu
- React Team - React framework and ecosystem
- TanStack - Query library for data synchronization
- Vite Team - Build tool and development experience
- React Bootstrap - UI component library
- Firebase - Hosting and infrastructure
- TypeScript - Type safety and developer experience
- iOS App: Kinh Thánh BD2011 on App Store
- Android App: Kinh Thánh BD2011 on Google Play Store
For questions, suggestions, or technical support:
- Project Repository: https://github.com/quangnguyen17/ktbd2011
- Bible Translation Contact: [email protected]
- Live Application: https://ktbd2011.com/
"Cầu xin Chúa dùng Bản Dịch Kinh Thánh này làm vui thỏa tâm linh các bạn với Lời hằng sống của Đức Chúa Trời."
"May the Lord use this Bible translation to satisfy your soul with the living Word of God."