Skip to main content

M02: Content API — v0.2.0-alpha

Version tag: content/v0.2.0-alpha, gateway/v0.2.0-alpha Phase: P0: Foundation Target: Weeks 7–10 (overlaps M01 tail) Sprints: S3 (tail), S4


Phase Context

Goal: Corpus data flows from JSON files through the ingest pipeline into FalkorDB, and the content service serves passage data over HTTP.

Key constraint: Everything downstream depends on this. No reader, no interlinear, no graph view without a working data layer.


ZenHub Configuration

FieldValue
MilestoneM02: Content API
Due Date2026-05-17
Default PipelineProduct Backlog
Primary Epic(s)Content Service API, Gateway Core, Shared Types & SDK

Prerequisites

  • M01: Data Pipeline — FalkorDB client + Stage 3 (scripture text) must complete. Content service queries require ingested data.

Epic: Content Service API

Build out the content service per TECH-SPEC.md § Content Service.

Story AreaScopeSpec Reference
GraphClientFalkorDB connection pool, Redis query cachingTECH-SPEC.md § Content Service
Passage routesGET /passages/{id}, GET /passages/{book}/{chapter}TECH-SPEC.md § API Endpoints
Lexicon routesGET /lexicon/{wordId}TECH-SPEC.md § API Endpoints
Topic routesGET /topics, GET /topics/{slug}TECH-SPEC.md § API Endpoints
Dictionary routesGET /dictionary/{term}TECH-SPEC.md § API Endpoints
Graph routesGET /graph/connections/{nodeId}TECH-SPEC.md § API Endpoints
Response modelsPydantic response models matching the API envelopeTECH-SPEC.md § Response Envelope
Caching layerRedis caching with gl:<resource>:<id> key patternTECH-SPEC.md § Caching Strategy
OpenAPI specAuto-generated by FastAPI at /openapi.json — no hand-authored spec needed
Content service testsUnit tests for graph queries (mocked FalkorDB), integration tests for passage/lexicon/topic routesTECH-SPEC.md § Testing

Issues

IDTitleStatusNotes
M02-001Implement GraphClient with FalkorDB Connection Pool and Redis Query Cache✅ Doneimplemented in PR #901 (2026-04-03)
M02-002Define Pydantic Response Models Matching API Envelope✅ Doneimplemented in PR #901 (2026-04-03)
M02-003Implement Passage Routes✅ Doneimplemented in PR #901 (2026-04-03)
M02-004Implement Lexicon Routes✅ Doneimplemented in PR #901 (2026-04-03)
M02-005Implement Topic Routes✅ Doneimplemented in PR #901 (2026-04-03)
M02-006Implement Dictionary Routes✅ Doneimplemented in PR #901 (2026-04-03)
M02-007Implement Graph Connection Routes✅ Doneimplemented in PR #901 (2026-04-03)
M02-008Implement Redis Caching Layer✅ Doneimplemented in PR #901 (2026-04-03)
M02-009Configure FastAPI OpenAPI Spec Generation✅ Doneimplemented in PR #901 (2026-04-03)
M02-010Content Service Test Suite✅ Doneimplemented in PR #901 (2026-04-03)
M02-011Implement Reverse Proxy to Content Service✅ Doneimplemented in PR #901 (2026-04-03)
M02-012Implement Request ID Middleware✅ Doneimplemented in PR #901 (2026-04-03)
M02-013Implement CORS Middleware✅ Doneimplemented in PR #901 (2026-04-03)
M02-014Implement Rate Limiting Middleware✅ Doneimplemented in PR #901 (2026-04-03)
M02-015Implement Health Check Aggregation✅ Doneimplemented in PR #901 (2026-04-03)
M02-016Gateway Test Suite✅ Doneimplemented in PR #901 (2026-04-03)
M02-017Implement @gospelib/types — Scripture and API Types✅ Doneimplemented in PR #901 (2026-04-03)
M02-018Implement @gospelib/sdk — Client SDK for Content API✅ Doneimplemented in PR #901 (2026-04-03)
M02-019Implement @gospelib/config — Zod Environment Schemas✅ Doneimplemented in PR #901 (2026-04-03)

Progress: 19 Done · 0 Partial · 0 To Do (100%) — All issues completed and verified present in codebase (2026-04-03)


Epic: Gateway Core

Minimal gateway to route traffic to content service. Full auth/billing integration deferred to P3.

