Architecture

Data Stores

Three stores back the platform: MongoDB as the system of record, Redis for caching and queues, and AWS OpenSearch for full-text search.

MongoDB — system of record

Engine
MongoDB 3.4
Access
Mongoose ODM (from the API only)
Connection
MONGODB_URI environment variable
Local port
27017

MongoDB holds all primary data, accessed exclusively through the API's Mongoose models (40 of them). Notable collections include:

Version note
MongoDB 3.4 is well past end-of-life. Any future migration or upgrade should be planned carefully against the Mongoose version pinned in the API. Flagged in Gaps & Open Questions.

Redis — cache & queues

Client
ioredis
Connection
REDIS_URL (defaults to redis://localhost:6379)
Config
config/redis.js in the API repo

Redis provides caching and backs background job queues used by the worker (the API depends on ioredis, mongodb-queue, and mongoose-queue). Connection details are read from REDIS_URL.

AWS OpenSearch — full-text search

Search runs on three separate AWS OpenSearch domains, one per content type. The API indexes documents into them and reads from them for search queries; the worker reconciles any failed indexing operations.

DomainIndexesEnv vars
ArticleArticles & guidesARTICLE_OPEN_SEARCH_API_URL, ARTICLE_OPEN_SEARCH_DOMAIN
BusinessBusiness directory listingsBUSINESS_OPEN_SEARCH_API_URL, BUSINESS_OPEN_SEARCH_DOMAIN
EventEvents & calendarsEVENT_OPEN_SEARCH_API_URL, EVENT_OPEN_SEARCH_DOMAIN

Indexing is implemented in the API's services/search.js and invoked from the article, business, event, and publication controllers. Failed writes are recorded via the FailedIndex model and retried by the worker (see API Worker).