Skip to main content

Storage layer

Chive uses multiple specialized databases, each optimized for different access patterns:

DatabasePurposeDocumentation
PostgreSQLPrimary data store for eprints, reviews, profilesPostgreSQL
ElasticsearchFull-text search, faceted navigationElasticsearch
Neo4jKnowledge graph, citations, field hierarchyNeo4j
RedisCaching, rate limiting, sessionsRedis

Architecture

All storage adapters implement consistent interfaces for dependency injection:

interface IStorageBackend {
connect(): Promise<void>;
disconnect(): Promise<void>;
healthCheck(): Promise<boolean>;
}

Data flow

  1. Write path: Firehose events → Services → PostgreSQL → Async sync to ES/Neo4j
  2. Read path: API → Services → PostgreSQL/ES/Neo4j (based on query type)
  3. Cache: Redis sits in front of expensive queries

See also