Introduction to Horse
Horse is an Express.js-inspired web framework for Delphi and Lazarus, designed to ease development with a minimalist approach while delivering high performance. Built for modern Pascal development, Horse enables you to create RESTful APIs and web services quickly and efficiently.Why Horse?
Horse brings the simplicity and elegance of modern JavaScript frameworks to the Delphi/Lazarus ecosystem:Express-Inspired
Familiar routing and middleware patterns inspired by Express.js, making it intuitive for developers coming from Node.js
High Performance
Optimized for speed with efficient request handling and minimal overhead
Minimalist Design
Clean, simple API that gets out of your way and lets you focus on building features
Cross-Platform
Works seamlessly with both Delphi (XE7+) and Lazarus/Free Pascal
Key Features
Simple Routing
Define routes with a clean, chainable API:Middleware Support
Extend functionality with middleware for authentication, logging, CORS, compression, and more:Multiple HTTP Methods
Support for all standard HTTP methods:Flexible Deployment
Horse supports multiple deployment scenarios:- Console Application - Standalone server
- VCL Application - Windows GUI application
- Windows Service - Background service
- ISAPI - IIS integration
- Apache Module - Apache web server
- CGI/FastCGI - Traditional CGI deployment
- Daemon - Linux/Unix daemon (Lazarus)
Architecture
Horse follows a simple request-response cycle with middleware support:Core Components
- THorseRequest - Encapsulates incoming HTTP requests with access to headers, query parameters, body, cookies, and route parameters
- THorseResponse - Handles outgoing responses with methods for sending content, setting status codes, headers, and redirects
- THorseCallback - Procedure type for route handlers and middleware
- Routing Engine - Fast route matching with parameter extraction
- Middleware System - Extensible request/response processing pipeline
Comparison to Other Frameworks
| Feature | Horse | Traditional CGI | Raw ISAPI |
|---|---|---|---|
| Routing | Built-in with parameters | Manual parsing | Manual parsing |
| Middleware | Yes | No | No |
| JSON Support | Via middleware | Manual | Manual |
| Ease of Use | High | Low | Low |
| Performance | High | Medium | High |
| Code Clarity | Very High | Low | Medium |
Ecosystem
Horse has a rich ecosystem of official and community middleware:Official Middleware
- horse/json - JSON request/response handling
- horse/cors - Cross-Origin Resource Sharing
- horse/jwt - JSON Web Token authentication
- horse/basic-auth - Basic authentication
- horse/logger - Request logging
- horse/compression - Response compression
- horse/exception - Exception handling
- horse/stream - Stream handling
Community Middleware
The Horse community has created additional middleware for:- Rate limiting
- File uploads
- Static file serving
- API documentation (Swagger)
- Socket.IO
- Pagination
- And many more…
License
Horse is free and open-source software licensed under the MIT License.Getting Started
Ready to build your first Horse application?Quick Start Guide
Get your first Horse server running in minutes
Community & Support
Join the Horse community:- GitHub: github.com/HashLoad/horse
- Telegram: t.me/hashload
- Issues: Report bugs or request features
Horse is actively maintained by HashLoad and a vibrant community of contributors.
