A TypeScript project exploring the Model-Controller-Presenter (MCP) architectural pattern, which offers a modern take on the traditional MVC pattern while providing better separation of concerns and testability.
The Model-Controller-Presenter (MCP) pattern is an architectural pattern that builds upon the concepts of MVC but addresses some of its limitations. Think of it as a restaurant where:
- Model (The Kitchen): Handles all the business logic and data, just like a kitchen prepares the food
- Controller (The Waiter): Manages user input and orchestrates the flow between Model and Presenter, like a waiter taking orders and delivering food
- Presenter (The Plating Chef): Formats the data for display and handles view logic, similar to how a plating chef makes the food presentable
- Clear separation of concerns
- Enhanced testability through dependency injection
- Better maintainability with isolated components
- Reduced coupling between UI and business logic
- Improved code reusability
src/
├── models/ # Business logic and data structures
├── controllers/ # Input handling and flow control
├── presenters/ # View logic and data formatting
├── views/ # UI components (interfaces only)
└── types/ # TypeScript type definitions
- Clone this repository
- Install dependencies:
npm install - Run tests:
npm test - Start development server:
npm start
- TypeScript
- Jest for testing
- ESLint for code quality
- Prettier for code formatting
This is a test project for exploring the MCP pattern. Feel free to experiment and submit PRs for improvements or interesting implementations.
MIT