Timeless Principles for Building REST APIs

Tao of Node

125 rules about architecture, design, testing and performance that apply to any Node.js project — regardless of framework.

6 chapters · 190 pages · $19

Tao of Node Book Cover

Frameworks change. Principles don't.

The JS ecosystem is constantly changing. Libraries come and go, tools evolve and best practices shift. That's why this book focuses only on timeless principles you can apply to any project for years to come. Whether you use Express, Fastify, Hapi, or the next big framework — these rules still apply.

You'll learn how to structure a codebase, where to put business logic, how to test services and what performance practices to follow. No one tells you how to put the pieces together to build real software. I've learned these lessons the hard way so you don't have to.

For developers who know the basics of Node.js and want to build production software.

Principles, not tutorials

Don't
// Avoid handlers with many responsibilities
const handler = async (req, res) => {
const { name, email } = req.body
if (!isValidName(name)) {
return res.status(httpStatus.BAD_REQUEST).send()
}
if (!isValidEmail(email)) {
return res.status(httpStatus.BAD_REQUEST).send()
}
await queryBuilder('user').insert({ name, email })
if (!isPromotionalPeriod()) {
const promotionalCode = await queryBuilder
.select('name')
.from('promotional_codes')
.where({ target: 'new_joiners' })
transport.sendMail({
// ...
})
}
return res.status(httpStatus.CREATED).send(user)
}
Do
// Handlers should only handle HTTP logic
const handler = async (req, res) => {
const { name, email } = req.body
try {
const user = userService.register(name, email)
return res.status(httpStatus.CREATED).send(user)
} catch (err) {
return res
.status(httpStatus.INTERNAL_SERVER_ERROR)
.send()
}
}

What's inside

Architecture

Structure, abstractions and business logic that make a codebase modular and extensible.

Tooling

Frameworks, databases, logging, monitoring and the supporting tools for your next project.

Testing

Principles that help you maintain quality and stability as your application grows.

Performance

Core performance principles to keep your services fast.

Serverless & GraphQL

Best practices for two technologies with great Node.js support.

Scenarios

Common problems and patterns — from extracting a microservice to refactoring existing projects.

Get the book

You buy me lunch and I tell you everything I know about Node & Express.

$19

eBook · 6 chapters · 125+ rules · 190 pages

Not sure? Read a third of the book for free — read by 20K+ people, featured on Hacker News, JS Weekly and Node Weekly.

About the author

Alexander Kondov

Alexander Kondov

Software engineer, writer and author of Tao of React. I've used Node.js in both startups and large corporations and I want to help others learn the best practices around it.

FAQ