How We Write Full Stack JavaScript Apps

Keep It Simple

Keep Similar Items Nearby (Colocation)

In general, it is a good idea to keep files that often change together close to each other. This principle is called “colocation”.

│ app.js # App entry point
└───api # Express route controllers for all the endpoints of the app
└───config # Environment variables and configuration related stuff
└───jobs # Jobs definitions for agenda.js
└───loaders # Split the startup process into modules
└───models # Database models
└───services # All the business logic is here
└───subscribers # Event handlers for async task
└───types # Type declaration files (d.ts) for Typescript

Don’t Rewrite Types

This is here so I could add a cover photo :). Image taken from here:

Generate Code Wherever Possible

Autoformat Code


About Me




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store