Overview
A reference architecture showing how frameworks work internally.
Piedpi is a reference architecture showing how frameworks like Laravel work internally. Explicit middleware, trie-based router, streaming renderer, and minimal database layer.
The framework demonstrates that good architecture doesn't require heavy dependencies.
The problem
MVPs either over-engineer with heavy frameworks or under-engineer with no structure.
MVPs either over-engineer with heavy frameworks or under-engineer with no structure. Developers need a middle ground that teaches correct architectural habits.
- Heavy frameworks add unnecessary complexity for simple MVPs.
- Raw PHP leads to spaghetti code and security issues.
- Developers need to understand framework internals, not just use them.
Approach
Explicit middleware applied manually per route with streaming renderer.
Built explicit middleware applied manually per route. Created a trie-based router, streaming renderer with Blade-like templates, and a minimal PDO-based database layer.
The approach prioritizes explicitness over magic, making the request lifecycle transparent and debuggable.
Solution
Clear separation with first-class 404/500 routing and output streaming.
Separated concerns into app/, config/, routes/, and db/. Router treats 404/500 as first-class routing concerns. Renderer supports view and template modes with output streaming.
The architecture scales from MVP to serious systems while maintaining clarity at every layer.
Implementation
Technical implementation.
Built with PHP 8.1+ features, the framework uses PDO for database access and provides a clean separation of concerns.
Core
PHP 8.1+, PDO, trie-based router with explicit middleware support.
Middleware
Auth, CSRF, CORS middleware applied explicitly per route.
Rendering
Streaming renderer with Blade-like templates, widget system, Docker support.
Results
What changed.
The framework provides a clear, scalable architecture with zero external dependencies and comprehensive documentation.
Links