Module 12 · Week 14

Code structure and refactoring

Turn a folder of experiments into a codebase you can grow.

  1. The problem: one folder, fifteen files
  2. The target structure
  3. Naming files so anyone can find them
  4. From import to require (ESM → CommonJS)
  5. One place for settings: config
  6. Create clients once
  7. Services: one job each
  8. Tools: one file each, plus a registry
  9. The agent: graph + service
  10. The full code: the remaining pieces