Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions frameworks/ulfius/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM ubuntu:24.04 AS build

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc make cmake git ca-certificates pkg-config \
libmicrohttpd-dev libjansson-dev libcurl4-openssl-dev \
libgnutls28-dev libsqlite3-dev zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

# Build ulfius and its dependency orcania/yder from source
WORKDIR /tmp
RUN git clone --depth 1 --branch v2.3.3 https://github.com/babelouest/orcania.git && \
cd orcania && cmake -B build -DCMAKE_BUILD_TYPE=Release -S . && \
cmake --build build -j$(nproc) && cmake --install build

RUN git clone --depth 1 --branch v1.4.20 https://github.com/babelouest/yder.git && \
cd yder && cmake -B build -DCMAKE_BUILD_TYPE=Release -DWITH_JOURNALD=OFF -S . && \
cmake --build build -j$(nproc) && cmake --install build

RUN git clone --depth 1 --branch v2.7.15 https://github.com/babelouest/ulfius.git && \
cd ulfius && cmake -B build -DCMAKE_BUILD_TYPE=Release \
-DWITH_WEBSOCKET=OFF -DWITH_CURL=OFF \
-DCMAKE_C_FLAGS="-O3 -flto" \
-S . && \
cmake --build build -j$(nproc) && cmake --install build

RUN ldconfig

# Build our server
WORKDIR /app
COPY src/server.c ./
RUN gcc -O3 -flto -march=native -o server server.c \
$(pkg-config --cflags --libs libulfius) \
-ljansson -lsqlite3 -lz -lm -lpthread

FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends \
libmicrohttpd12t64 libjansson4 libgnutls30t64 libsqlite3-0 zlib1g && \
rm -rf /var/lib/apt/lists/*
COPY --from=build /usr/local/lib/libulfius.so* /usr/local/lib/
COPY --from=build /usr/local/lib/liborcania.so* /usr/local/lib/
COPY --from=build /usr/local/lib/libyder.so* /usr/local/lib/
COPY --from=build /app/server /server
RUN ldconfig

EXPOSE 8080 8443
CMD ["/server"]
18 changes: 18 additions & 0 deletions frameworks/ulfius/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Ulfius — C REST Framework

[Ulfius](https://github.com/babelouest/ulfius) is a lightweight HTTP framework for building REST APIs in pure C. Built on GNU Libmicrohttpd with Jansson for JSON processing, it's designed for embedded systems and applications where a small memory footprint matters.

## Why it's interesting

- **Pure C** — first C application framework in HttpArena (h2o/nginx are web servers, not app frameworks)
- **Libmicrohttpd backend** — battle-tested GNU HTTP library under the hood
- **Minimal footprint** — designed for embedded/constrained environments
- **Solo developer project** — @babelouest has been maintaining this since 2015

## Implementation notes

- Uses Jansson for all JSON serialization (same lib used by many C projects)
- Thread-local SQLite connections with prepared statements for `/db`
- Pre-loads datasets and static files into memory at startup
- TLS via GnuTLS (Ulfius's built-in secure framework support)
- Signal-based clean shutdown
19 changes: 19 additions & 0 deletions frameworks/ulfius/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"display_name": "ulfius",
"language": "C",
"type": "framework",
"engine": "libmicrohttpd",
"description": "Ulfius C REST framework built on GNU Libmicrohttpd with Jansson JSON. Lightweight with small memory footprint, designed for embedded systems.",
"repo": "https://github.com/babelouest/ulfius",
"enabled": true,
"tests": [
"baseline",
"noisy",
"pipelined",
"limited-conn",
"json",
"upload",
"compression",
"mixed"
]
}
Loading
Loading