March 2025. Before writing the modular system, sat down and wrote documentation.
Not after the code. Before.
List
- ARCHITECTURE.md - overall structure
- MODULE-SYSTEM.md - how modules work
- DEPENDENCY-INJECTION.md - DI container
- SECURITY.md - authentication, authorization
- API-CONVENTIONS.md - REST endpoints, response format
- DATABASE.md - schema, migrations, relations
- ERROR-HANDLING.md - error codes, format
- LOGGING.md - what we log, where, format
- TESTING.md - how to write tests
- DEPLOYMENT.md - how to deploy
- CONFIGURATION.md - environment variables
- PLUGIN-SYSTEM.md - how to write plugins
Why before code
While writing the document - you think. Find holes in logic. Realize what you forgot.
Wrote "module registers in container" - but how exactly? Had to think through the API. Before writing code.
Result
When I sat down to code - already knew what to do. Document open, writing according to it. Not making things up on the fly.
AI also helps better when there's documentation. Share ARCHITECTURE.md - it understands the context.