Core Package Overview
The@youversion/platform-core package provides type-safe TypeScript API clients for accessing YouVersion Platform services. It’s framework-agnostic with zero React dependencies, making it suitable for server-side, Node.js, or any JavaScript environment.
Installation
Core Clients
The package provides several specialized clients for different API services:ApiClient
HTTP client for making authenticated API requests
BibleClient
Access Bible versions, books, chapters, verses, and passages
LanguagesClient
Get supported languages and their metadata
HighlightsClient
Manage user Bible highlights (requires OAuth)
Quick Start
Architecture
Schema-First Design
All data types are defined using Zod schemas in theschemas/ directory. This provides:
- Runtime validation of API responses
- Type safety with automatic TypeScript types
- Single source of truth for data structures
Client Hierarchy
ApiClient instance in their constructor, allowing them to make authenticated HTTP requests.
Configuration
Your YouVersion Platform App Key obtained from platform.youversion.com
The API host to connect to. Only change this for testing purposes.
Request timeout in milliseconds. Requests will abort after this duration.
Unique identifier for this installation. Used for analytics and tracking.
Type Safety
All API responses are validated against Zod schemas and return strongly-typed data:Error Handling
API errors are thrown as standard JavaScriptError objects with additional properties:
Utility Functions
getAdjacentChapter
Computes the next or previous chapter across book boundaries, with support for intro chapters.Ordered array of Bible books with populated chapters
USFM book ID (e.g., “JHN”, “GEN”, “REV”)
Chapter ID string (e.g., “1”, “2”, “INTRO”)
Navigation direction
{ bookId: string; chapterId: string } | null
Returns the target book and chapter IDs, or null if at Bible boundaries (beginning or end).
Features:
- Handles intro chapters correctly (skips when navigating forward)
- Crosses book boundaries automatically
- Returns
nullat Bible boundaries instead of wrapping
Framework Agnostic
This package has zero React dependencies and can be used in:- ✅ Node.js servers
- ✅ Next.js API routes
- ✅ Express/Fastify backends
- ✅ Browser applications
- ✅ React Native apps
- ✅ Any JavaScript environment
For React applications, consider using @youversion/platform-react-hooks which provides React hooks built on top of this package.
Authentication
Some endpoints (like highlights) require OAuth authentication. See the Authentication guide for implementing PKCE authentication flow.Related Packages
React Hooks
React hooks wrapping these clients with state management
React UI
Pre-built UI components for React applications
Next Steps
BibleClient
Learn about Bible data methods
Authentication
Implement OAuth PKCE flow
API Reference
Browse the complete API reference
