Skip to content

Proposal: Rebuild Codebase Due to Core Architectural Deficiencies #259

@dtpthao

Description

@dtpthao

Main problems:

  • Some handling functions in the codebase read environment variables directly instead of receiving configuration from the main initialization => this scatters configuration logic, tightly couples handlers to the environment, and makes testing and maintenance harder. Centralizing environment loading in main and passing values down would improve structure and reliability.
Image
  • No structured logging is implemented — there are no access logs, no log levels, and all output is plain text => it makes issues hard to diagnose, prevents filtering important events, and limits visibility into system behavior. It also complicates monitoring, alerting, and auditing, especially in production environments.

  • Improper use of global variables (such as a global DB instance) and hardcoded secrets => it creates hidden dependencies, makes the code harder to test, increases the risk of security leaks, and reduces maintainability. Secrets should be externalized, and shared resources should be passed explicitly to avoid unintended side effects.

Image

Conclusion: Refactoring the existing codebase would require redesigning core components such as configuration handling, logging, dependency management, and secret management. These issues are deeply embedded in almost every module, making incremental fixes risky, time-consuming, and more expensive than starting fresh. A new codebase allows us to establish proper architecture, enforce clean patterns from the beginning, reduce technical debt, and ensure long-term maintainability and security.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

🏗 Implementation

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions