README.md

June 1, 2026 · View on GitHub

Horse


Horse is an Express-inspired web framework for Delphi and Lazarus.
Designed to ease things up for fast development in a minimalist way and with high performance.


Read this in English or Português (BR).

⚙️ Installation

Installation is done using the boss install command:

boss install horse

(Optional) Install the Horse Wizard for IDE integration.

⚡️ Quickstart Delphi

uses Horse;

begin
  THorse.Get('/ping',
    procedure(Req: THorseRequest; Res: THorseResponse)
    begin
      Res.Send('pong');
    end);

  THorse.Listen(9000);
end.

⚡️ Quickstart Lazarus

{$MODE DELPHI}{$H+}

uses Horse;

procedure GetPing(Req: THorseRequest; Res: THorseResponse);
begin
  Res.Send('Pong');
end;

begin
  THorse.Get('/ping', GetPing);
  THorse.Listen(9000);
end.

📖 Documentation

The full guide lives in doc/ — a small wiki that complements the quick reference below:

TopicRead
First server, install paths, Delphi/Lazarus setupGetting Started
Defining routes, route params, route groups, query stringsRouting
THorseRequest / THorseResponse — body, headers, cookies, sessions, status, streamingRequest & Response
Using middleware, registration order, the Next procMiddleware
Writing & publishing your own middleware — skeleton, thread safety, Provider neutrality, Boss packagingWriting a Middleware
Choosing a transport provider — Indy (default), CrossSocket, mORMot2, Apache, ISAPI, CGI, daemonsProviders
Deploy as Console / VCL / Daemon / Windows Service / LCL / HTTPApplication — one-page recipeDeployment Cheatsheet
Full middleware catalogue with extended descriptionsMiddleware Ecosystem
Supported Delphi / FPC versions and platformsCompiler Support

🔌 Providers (transport layer)

A provider is the HTTP transport that owns the socket and hands requests to your route handlers. The same handler code runs under any provider — you select one at compile time via a Conditional Define. The default Provider depends on the compiler: Indy on Delphi (for Console / VCL / Daemon), fphttpserver on FPC (for Daemon / HTTPApplication / LCL). The optional CrossSocket and mORMot2 Providers replace both with async IOCP / epoll / kqueue I/O.

ProviderCompiler defineDelphiLazarus
Indy (Delphi default for self-hosted)(none)   ✔️    n/a
fphttpserver (FPC default for self-hosted)(none)   n/a    ✔️
🆕 horse-provider-crosssocketHORSE_CROSSSOCKET   ✔️    ✔️
🆕 horse-provider-mormotHORSE_PROVIDER_MORMOT   ✔️    ✔️

Note — Apache / ISAPI / CGI / FastCGI Application types (below) do not use any of these Providers. The host process (Apache, IIS, the web server) owns the socket; Horse runs in-process. See Providers & Application types for the full model.

Delphi-Cross-Socket installation — clone winddriver/Delphi-Cross-Socket (upstream) plus cnpack/cnvcl/.../Crypto for the required CnPack/Crypto units, and add search paths to your project. Three previously-fork-only bug fixes have been merged into upstream as of 2026-Q2, so the upstream mainline is correct for general use. For server-side mutual TLS (SSLVerifyPeer = True + SSLCACertFile = ...) use the pre-built release freitasjca/Delphi-Cross-Socket v1.0.3 — single clone, CnPack bundled, mTLS APIs (SetCACertificateFile + SetVerifyPeer) ready to use. See horse-provider-crosssocket Installation for the full two-path breakdown.

🎯 Application types

How the binary is packaged and started. Self-hosted types run under the chosen Provider above; host-managed types delegate the socket to the web server, which then becomes the transport.

Application typeCompiler defineDelphiLazarus
Self-hosted (uses the selected Provider)
Console (default)(none)   ✔️    ✔️
VCLHORSE_VCL   ✔️    ❌
Daemon — Windows ServiceHORSE_DAEMON   ✔️    n/a
Daemon — Linux daemon (systemd)HORSE_DAEMON   ✔️    ✔️
LCL (Lazarus GUI)HORSE_LCL   ❌    ✔️
HTTPApplication (FPC)(FPC default)   ❌    ✔️
Host-managed (the web server owns the socket; Provider above is unused)
Apache moduleHORSE_APACHE   ✔️    ✔️
ISAPI (IIS)HORSE_ISAPI   ✔️    ❌
CGIHORSE_CGI   ✔️    ✔️
FastCGIHORSE_FCGI   ✔️    ✔️

NoteHORSE_DAEMON is a platform‑adaptive application type:

  • On Windows → compiles as a Windows Service (Vcl.SvcMgr.TService + SCM)
  • On Linux → compiles as a systemd daemon (uses signal(SIGTERM) + systemd)

“Daemon” is the Unix‑native term; Windows has no exact equivalent, so the same define name is used across platforms.

See Providers for the full compatibility matrix and how to combine Provider × Application type.

🧬 Official Middlewares

For a more maintainable middleware ecosystem, we've put official middlewares into separate repositories:

MiddlewareDelphiLazarus
horse/json   ✔️    ✔️
horse/basic-auth   ✔️    ✔️
horse/cors   ✔️    ✔️
horse/stream   ✔️    ✔️
horse/jwt   ✔️    ✔️
horse/exception   ✔️    ✔️
horse/logger   ✔️    ✔️
horse/compression   ✔️    ✔️

🌱 Third Party Middlewares

This is a list of middlewares that are created by the Horse community, please create a PR if you want to see yours!

MiddlewareDelphiLazarus
bittencourtthulio/etag   ✔️    ✔️
bittencourtthulio/paginate   ✔️    ✔️
bittencourtthulio/cachecontrol   ✔️    ❌
gabrielbaltazar/gbswagger   ✔️    ❌
willhubner/socketIO   ✔️    ❌
dliocode/ratelimit   ✔️    ❌
dliocode/slowdown   ✔️    ❌
giorgiobazzo/upload   ✔️    ❌
dliocode/query   ✔️    ❌
CarlosHe/healthcheck   ✔️    ❌
CarlosHe/staticfiles   ✔️    ❌
CachopaWeb/horse-server-static   ✔️    ✔️
arvanus/horse-exception-logger   ✔️    ✔️
claudneysessa/Horse-CSResponsePagination   ✔️    ❌
claudneysessa/Horse-XSuperObjects   ✔️    ❌
andre-djsystem/horse-bearer-auth   ✔️    ✔️
andre-djsystem/horse-manipulate-request   ✔️    ✔️
andre-djsystem/horse-manipulate-response   ✔️    ✔️
antoniojmsjr/Horse-IPGeoLocation   ✔️    ❌
antoniojmsjr/Horse-XMLDoc   ✔️    ❌
isaquepinheiro/horse-jsonbr   ✔️    ❌
IagooCesaar/Horse-JsonInterceptor   ✔️    ❌
dliocode/horse-datalogger   ✔️    ❌
marcobreveglieri/horse-prometheus-metrics   ✔️    ❌
weslleycapelari/horse-documentation   ✔️    ❌
weslleycapelari/horse-validator   ✔️    ❌

Delphi Versions

Horse works with 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 and Delphi XE7.

For the full platform matrix per provider, see Compiler Support.

🤝 Contributing

See CONTRIBUTING.md for how to report bugs, suggest features, and submit code or documentation changes. Bilingual EN / PT-BR docs are kept in sync — when editing one language, edit the other in the same PR.

💻 Code Contributors

⚠️ License

Horse is free and open-source software licensed under the MIT License.

📐 Tests

tests Console Coverage VCL Coverage