What Is MVC (Model-View-Controller) Architecture?
MVC splits an application into three interconnected parts: the Model (data and business logic), the View (what the user sees), and the Controller (handles in...
Published October 7, 2026
MVC splits an application into three parts: the Model (data and business rules), the View (what the user sees) and the Controller (handles input and connects the two). Separating them keeps code organised and testable.
The concept
A request reaches the Controller, which asks the Model for data or to perform an action, then selects a View to render the result.
Frameworks like Laravel, Rails and Spring MVC follow this layout. Keep controllers thin and put business logic in models or services.
Request flow
Practical examples
Laravel route to controller
Route::get('/posts/{id}', [PostController::class, 'show']);Controller
class PostController {
public function show($id) {
$post = Post::findOrFail($id);
return view('posts.show', compact('post'));
}
}View
<h1>{{ $post->title }}</h1>Common mistakes
- Fat controllers full of business logic.
- Querying the database inside views.
- Models that know about HTTP requests.
Key takeaways
- Model = data/rules, View = output, Controller = glue.
- Keep controllers thin.
- Views should not contain logic.
FAQ
MVC vs MVVM?
MVVM binds a view-model to the view automatically, common in front-end frameworks.
Is React MVC?
No, it is a view library; MVC-like structure is up to you.