# Alex Kondov - Tao of Node - Design, Architecture & Best Practices (Highlights)

## Metadata
**Cover**:: https://readwise-assets.s3.amazonaws.com/static/images/article3.5c705a01b476.png
**Source**:: #from/readwise
**Zettel**:: #zettel/fleeting
**Status**:: #x
**Authors**:: [[Alex Kondov]]
**Full Title**:: Tao of Node - Design, Architecture & Best Practices
**Category**:: #articles #readwise/articles
**Category Icon**:: 📰
**URL**:: [alexkondov.com](https://alexkondov.com/tao-of-node/)
**Host**:: [[alexkondov.com]]
**Highlighted**:: [[2022-03-31]]
**Created**:: [[2022-09-26]]
## Highlights
### Structure & Coding Practices
- A better way to structure a node application is in modules representing a part of the domain. Each is a separate folder containing all handlers, models, tests, and business logic for a part of the business.
### Tooling
- Node’s philosophy is centered around minimalistic tools that provide you with the building blocks to build what you need.
- A query builder is a good alternative that will save you the hassle of binding values but still give you better control over how you fetch your data. Knex is a proven tool that I’m in favor of using when it comes to SQL, and Mongo has its own driver.
- Favor native methods to libraries#
When benchmarked against the native methods, functions in libraries like lodash and underscore have shown to be less performant.
- It’s better to use a structured logger that can output messages in a format digestible by machines.
- The most widely used logger is winston and I think you won’t go wrong if you use it. ... For those that don’t want to use winston, I’d recommend pino - it’s actually the default logger used in fastify (another popular Node framework).
- This is often overlooked, but make sure you pin the NPM packages to the exact version that you’re using. Don’t rely on semantic versioning to ensure that you won’t be getting any breaking changes
- Pure JavaScript lets you move faster when you’re working alone. TypeScript lets you move faster when you’re working in a team. There is no reason not to use it.
- Snyk is a great tool that can warn you about known problems in the libraries that you’re using. The best way to use it is to run it as a step in your CI pipeline and potentially block the release if there’s a vulnerability found.
- To avoid breaking the purity of the functions, I like to import the config object on a higher level in the application and pass the values as parameters to the function. This makes them easier to test.
### Testing
- The tests that produce the most value by far are the integration ones.
### Performance