Module 03 Β· Modules & npm β Lesson 1 of 3 Β· ~9 min
Splitting the app with import/export
One file is where backends go to die
The PawWalk backend has walkers, bookings, auth, payments. Pour all of that into one index.ts and every change means scrolling a 2,000-line file, every merge is a conflict, and nobody can find anything. The fix is modules: one file, one job. A walkers module owns walker code; a bookings module owns booking code; each exports what others may use and keeps the rest private.
A module's exports are its public API. Everything you don't export is private by default β the module's implementation detail. That single rule is how a backend stays understandable at 50 files instead of 5.