Building a Modern KJV Bible App
A behind-the-scenes look at how Premier Dev Solutions built a production-ready KJV Bible reading app, covering architecture, database design, search, and lessons learned.
Introduction
At Premier Dev Solutions, we build custom software for clients, and this is one we built for ourselves. Here's a behind-the-scenes look at how we built a KJV Bible reading app from scratch using Next.js and Supabase. It now runs on Next.js 16 and React 19.
If you're a nonprofit, a church or a business owner considering a custom web application, this breakdown shows what modern custom development looks like in practice: the architecture decisions, the tradeoffs and the results.
The goal was simple: make reading and studying the Bible quick and easy in a browser. Here's how we did it.
The Tech Stack
We picked a stack built for fast page loads and safe, quick development:
Core Framework
- Next.js 16.1.6 (App Router): server-side rendering and fast page loads
- React 19.2.4: component-based UI
- TypeScript 5.6.3: type safety across the codebase
We first built the app on Next.js 15.1.5 and React 18.3.1, then upgraded it to Next.js 16 and React 19 on February 26, 2026.
Styling & UI
- Tailwind CSS 4.1.3: utility-first styling
- Radix UI: 20+ accessible, unstyled UI primitives
- Lucide React: icon library
- class-variance-authority: type-safe component variants
Database & Backend
- Supabase: PostgreSQL database with real-time capabilities
- @supabase/supabase-js 2.75.0: JavaScript client library
Additional Tools
- react-hook-form: form handling
- sonner: toast notifications
- next-themes: dark and light mode
Database Architecture
Two-Table Design
The app runs on two tables in Supabase:
1. bible_books Table
Stores metadata about each book of the Bible:
{
book_id: number, // Unique identifier
book_name: string, // E.g., "Genesis", "Matthew"
testament: string, // "Old Testament" or "New Testament"
seq_number: number // Sequential ordering (1-66)
}
This table keeps the books in canonical order and drives navigation.
2. bible_books_and_verses Table
Stores the scripture text itself:
{
book_name: string, // E.g., "Genesis"
book_chapter: number, // Chapter number
verse_number: number, // Verse number
verse_text: string // The actual verse content
}
This table holds over 31,000 verses, and queries use indexed columns for book name and chapter number.
Supabase Configuration
The database client is configured in src/lib/supabase.ts:
import { createClient } from "@supabase/supabase-js";
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
export const supabase = createClient(supabaseUrl, supabaseAnonKey);
Key Features & Implementation
1. Bible Search
Search uses PostgreSQL ILIKE pattern matching through Supabase's .ilike() method, which ignores case:
const searchVerses = async (query: string) => {
const { data, error } = await supabase
.from("bible_books_and_verses")
.select("book_name, book_chapter, verse_number, verse_text")
.ilike("verse_text", `%${query}%`) // Wildcard pattern matching
.limit(100)
.order("book_name")
.order("book_chapter")
.order("verse_number");
// Transform and return results...
};
How search behaves:
- Case-insensitive matching with a
%${query}%pattern - Capped at 100 results to keep responses small
- Results ordered by book, then chapter, then verse
- Each result includes the full verse text
This is simple pattern matching, not PostgreSQL full-text search. A later version could use ts_vector and ts_query for better search results.
2. Chapter Reading
Readers can browse by book and chapter:
const fetchChapter = async (book: string, chapter: number) => {
const { data, error } = await supabase
.from("bible_books_and_verses")
.select("book_name, book_chapter, verse_number, verse_text")
.eq("book_name", book) // Filter by book
.eq("book_chapter", chapter) // Filter by chapter
.order("verse_number"); // Sequential ordering
return transformedVerses;
};
What this covers:
- Chapter loading through indexed queries
- Verses in order
- Loading skeletons while a chapter loads
- Click any verse to expand to its full chapter
3. Contextual Reading
Click any verse and the app shows it inside its full chapter:
const handleFetchChapter = async (book: string, chapter: number) => {
const { data, error } = await supabase
.from("bible_books_and_verses")
.select("book_name, book_chapter, verse_number, verse_text")
.eq("book_name", book)
.eq("book_chapter", chapter)
.order("verse_number");
return mappedVerses;
};
Readers see a verse in context without losing their place.
4. Favorites System
Favorites use client-side state in React:
// State management
const [favorites, setFavorites] = useState<Set<string>>(new Set());
const [favoriteVerses, setFavoriteVerses] = useState<Verse[]>([]);
// Toggle favorite with unique key
const handleToggleFavorite = (verse: Verse) => {
const key = `${verse.book}_${verse.chapter}_${verse.verse}`;
const newFavorites = new Set(favorites);
if (newFavorites.has(key)) {
newFavorites.delete(key); // Remove from favorites
} else {
newFavorites.add(key); // Add to favorites
}
setFavorites(newFavorites);
};
Each verse gets a key like "Genesis_1_1" for Genesis 1:1.
Right now favorites live in React state only, so they're lost when the page refreshes. Saving them to localStorage or Supabase is the next step.
5. Topics Organization
Readers can create their own topics to group verses by theme:
interface Topic {
id: string; // Timestamp-based ID
title: string;
description: string;
verses: Verse[];
createdAt: Date;
}
const handleCreateTopic = (
topicData: Omit<Topic, "id" | "createdAt">,
) => {
const newTopic: Topic = {
...topicData,
id: Date.now().toString(),
createdAt: new Date(),
};
setTopics([...topics, newTopic]);
};
With topics, readers can:
- Create a topic with a title and description
- Add verses from their favorites
- Search for new verses and add them directly
- Remove verses or delete a whole topic
- Copy or share a topic
Like favorites, topics only last for the session. They aren't saved to the database yet.
Component Architecture
Each part of the interface is its own component:
Main Components
page.tsx (Root Component)
- Holds the state for favorites, topics and navigation
- Passes data between the other components
- Handles tab routing and user interactions
BibleHeader.tsx (Navigation)
- Tab navigation (Read, Books, Favorites, Topics)
- Search bar with form submission
- Book and chapter selection dropdowns
- Loads Bible books from Supabase on mount
VerseDisplay.tsx (Read Tab)
- Display verses with loading skeletons
- Expandable verse context (click to see full chapter)
- Favorite/copy/share actions per verse
- Highlighted selected verse in context view
BooksExplorer.tsx (Books Tab)
- Three-level navigation: Testament, then chapters, then verses
- Grid layout for chapter selection
- Hardcoded Bible structure (66 books + 18 Apocrypha)
- Full chapter display with verse actions
Favorites.tsx (Favorites Tab)
- Display all favorited verses
- Remove favorites
- Copy/share individual verses
- Empty state prompts
Topics.tsx (Topics Tab)
- Create and manage custom topics
- Add verses from favorites or search
- Inline search for new verses
- Expandable editing interface
- Topic-level and verse-level actions
Custom Hooks
useBibleApi.ts
export function useBibleApi() {
return {
verses: Verse[],
loading: boolean,
error: string | null,
fetchChapter: (book, chapter) => Promise<void>,
searchVerses: (query) => Promise<void>
};
}
This hook keeps all the database queries and loading states in one place.
Performance Considerations
Current Optimizations
Loading states
- Skeleton loaders prevent layout shift
- Loading indicators for async operations
State management
Set<string>for O(1) favorites lookup- Key-based verse identification
Query limits
- Search capped at 100 results
- Keeps data transfer small
Conditional rendering
- Only the active tab's component renders
- Fewer unnecessary re-renders
Opportunities for Improvement
No caching
- Every navigation refetches from Supabase
- React Query or SWR could cache results
- No localStorage for frequently read chapters
No memoization
useMemofor expensive computationsuseCallbackfor event handlers passed to childrenReact.memofor pure components
No live search
- Search fires on form submit only
- A debounced live search could be added
No pagination or virtualization
- All 100 search results render at once
- Virtual scrolling would help with long result lists
No offline support
- No service worker or PWA capabilities
- Chapters could be cached for offline reading
Lessons Learned & Best Practices
What Worked Well
- Simple Database Schema: two tables are enough for a Bible app
- Component Separation: clear responsibilities make maintenance easy
- TypeScript: caught many bugs before runtime
- Radix UI: accessible components out of the box
- Tailwind CSS: quick UI development
What We'd Change
- Add Data Persistence: localStorage or Supabase for favorites and topics
- Implement Full-Text Search: PostgreSQL
ts_vectorfor better search - Add Caching: React Query for data fetching and caching
- Memoize Components: fewer unnecessary re-renders
- Move Chapter Counts to DB: remove the hardcoded Bible structure
Future Enhancements
Planned Features
- User Authentication: save favorites and topics to user accounts
- Notes & Highlights: let readers annotate verses
- Reading Plans: guided reading schedules
- Cross-References: link related verses
- Multiple Translations: add ESV, NIV and NKJV
- Audio Bible: listen to scripture
- Offline Mode: PWA with a service worker
- Social Sharing: share verses as images
Technical Improvements
- Implement PostgreSQL full-text search with ranking
- Add React Query for caching
- Use virtual scrolling for long lists
- Reduce bundle size with code splitting
- Add automated testing (Jest, React Testing Library)
- Add analytics to understand how people use the app
What This Means for Your Custom Project
Building this app took the same work we do on client projects at Premier Dev Solutions: database design, API design, component structure, performance tuning and thinking through how people will actually use it.
If you need a booking system, a client portal, a custom dashboard or another web application specific to your business, this is the level of technical detail we bring to the build.
Custom development isn't only for large companies. With the right team and a clear scope, a custom application can be built efficiently and at a reasonable cost, and it will fit your use case better than a template or plugin made for everyone.
Conclusion
This project shows how much careful architecture and a simple interface can do for reading and studying scripture.
Our KJV Bible App handles over 31,000 verses with search, book and chapter navigation, and favorites and topics for organizing verses, all built on Next.js 16, React 19 and Supabase.
There's still room to improve (persistence, caching, better search), but the current version is a solid foundation for a production-ready Bible reading app.
Try the app: https://kjv-bible-app.vercel.app/
View the source: Available upon request for educational purposes.
About Premier Dev Solutions
Premier Dev Solutions is a Charleston, SC web development agency building custom websites and web applications for businesses and nonprofits.
We work with WordPress, Shopify, Wix, React, Next.js, TypeScript, ASP.NET Core, Supabase and Microsoft Power Platform, and we scope each project to fit your goals and budget.
Every project includes 30 days of post-launch support. You can see more of our work or book a call to talk through your project.

