web · 2026
SampleREST API Starter Reference
The typed Express and MongoDB foundation we start projects from: validation, error handling, tests and documentation.
app.example.com/overview
- Category
- web
- Year
- 2026
- Stack
- Node.js · Express · TypeScript · MongoDB · Zod · Vitest
Overview
A hardened starter for backend work, covering the decisions that are expensive to change later: response shapes, validation, logging and test structure.
- Demo record — the foundation this website is built on, not a client engagement.
- Published here to document the approach rather than as a product.
The problem
New APIs tend to accumulate inconsistent responses, unvalidated input and no tests, all of which become expensive to fix once clients depend on the behaviour.
The solution
A starter with one response envelope, Zod validation on every route, centralised error handling that never leaks stack traces, structured logging with request ids, and integration tests covering both success and failure paths.
Key features
- Consistent success and error envelopes
- Zod validation for bodies, queries and params
- Helmet, CORS and rate limiting configured
- Integration tests with a real database
Related projects
Building something similar?
Start a Project