Redis and SQLite

Redis, SQLite, and Other Complements

Most other stores in a MERN system are complements, not competitors: they take a workload MongoDB 1,815 handles adequately and do it an order of magnitude better.

Redis 2,763 and Valkey 251,210 . An in-memory structure server for sessions, rate limiters, job queues and caches. Licensing changed twice: Redis was BSD-3-Clause through 7.2, moved to RSALv2 or SSPLv1 with 7.4, and since 8.0.0 is tri-licensed RSALv2, SSPLv1 or AGPLv3, which restores an OSI-approved option. Valkey is the Linux Foundation fork that stayed BSD-licensed, currently 9.1.x, and is API-compatible — the drop-in answer if your legal team objects to SSPL.

A cache-aside read in front of a MongoDB collectionJavaScript
// docker run -d -p 6379:6379 valkey/valkey:9   &&   npm install iovalkey
import Valkey from 'iovalkey';
const cache = new Valkey('redis://127.0.0.1:6379');
export async function getProduct(db, sku) {
  const hit = await cache.get(`product:${sku}`);
  if (hit) return JSON.parse(hit);
  const doc = await db.collection('products').findOne({ sku });
  if (doc) await cache.set(`product:${sku}`, JSON.stringify(doc), 'EX', 300);
  return doc;
}

SQLite 4,756 . The most widely deployed SQL engine there is: it ships in every Android, iOS, macOS and Windows 10/11 device, in Firefox 555 , Chrome 1 and Safari 10 , and inside PHP and Python, and the project estimates over a trillion active databases. In a MERN project it fits a CLI tool's local state, a desktop build, or a test fixture that must not require a server. It is a library, not a service: one writer at a time, no network protocol — a feature until two application servers need the same file.

Object storage. S3-compatible storage is where files belong. GridFS works (GridFS), but it spends database space, backup time and replication bandwidth on bytes a bucket serves far more cheaply.

Running four data stores is not sophistication, it is four things to back up, monitor and patch. A cache in front of MongoDB usually earns its keep; a fourth store for one feature usually does not.