Ulfius HTTP Framework

Build Status

HTTP Framework for REST Applications in C.

Based on GNU Libmicrohttpd for the backend web server, Jansson for the json manipulation library, and Libcurl for the http/smtp client API.

Used to facilitate creation of web applications in C programs with a small memory footprint, as in embedded systems applications.

You can create webservices in HTTP or HTTPS mode, stream data, or implement server websockets.

Hello World! example application

The source code of a hello world using Ulfius is the following:

 * test.c
 * Small Hello World! example
 * to compile with gcc, run the following command
 * gcc -o test test.c -lulfius
#include <stdio.h>
#include <ulfius.h>

#define PORT 8080

 * Callback function for the web application on /helloworld url call
int callback_hello_world (const struct _u_request * request, struct _u_response * response, void * user_data) {
  ulfius_set_string_body_response(response, 200, "Hello World!");

 * main function
int main(void) {
  struct _u_instance instance;

  // Initialize instance with the port number
  if (ulfius_init_instance(&instance, PORT, NULL, NULL) != U_OK) {
    fprintf(stderr, "Error ulfius_init_instance, abort\n");

  // Endpoint list declaration
  ulfius_add_endpoint_by_val(&instance, "GET", "/helloworld", NULL, 0, &callback_hello_world, NULL);

  // Start the framework
  if (ulfius_start_framework(&instance) == U_OK) {
    printf("Start framework on port %d\n", instance.port);

    // Wait for the user to press <enter> on the console to quit the application
  } else {
    fprintf(stderr, "Error starting framework\n");
  printf("End framework\n");


  return 0;

Main features


Client requests



See INSTALL.md file for installation details


See API.md file for API documentation details

Example programs source code

Example programs are available to understand the different functionalities available, see example_programs folder for detailed sample source codes and documentation.

Example callback functions

Example callback functions are available in the folder example_callbacks. The example callback functions available are:

Projects using Ulfius framework

Questions, problems ?

I’m open for questions and suggestions, feel free to open an issue or send a pull request if you feel like it!