Story AreaScopeSpec Reference
Reverse proxyRoute /api/v1/passages/*, /api/v1/lexicon/*, etc. → contentTECH-SPEC.md § Gateway
Request IDGenerate + inject X-Request-ID headerTECH-SPEC.md § Communication
CORSAllow web app originTECH-SPEC.md § Gateway Middleware
Rate limitingBasic sliding-window rate limiter (Redis)TECH-SPEC.md § Gateway Middleware
Health aggregationGateway health check includes downstream service health
Gateway testsTable-driven Go tests for proxy routing, request ID injection, rate limitingTECH-SPEC.md § Testing

Issues

(Issues for this epic are numbered as part of the main M02 issue list above)


Epic: Shared Types & SDK

Story AreaScopeSpec Reference
@gospelib/typesScripture types (Passage, Verse, Chapter, etc.) generated or hand-typed from content OpenAPITECH-SPEC.md § Shared Packages
@gospelib/sdkopenapi-fetch client wired to content service endpointsTECH-SPEC.md § Shared Packages
@gospelib/configZod env schemas for NEXT_PUBLIC_API_URL, etc.TECH-SPEC.md § Shared Packages

Issues

(Issues for this epic are numbered as part of the main M02 issue list above)


Issue Dependency Graph

Content Service Chain:

M02-001 ──► M02-003 ──► M02-009 ──► M02-018
M02-001 ──► M02-004 ──► M02-009
M02-001 ──► M02-005 ──► M02-009
M02-001 ──► M02-006 ──► M02-009
M02-001 ──► M02-007 ──► M02-009
M02-001 ──► M02-008
M02-002 ──► M02-003, M02-004, M02-005, M02-006, M02-007
M02-002 ──► M02-017 ──► M02-018
M02-001..M02-007 ──► M02-010

Gateway Chain:

M02-003 ──► M02-011 ──► M02-015
M02-012 ──► M02-011
M02-011, M02-012, M02-013, M02-014, M02-015 ──► M02-016

Independent:

M02-019 (no internal blockers)

Legend: A ──► B means A blocks B (B is blocked by A)


Document References

DocContainsUse When Writing Stories For
MVP.mdFeature scope, tier breakdown, success criteria, budgetAcceptance criteria, scope boundaries
TECH-SPEC.mdArchitecture, service boundaries, data stores, API catalogTechnical implementation details
GOSPELIB-SCHEMAS.mdAll 7 schema families, node/edge types, validation rulesData models, Pydantic models, graph schema
GOSPELIB-INGEST-SPEC.md7-stage pipeline, Cypher templates, batch strategy, CLIIngest pipeline stories
Deployment & OperationsEnvironments, K8s, CI/CD, migrations, secrets, DRInfrastructure and deployment stories
REPO-MAP.mdDirectory structure, naming conventions, dependency rulesAll stories (coding standards)
BusinessLEGAL.md, POLICY-TERMS.md, executive summary, market research, GTMLaunch readiness, legal/compliance stories

Sprint Mapping

SprintWeeksPrimary Focus
S3 (tail)7–8M01 pipeline completion overlaps — M02 work begins as FalkorDB client and Stage 3 land
S49–10Content service (GraphClient, passage routes), gateway proxy

Sprint Load Warnings

No explicit load warnings for S3–S4. S4 is focused on content service + gateway — a clean sprint boundary.


Release Info

ReleaseTagContains
v0.2.0-alphacontent/v0.2.0-alphaContent API serving passages, lexicon, topics, dictionary, graph queries
v0.2.0-alphagateway/v0.2.0-alphaGateway proxying to content service with request ID, CORS, rate limiting

Relevant Risks

RiskImpactMitigation
FalkorDB performance at corpus scaleSlow content API, bad UXBenchmark after M01; index tuning; caching layer in M02
Ingest pipeline data quality issuesContent API returns bad dataCorpus validation epic in P0; dry-run + schema enforcement

Cross-Cutting Concerns

Testing

LayerFrameworkWhenSpec Reference
Python unit/integrationpytest + testcontainersEvery PRTECH-SPEC.md § Testing
Go unitgo test -race + table-drivenEvery PRTECH-SPEC.md § Testing
TypeScript unitVitestEvery PRTECH-SPEC.md § Testing

Documentation

DocUpdate Trigger
Local Dev SetupM02 complete — document full stack
Adding a ServiceM02 complete — codify established pattern
API OpenAPI specsEach service milestone
ADRsEach major technical decision

CI/CD

AdditionDetail
Nx affected test executionVitest workspace already configured; needs per-project configs

Dependencies

Upstream (what M02 needs)

  • M00: Tech Prep — response envelope utilities, structured logging, health check contract, error code catalog, request ID propagation, OpenAPI spec workflow
  • M01: Data Pipeline — FalkorDB client + Stage 3 (ingested scripture text data)

Downstream (what depends on M02)

  • M03: Scripture Reader — depends on content API serving passage data; @gospelib/sdk wired to content endpoints
  • M05: Search & Staging — search API extends content service
  • M08: Knowledge Graph — constellation view queries graph connections API built here
  • M09: AI Study Assistant — AI needs passage context from content API
  • M10: Monetization — entitlement middleware extends gateway built here

Summary

MetricCount
Total Issues19
Sub-Issues7
Total Estimate (pts)86
SprintsS3–S4
Dependencies (blocking)32
Dependencies (blocked by)33