# Architecture Principles

## 1. Keep Business Logic Separate

Business rules should not live inside:

- Controllers.
- React components.
- Database models.

---

# 2. Single Responsibility

Classes and components should have one purpose.

---

# 3. Prefer Composition

Create reusable services.

Avoid giant classes.

---

# 4. Backwards Compatibility

Existing functionality should continue working during migrations.

---

# 5. Explicit Over Clever

Readable code is preferred over complex abstractions.

---

# 6. Test Important Logic

Prioritise testing:

- Business rules.
- AI workflows.
- Document generation.
- Authentication.