Skip to content
C Hypertext Library - A library for writing web applications in C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


C Hypertext Library - A library for writing web applications in C

#include <chl/chl.h>

int main() {
 printf("Hello world");
 return 0;

(Simple Hello World in CHL)

See examples
Tutorial, Setup, API, Contribute


What is CHL?

CHL, short for C Hypertext Library, is a library used to write web applications of all sorts in the C programming language. CHL provides you with a lot of useful features:

  • FastCGI implementation
  • MySQL library
  • Parsing and fetching HTTP data, such as POST and GET.
  • Creating and deleting HTTP headers.
  • A dedicated API for creating and deleting cookies.
  • The ability to execute CHL functions within HTML files

and a lot more...

Why CHL?

What makes CHL uniqe is the support for executing functions inside HTML files, much like PHP using the syntax, though CHL uses the <{ }> syntax.


 <{ import("header.vw"); }>

How does it work?

Web applications written in C must somehow be executed by the Web server since C is a compiled language. To make this possible CHL is based on CGI (Common Gateway Interface), which in short means that the server executes your program and passes it data through environment variables. CHL does all the parsing and handling of CGI in the background, and provides you with some easy to use functions instead. CHL also provides an interface for FastCGI.


The Application Programming Interface is written with Github Wikis: API.


For a proper guide on how to install and configure CHL on your system, read the following document:

As of now, CHL is only officially available on Linux, but I am planning to port it to other operating systems as well if the interest is big enough. Otherwise you could of course make a port of it yourself, see contribute.


To read an in depth tutorial on the structure of CHL web applications, and a walk through on how to get started and how to use the CHL API properly see

The tutorial is divided into various sections. The first section is a quick introduction to let you know what CHL is all about and what it can do for you. We will then dig deeper and deeper into the CHL API.

Before you start reading this tutorial, make sure you have CHL installed and that everything is properly set up. Setting up CHL.


There are several ways you can contribute to CHL. Take a look at the issues page for an overview of what you can contribute to. If you have any ideas of your own for new features to implement, feel free to contribute with a pull request.

For a detailed guide on contribution to CHL, see contribute.


See examples, for a page with detailed examples of CHL in use.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.