Posts

Image
  Introduction Express.js is great frameworks for making a node.js REST APIs however it doesn’t give you any clue on how to organizing your node.js project. While it may sound silly, this is a real problem. The correct organization of your node.js project structure will avoid duplication of code, will improve stability, and potentially, will help you scale your services if is done correctly. This post is extense research, from my years of experience dealing with a poor structured node.js project, bad patterns, and countless hours of refactoring code and moving things around. If you need help to align your node.js project architecture, just drop me a letter at sam@softwareontheroad.com Table of contents The folder structure 🏢 3 Layer architecture 🥪 Service Layer 💼 Pub/Sub Layer ️️️️🎙️️ Dependency Injection 💉 Unit Testing 🕵🏻 Cron Jobs and recurring task ⚡ Configurations and secrets 🤫 Loaders 🏗️ Example repository The folder structure 🏢 Here is the node.js project structure that