Installation
This guide covers all methods of installing Horse in your Delphi or Lazarus project, from the recommended Boss package manager to manual installation.System Requirements
Delphi
Supported Versions:
- Delphi 13 Florence
- Delphi 12 Athens
- Delphi 11 Alexandria
- Delphi 10.4 Sydney
- Delphi 10.3 Rio
- Delphi 10.2 Tokyo
- Delphi 10.1 Berlin
- Delphi 10 Seattle
- Delphi XE8
- Delphi XE7
Lazarus
Supported Versions:
- Lazarus 2.0+
- Free Pascal 3.0+
- Windows
- Linux
- macOS
Method 1: Boss Package Manager (Recommended)
Boss is a dependency manager for Delphi and Lazarus that makes installing Horse and its dependencies simple.Install Horse
Open a terminal in your project directory and run:Boss will automatically:
- Download Horse and its dependencies
- Configure library paths
- Update your project settings
Boss automatically manages dependencies and keeps packages up to date. This is the recommended installation method.
Method 2: Manual Installation
For manual installation without a package manager:Download Horse
Add to Library Path (Delphi)
- Open Delphi IDE
- Go to Tools > Options
- Navigate to Language > Delphi > Library
- Select your target platform (e.g., Windows 32-bit)
- Click the […] button next to “Library path”
- Add the path to Horse’s
srcfolder: - Click OK to save
Add to Search Path (Lazarus)
- Open Lazarus IDE
- Go to Project > Project Options
- Navigate to Compiler Options > Paths
- In “Other unit files (-Fu)” add:
- Click OK to save
Method 3: Git Submodule
For projects using Git, you can add Horse as a submodule:lib/horse/src to your library path as described in Method 2.
Installing Middleware
Horse has a rich ecosystem of middleware packages. Here’s how to install them:Using Boss
Manual Installation
For each middleware:- Clone the repository
- Add the
srcfolder to your library path - Add the middleware unit to your uses clause
horse-cors/src
Use in code:
Project Configuration
Delphi Console Application
- Create a new Console Application
- Add
Horseto the uses clause - Add
{$APPTYPE CONSOLE}directive
Delphi VCL Application
- Create a new VCL Forms Application
- Add
Horseto the uses clause - Important: Add
HORSE_VCLto project defines:- Go to Project > Options
- Navigate to Delphi Compiler > Compiling
- In “Conditional defines” add:
HORSE_VCL
Delphi ISAPI Application
- Create a new Web Broker Application
- Choose ISAPI Dynamic Link Library
- Add
HORSE_ISAPIto project defines - Add
Horseto the uses clause
Lazarus Console Application
- Create a new Program
- Add mode directive:
{$MODE DELPHI}{$H+} - Add
Horseto the uses clause
Lazarus Daemon
- Create a new Program
- Add
HORSE_DAEMONto project defines - Add
Horseto the uses clause
Compilation Directives
Horse uses compilation directives to support different deployment scenarios:| Directive | Purpose | Platform |
|---|---|---|
HORSE_VCL | VCL application support | Delphi (Windows) |
HORSE_ISAPI | ISAPI module | Delphi (Windows) |
HORSE_APACHE | Apache module | Delphi/Lazarus |
HORSE_CGI | CGI application | Delphi/Lazarus |
HORSE_FCGI | FastCGI application | Lazarus |
HORSE_DAEMON | Daemon/Service | Delphi/Lazarus |
HORSE_LCL | LCL application | Lazarus |
Adding Compilation Directives
Delphi:- Project > Options
- Delphi Compiler > Compiling
- Add to “Conditional defines”
- Project > Project Options
- Compiler Options > Custom Options
- Add:
-dHORSE_VCL(or other directive)
Verification
Create a simple test to verify Horse is working:http://localhost:9000/test in your browser. You should see “Horse is working!”.
Optional: Install Horse Wizard
The Horse Wizard is an IDE wizard that helps you create Horse projects quickly:Troubleshooting
Unit Horse not found
Unit Horse not found
Solution:
- Verify the Horse
srcfolder is in your library path - Restart the IDE after adding the path
- Check that the path is correct for your target platform
Access violation when starting server
Access violation when starting server
Solution:
- For VCL applications, ensure
HORSE_VCLis defined - For ISAPI, ensure
HORSE_ISAPIis defined - Check that you’re using the correct provider for your project type
Boss install fails
Boss install fails
Solution:
- Check your internet connection
- Verify Boss is properly installed:
boss --version - Try clearing Boss cache:
boss cache clean - Manually download and install if Boss continues to fail
Port already in use
Port already in use
Solution:
- Change the port in
THorse.Listen(port) - Check if another application is using the port
- Windows:
netstat -ano | findstr :9000 - Linux:
netstat -tlnp | grep :9000
SSL/TLS support not working
SSL/TLS support not working
Solution:
- Horse requires OpenSSL DLLs for SSL support
- Download OpenSSL binaries for your platform
- Place
libeay32.dllandssleay32.dllin your application directory (Windows) - Install OpenSSL package on Linux:
apt-get install libssl-dev
Next Steps
Quick Start
Build your first Horse application
Routing
Learn about routing and parameters
Middleware
Extend Horse with middleware
Examples
Explore example projects
Getting Help
If you encounter issues:- Check the GitHub Issues
- Join the Telegram community
- Review the example projects
For production deployments, consider using middleware like
horse-exception for error handling and horse-logger for request logging.