Bible API
A modern, asynchronous REST API supporting muliple versions including the 81-book Ethiopian Church canon, built with Python 3.13, FastAPI, PostgreSQL, and Redis.
Overview
The Bible API is an open-source backend service designed to provide programmatic access to the biblical canon of different Language.
Architecture & Technology Stack
The service is built around a fully asynchronous Python stack engineered for high concurrency, low latency, and predictable operational deployment:
- Python 3.13 & uv: Managed with Astral’s
uvpackage manager for fast, reproducible dependency resolution and lockfile freezing (uv.lock). - FastAPI: Provides OpenAPI 3.1/Swagger autodocumentation, high-performance async request handling, and strict Pydantic v2 data validation schemas.
- PostgreSQL 15 & asyncpg: Relational persistence utilizing SQLAlchemy 2.0 with the high-throughput
asyncpgdriver andAsyncSessioncontext managers. - Alembic: Database migration pipeline managing version-controlled relational schema changes across environments.
- Redis 7: In-memory caching layer via
redis.asynciowith connection pooling to cache frequently queried books, chapters, and verse sets. - Docker & Docker Compose: Multi-container orchestrator providing local parity with isolated network topologies for the API, Postgres database, and Redis cache.
Technical Highlights
1. Fully Asynchronous Pipeline
Every I/O boundary — from relational database queries to Redis cache reads and writes — is non-blocking. Database connections are injected using FastAPI dependencies:
2. Standardized Pagination & Query Patterns
To efficiently handle large scripture queries across chapters and verses, the core engine implements a generic pagination schema Page[T] with bounded query limits:
3. Containerized Reproducibility
The application uses a lightweight multi-stage Docker build with frozen uv syncing for rapid cold starts and predictable production behavior:
What’s Next
- Multi-Language Alignments: Parallel verse endpoints supporting Ge’ez (ግዕዝ), Amharic (አማርኛ), and English translations.
- Full-Text Morphological Search: PostgreSQL TSVector with custom analyzers for Ethiopic Fidel scripts.
- Public API Cloud Deployment: Live hosted instance with Redis token-bucket rate limiting for open developer access.