Daraja Framework logo

Daraja is a flexible HTTP framework for Object Pascal, based on the stand-alone HTTP server in the free open source library Internet Direct (Indy).

Daraja provides the core foundation for serving HTTP resources of all content-types such as HTML pages, images, scripts, web service responses etc. by mapping resource paths to your own Object Pascal code.

The framework uses the concept of web components for resource generation, which provide distinct handlers for GET, POST and other requests to separate resource building code for all supported HTTP methods.

With the Daraja Framework, writing well organized stand alone HTTP server applications in Object Pascal requires only a few lines of code, and a minimum of installation and project set up steps.

Benefits

The Daraja framework is focused on simple design principles to get you started within minutes:

  • No package installation
  • Minimal "boiler plate" code
  • Only one required third-party library dependency (Indy)

The result is pure, type-safe binary code which can be embedded in applications and run as an independent HTTP server for small to medium size systems.

Quick Facts

Technical information

Compilers

Daraja is compatible with the compilers

  • Delphi 2009+
  • Free Pascal 2.6.4
  • Free Pascal 3.0.0

Windows platform only (Linux platform with restrictions)

Indy Requires Internet Direct (Indy) 10.6.2
Logging Uses the SLF4P logging facade (supports LazLogger, Log4D and other loggers)
Source available on GitHub logoGitHub mark

License

Dual licensed under the GNU Affero General Public License Version 3 / Commercial license

This example demonstrates HTTP GET response building for the resource path /tutorial/hello.

Unit HelloWorldResource generates the response to the GET request in the OnGet method of a subclass of TdjWebComponent:

The HelloWorldServer project code specifies the resource location, and starts the server:

This example also shows the separation of concerns: the unit which builds the response content does not specify the resource path. The framework automatically searches and executes the Object Pascal code which has been mapped to a resource path.

Mobile apps

Use Daraja with jQuery Mobile to to build web apps for mobile devices.

A demo application (Flightplan) is included with source code.

Please note: the framework does not contain specific support code for jQuery Mobile. The demo project source contains plain HTML code which uses jQuery Mobile CSS and JavaScript.

Responsive web applications

Use Daraja with the popular Bootstrap framework to to build responsive web applications.

A demo application (Kitchen Sink) is included with source code.

Please note: the library does not contain specific support code for Bootstrap. The demo project source contains plain HTML code which uses Bootstrap CSS and JavaScript.

FPCUnit and DUnit tests

Tests for the Daraja library are included

Online API docs

API documentation is available online

Learn how Daraja helps to keep your web applications and HTTP services well structured and easy to manage:

Context paths

Web components are organized in logically separated scopes on the same server, using context base paths like example.com/myapp1 and example.com/myapp2

Request mapping

Incoming HTTP requests are dynamically mapped to URI patterns based on their absolute paths, prefix (/sub1/*, /sub2/* ...), or suffix (*.html, *.pdf)

Request delegation

The TdjHandlerWrapper allows to run code before and after the code of a wrapped handler. Nested handlers can be used for filtering, logging, statistics, and more

Session state

Web component instances are stateless by default, but context-wide and dynamic on-demand creation of HTTP sessions is supported

Supported HTTP methods

The library supports GET, POST, DELETE, PATCH, HEAD, TRACE, OPTIONS methods by matching onGet, onPost (...) event handlers

Logging

The library includes support for the free open source SLF4P logging facade (https://github.com/michaelJustin/slf4p)

Static documents

The library uses Indy's built in SmartFileServe method to minimize HTTP traffic based on the 'file last modified' timestamp

Lightweight

The lightweight architecture of the library code makes it easy to use - no package installation is required

Daraja Framework is dual licensed under the GNU Affero General Public License and a commercial license. The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.

Yes, if you open source your whole project (thus also AGPL it) otherwise no
You have to supply the whole sourcecode of everything - but a download link should suffice

Prices below are per developer with no royalties or hidden fees.

  INDIE
25 € / year
paid annually
BUSINESS
99 € / year
paid annually
ENTERPRISE
189 € / year
paid annually
Permitted use Individual Organization Organization
Subscription Type Annual Annual Annual
No AGPL restrictions
Deploy on unlimited servers
Email Support
One Business Day SLA    
Hotfixes    
  Subscribe Subscribe Contact

The Daraja Framework is hosted on GitHub

Download