finds.dev← search

// the find

panagiop/node.js-clean-architecture

★ 1,156 · JavaScript · updated Jan 2026

A use case of Clean Architecture in Node.js comprising of Express.js, MongoDB and Redis as the main (but replaceable) infrastructure.

A teaching example of Clean Architecture applied to a Node.js REST API — user/post CRUD with Express, MongoDB, and Redis. It follows Uncle Bob's layering faithfully: entities, use cases, interface adapters, and frameworks are all separated. This is a reference implementation, not a production starter.

The layer separation is genuinely clean — use cases in `application/use_cases/` have no framework imports, and the repository pattern (`postDbRepository.js` as interface, `postRepositoryMongoDB.js` as implementation) makes the dependency inversion concrete rather than theoretical. Docker Compose is included so you can actually run the stack without installing MongoDB and Redis locally. The Redis caching middleware sits in the frameworks layer where it belongs, not tangled into business logic. Unit tests cover both API and use-case layers separately, which is the whole point of this architecture.

It's JavaScript, not TypeScript, which undermines the architecture's main benefit — without types, the interface contracts between layers are invisible and easy to violate accidentally. The test suite is thin: a handful of fixtures and two spec files for posts only, no user or auth tests. The repo hasn't had meaningful updates in years (last substantive work predates 2024) and the ecosystem has moved on — no ESM, no modern Node conventions. Redis is used only for a caching middleware, not modeled as a proper repository in the entity sense, so the 'replaceable infrastructure' claim is only half-true.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →