Most REST API performance issues in Node.js apps don’t happen because of heavy queries.
They happen because we send the entire database model down the wire when the client only needs two fields.
Here is what usually happens:
• Database returns 50 columns with nested relations.
• Mongoose or TypeORM serializes the whole object graph.
• JSON.stringify blocks the Node.js event loop for 40ms.
• Network bandwidth gets wasted on metadata the client discards.
Fixing this isn't about rewriting in Rust or upgrading your AWS instance.
It’s about intentional API design:
- Project your queries strictly at the SQL/ORM level using DTOs or explicit selects.
- Apply pagination limits by default — never trust
SELECT *. - Profile your JSON serialization overhead using clinic.js or built-in node --prof.
Fast APIs are built by moving less data, not just writing faster algorithms.
What’s the largest JSON payload you've ever had to debug in production? Let's discuss in the comments.
Top comments (0)