| Crates.io | revelation-bible |
| lib.rs | revelation-bible |
| version | 0.2.1 |
| created_at | 2025-12-26 09:50:41.738835+00 |
| updated_at | 2026-01-04 03:29:22.322283+00 |
| description | Bible domain for Revelation project |
| homepage | |
| repository | https://github.com/Revelation-Path/revelation-bible |
| max_upload_size | |
| id | 2005508 |
| size | 163,286 |
Domain-driven Bible data types and port traits for Rust applications.
revelation-bible provides a clean, type-safe foundation for building Bible-related applications in Rust. Following hexagonal architecture principles, it separates domain logic from infrastructure concerns:
This allows you to build applications that work with any database, API, or file format by simply implementing the port traits.
Add to your Cargo.toml:
[dependencies]
revelation-bible = "0.1"
With specific features:
[dependencies]
revelation-bible = { version = "0.1", features = ["db", "api", "backend"] }
┌─────────────────────────────────────────────────────────────┐
│ Your Application │
├─────────────────────────────────────────────────────────────┤
│ revelation-bible │
│ ┌─────────────────────┐ ┌─────────────────────────────┐ │
│ │ Domain Types │ │ Port Traits │ │
│ │ ───────────────── │ │ ───────────────────────── │ │
│ │ Book, Verse │ │ BibleRepository │ │
│ │ CrossReference │◄───│ BibleSearch │ │
│ │ SearchResult │ │ BibleCrossReference │ │
│ │ DailyReading │ │ ReadingPlan │ │
│ └─────────────────────┘ └─────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
┌───────────────┼───────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Postgres │ │ REST │ │ JSON │
│ Adapter │ │ API │ │ Files │
└──────────┘ └──────────┘ └──────────┘
| Type | Description |
|---|---|
Book |
Bible book with ID (1-66), names, testament, chapter count |
Verse |
Individual verse with book/chapter/verse coordinates and text |
Testament |
Enum: Old or New testament |
ChapterInfo |
Chapter metadata with verse count |
Pericope |
Section heading at specific verse location |
| Type | Description |
|---|---|
SearchResult |
Verse with highlight positions for matched terms |
VerseRef |
Reference to verse or verse range (e.g., John 3:16-17) |
CrossReference |
Link between two passages with relevance weight |
CrossReferenceExpanded |
Cross-reference with full verse text for display |
| Type | Description |
|---|---|
DailyReading |
Day's assigned verses with date and reading ID |
VerseResponse |
User's written reflection on daily reading |
CreateVerseResponse |
Request DTO for submitting new response |
Port traits define the interface for data access. Implement these in your adapters:
BibleRepositoryCore CRUD operations for Bible data:
pub trait BibleRepository: Send + Sync {
fn get_books(&self) -> impl Future<Output = AppResult<Vec<Book>>> + Send;
fn get_book(&self, id: i16) -> impl Future<Output = AppResult<Option<Book>>> + Send;
fn get_chapter(&self, book_id: i16, chapter: i16) -> impl Future<Output = AppResult<Vec<Verse>>> + Send;
fn get_verse(&self, book_id: i16, chapter: i16, verse: i16) -> impl Future<Output = AppResult<Option<Verse>>> + Send;
// ... more methods
}
BibleSearchFull-text search and symphony (concordance):
pub trait BibleSearch: Send + Sync {
fn search(&self, query: &str, limit: i64) -> impl Future<Output = AppResult<Vec<SearchResult>>> + Send;
fn symphony(&self, word: &str, limit: i64) -> impl Future<Output = AppResult<Vec<SearchResult>>> + Send;
fn word_count(&self, word: &str) -> impl Future<Output = AppResult<i64>> + Send;
}
BibleCrossReferenceCross-reference lookups:
pub trait BibleCrossReference: Send + Sync {
fn get_cross_references(&self, book_id: i16, chapter: i16, verse: i16, limit: i64)
-> impl Future<Output = AppResult<Vec<CrossReferenceExpanded>>> + Send;
fn get_reverse_references(&self, book_id: i16, chapter: i16, verse: i16, limit: i64)
-> impl Future<Output = AppResult<Vec<CrossReferenceExpanded>>> + Send;
fn get_chapter_references(&self, book_id: i16, chapter: i16)
-> impl Future<Output = AppResult<Vec<CrossReference>>> + Send;
}
ReadingPlanDaily reading plan operations:
pub trait ReadingPlan: Send + Sync {
fn get_today(&self) -> impl Future<Output = AppResult<Option<DailyReading>>> + Send;
fn get_for_date(&self, date: NaiveDate) -> impl Future<Output = AppResult<Option<DailyReading>>> + Send;
fn add_response(&self, user_id: Uuid, daily_reading_id: Uuid, content: &str)
-> impl Future<Output = AppResult<Uuid>> + Send;
}
use revelation_bible::{Book, Verse, Testament};
// Create a book reference
let genesis = Book {
id: 1,
name: "Genesis".into(),
name_ru: "Бытие".into(),
abbreviation: "Gen".into(),
testament: Testament::Old,
chapters_count: 50,
};
// Work with verses
let verse = Verse {
id: 1001,
book_id: 43, // John
chapter: 3,
verse: 16,
text: "For God so loved the world...".into(),
};
use revelation_bible::{VerseRef, CrossReference};
// Single verse reference
let john_3_16 = VerseRef::single(43, 3, 16);
// Verse range
let romans_5_1_5 = VerseRef::range(45, 5, 1, 5);
// Cross-reference with relevance weight
let cross_ref = CrossReference {
id: 1,
from: john_3_16,
to: romans_5_1_5,
weight: Some(850), // Higher = more relevant
};
use revelation_bible::ports::BibleRepository;
use revelation_bible::{Book, Verse, ChapterInfo, Pericope, Testament};
use masterror::AppResult;
struct MyBibleAdapter {
// your database connection
}
impl BibleRepository for MyBibleAdapter {
async fn get_books(&self) -> AppResult<Vec<Book>> {
// Your implementation
todo!()
}
async fn get_book(&self, id: i16) -> AppResult<Option<Book>> {
// Your implementation
todo!()
}
// ... implement other methods
}
| Feature | Default | Description |
|---|---|---|
db |
No | Adds sqlx::Type derives for PostgreSQL enum mapping |
api |
No | Adds utoipa::ToSchema derives for OpenAPI documentation |
backend |
No | Enables port traits (requires masterror for error handling) |
# Frontend/WASM - minimal, just types
revelation-bible = "0.1"
# Backend with PostgreSQL
revelation-bible = { version = "0.1", features = ["db", "backend"] }
# Full backend with OpenAPI docs
revelation-bible = { version = "0.1", features = ["db", "api", "backend"] }
We maintain high test coverage to ensure reliability. Below are visual representations of our codebase coverage:
The inner circle represents the entire project. Moving outward: folders, then individual files. Size = number of statements, color = coverage percentage.
Each block represents a file. Size = number of statements, color = coverage level (green = high, red = low).
Hierarchical view: top = entire project, descending through folders to individual files. Size and color represent statements and coverage.
| Crate | Purpose |
|---|---|
serde |
Serialization/deserialization |
uuid |
Unique identifiers (v4, v7) |
chrono |
Date/time handling |
validator |
Input validation |
sqlx |
Database type derives (optional) |
utoipa |
OpenAPI schemas (optional) |
masterror |
Error handling for ports (optional) |
revelation-server - PostgreSQL adapters and REST APIrevelation-user - User domain typesrevelation-songbook - Hymnal domain typesThis project is licensed under the MIT License - see the LICENSE file for details.
Part of the Revelation Project - Building tools for Bible study and worship.