Skip to content

From MVC to Clean Architecture: what happens to your Model?

You have been doing MVC for ten years. Someone drops "Clean Architecture" in a meeting. You nod.

But concretely, what becomes of your Model?

With the MVC pattern, business logic, persistence and validation all live in the Model. As the project grows, you end up with 500-line models and overloaded controllers.

Phexium breaks down each responsibility:

  • Model => Entity + Repository + Value Object
  • View => Presenter + ViewModel + Template
  • Controller => Controller + Command + Handler

The Entity carries the business rules. The Repository handles persistence behind an interface. The Controller only deals with HTTP.

You test your entity without a database. You test your controller without business logic. You develop your business logic without having chosen your database, the infrastructure decision comes later, when you have real needs.

The framework supports two execution modes for controllers:

  • Direct UseCase for a homepage or a simple dashboard.
  • CQRS with Command Bus for complex business cases (transactions, events, middleware).

You choose module by module.