Live APIBackend API design

customizable caching api

A REST API for configurable cache behavior, size limits, documentation, and predictable invalidation.

Customizable Caching API

Problem

Caching logic often ends up scattered through applications. This project isolates cache operations behind a clear API with constraints and documentation.

Architecture

  • Express routes expose cache create, read, update, and delete operations.
  • Redis handles fast key-value access and expiration behavior.
  • PostgreSQL and Prisma support persisted metadata where needed.
  • API documentation gives consumers a direct way to inspect behavior.

Key decisions

  • Kept the API RESTful so behavior is easy to test with common tooling.
  • Added size constraints to make cache behavior explicit instead of unbounded.
  • Documented endpoints alongside the deployed API to reduce integration friction.

Tradeoffs

  • A generic cache API is flexible, but product-specific cache rules still need application-level decisions.
  • Redis improves response time, but operational correctness depends on expiration and invalidation design.

What I learned

  • Good cache systems need constraints as much as speed.
  • Documentation is part of the backend interface, not a separate afterthought.

Stack

Node.jsExpress.jsPostgreSQLPrisma ORMREST APIRedis
Open project