{"id":13470775,"url":"https://github.com/babelouest/ulfius","last_synced_at":"2025-05-14T10:10:14.117Z","repository":{"id":38097600,"uuid":"45362021","full_name":"babelouest/ulfius","owner":"babelouest","description":"Web Framework to build REST APIs, Webservices or any HTTP endpoint in C language. Can stream large amount of data, integrate JSON data with Jansson, and create websocket services","archived":false,"fork":false,"pushed_at":"2024-10-13T13:03:16.000Z","size":5570,"stargazers_count":1102,"open_issues_count":16,"forks_count":184,"subscribers_count":49,"default_branch":"master","last_synced_at":"2025-04-03T23:51:13.526Z","etag":null,"topics":["c","json","libcurl","libmicrohttpd","rest-api","restful","web-development","webservice","websocket-client","websocket-communication","websocket-server","websockets"],"latest_commit_sha":null,"homepage":"https://babelouest.github.io/ulfius","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/babelouest.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-01T23:31:15.000Z","updated_at":"2025-03-30T18:37:22.000Z","dependencies_parsed_at":"2023-11-14T01:25:19.725Z","dependency_job_id":"a03e99d2-b6d8-4f8b-9e0a-e594822d4272","html_url":"https://github.com/babelouest/ulfius","commit_stats":{"total_commits":1310,"total_committers":29,"mean_commits":"45.172413793103445","dds":"0.13206106870229006","last_synced_commit":"3fd9d8d39a7ea2fe86234246526b65b40bea9322"},"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babelouest%2Fulfius","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babelouest%2Fulfius/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babelouest%2Fulfius/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babelouest%2Fulfius/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/babelouest","download_url":"https://codeload.github.com/babelouest/ulfius/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248337813,"owners_count":21087109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","json","libcurl","libmicrohttpd","rest-api","restful","web-development","webservice","websocket-client","websocket-communication","websocket-server","websockets"],"created_at":"2024-07-31T16:00:35.815Z","updated_at":"2025-04-11T03:36:09.128Z","avatar_url":"https://github.com/babelouest.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# Ulfius HTTP Framework\n\n![.github/workflows/ccpp.yml](https://github.com/babelouest/ulfius/workflows/.github/workflows/ccpp.yml/badge.svg)\n![CodeQL](https://github.com/babelouest/ulfius/workflows/CodeQL/badge.svg)\n[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3195/badge)](https://bestpractices.coreinfrastructure.org/projects/3195)\n\nHTTP Framework for REST Applications in C.\n\nBased on [GNU Libmicrohttpd](https://www.gnu.org/software/libmicrohttpd/) for the backend web server, [Jansson](http://www.digip.org/jansson/) for the json manipulation library, and [Libcurl](http://curl.haxx.se/libcurl/) for the http/smtp client API.\n\nUsed to facilitate creation of web applications in C programs with a small memory footprint, as in embedded systems applications.\n\nYou can create webservices in HTTP or HTTPS mode, stream data, or implement server websockets.\n\n## Hello World! example application\n\nThe source code of a hello world using Ulfius is the following:\n\n```C\n/**\n * test.c\n * Small Hello World! example\n * to compile with gcc, run the following command\n * gcc -o test test.c -lulfius\n */\n#include \u003cstdio.h\u003e\n#include \u003culfius.h\u003e\n\n#define PORT 8080\n\n/**\n * Callback function for the web application on /helloworld url call\n */\nint callback_hello_world (const struct _u_request * request, struct _u_response * response, void * user_data) {\n  ulfius_set_string_body_response(response, 200, \"Hello World!\");\n  return U_CALLBACK_CONTINUE;\n}\n\n/**\n * main function\n */\nint main(void) {\n  struct _u_instance instance;\n\n  // Initialize instance with the port number\n  if (ulfius_init_instance(\u0026instance, PORT, NULL, NULL) != U_OK) {\n    fprintf(stderr, \"Error ulfius_init_instance, abort\\n\");\n    return(1);\n  }\n\n  // Endpoint list declaration\n  ulfius_add_endpoint_by_val(\u0026instance, \"GET\", \"/helloworld\", NULL, 0, \u0026callback_hello_world, NULL);\n\n  // Start the framework\n  if (ulfius_start_framework(\u0026instance) == U_OK) {\n    printf(\"Start framework on port %d\\n\", instance.port);\n\n    // Wait for the user to press \u003center\u003e on the console to quit the application\n    getchar();\n  } else {\n    fprintf(stderr, \"Error starting framework\\n\");\n  }\n  printf(\"End framework\\n\");\n\n  ulfius_stop_framework(\u0026instance);\n  ulfius_clean_instance(\u0026instance);\n\n  return 0;\n}\n```\n\n## Main features\n\n### Webservice\n\n- Create a webservice in a separate thread, the endpoint is identified by its method (ex: `GET`, `POST`, `PUT`, `DELETE`, etc.) and its URL path with its optional parameters (ex: `/api/doc/@id`). The webservice is executed in a callback function.\n\n- Stream large amount of data with a reduced memory footprint.\n\n- Websocket service, the websocket messages exchange is executed in dedicated callback functions.\n\n### Client requests\n\n- Client http[s] and smtp requests execution, the response is parsed in a dedicated structure.\n\n- Client websocket request execution, the websocket messages exchange is executed in dedicated callback functions.\n\n### Websockets\n\n- Create a websocket service application\n\n- Create websocket client application\n\n- CLI to connect to a remote websocket: [uwsc](https://github.com/babelouest/ulfius/tree/master/tools/uwsc)\n\n## Installation\n\nSee [INSTALL.md](INSTALL.md) file for installation details\n\n## Documentation\n\nSee [API.md](API.md) file for API documentation details\n\nSee the [online documentation](https://babelouest.github.io/ulfius/) for a doxygen format of the API documentation.\n\n## Example programs source code\n\nExample programs are available to understand the different functionalities available, see [example_programs](https://github.com/babelouest/ulfius/blob/master/example_programs) folder for detailed sample source codes and documentation.\n\n## Example callback functions\n\nExample callback functions are available in the folder [example_callbacks](https://github.com/babelouest/ulfius/blob/master/example_callbacks). The example callback functions available are:\n- static file server: to provide static files of a specific folder\n- oauth2 bearer: to check the validity of a Oauth2 bearer jwt token. Requires [libjwt](https://github.com/benmcollins/libjwt).\n\n## Projects using Ulfius framework\n\n- [Glewlwyd](https://github.com/babelouest/glewlwyd), a lightweight SSO server that provides OAuth2 and OpenID Connect authentication protocols\n- [Le Biniou](https://biniou.net/), user-friendly yet powerful music visualization / VJing tool\n- [Angharad](https://github.com/babelouest/angharad), House automation system for ZWave and other types of devices\n- [Hutch](https://github.com/babelouest/hutch), a safe locker for passwords and other secrets, using JavaScript client side encryption only\n- [Taliesin](https://github.com/babelouest/taliesin), a lightweight audio streaming server\n- [Taulas Raspberry Pi Serial interface](https://github.com/babelouest/taulas/tree/master/taulas_raspberrypi_serial), an interface for Arduino devices that implement [Taulas](https://github.com/babelouest/taulas/) protocol, a house automation protocol for Angharad\n\n## Questions, problems ?\n\nI'm open for questions and suggestions, feel free to open an [issue](https://github.com/babelouest/ulfius/issues), a [pull request](https://github.com/babelouest/ulfius/pulls) or send me an [e-mail](mailto:mail@babelouest.io) if you feel like it!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbabelouest%2Fulfius","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbabelouest%2Fulfius","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbabelouest%2Fulfius/lists"}