Skip to content
Open source · MIT License

The C framework
for the web

A high-performance Linux server: HTTP/1, HTTP/2 and HTTP/3 (QUIC), WebSockets, databases and ORM out of the box — no reverse proxy, no runtime

cwfr — bash live
$
0 req/s p99 0.00 ms0 conn
3HTTP protocolsHTTP/1.1 · HTTP/2 · HTTP/3
4database driversPostgreSQL · MySQL · Redis · SQLite
~100 µsper requesttypical latency under load
MITopen sourcesource code freely available on GitHub
Quick Start

Run the server in a couple of commands

Clone the repository, build the project with the database drivers you need and launch the server with a single command.

bash
git clone https://github.com/fraxer/C-web-framework.git
cd C-web-framework/backend

mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
  -DINCLUDE_POSTGRESQL=yes \
  -DINCLUDE_MYSQL=yes \
  -DINCLUDE_REDIS=yes \
  -DINCLUDE_SQLITE=yes
cmake --build . -j$(nproc)

./exec/cwfr -c /path/to/config.json
Route — config.json
{
  "/": {
    "GET": {
      "file": "handlers/libindexpage.so",
      "function": "index"
    }
  }
}
Handler — handlers/indexpage.c
#include "http.h"

void index(httpctx_t* ctx) {
  ctx->response->send_data(
    ctx->response,
    "Hello world!"
  );
}

A handler is just a function — Each route loads a handler from a .so library. Read the request, build the response — nothing else to wire up.

Build & run guide →
Capabilities

Everything you need in one framework

A complete toolkit for modern web services — protocols, databases, security and utilities out of the box.

HTTP/3 · QUIC

A hand-written QUIC stack (RFC 9000) over UDP: TLS 1.3 handshake in one RTT, no head-of-line blocking, connection migration across networks — switch from Wi-Fi to LTE and the connection survives.

  • Parallel request streams over one connection
  • QPACK header compression
  • Trailers, 103 Early Hints, 100 Continue
  • Auto-advertised via Alt-Svc — clients upgrade themselves
Learn more

HTTP/2

Up to 100 multiplexed streams, HPACK and Rapid Reset protection.

  • WebSocket over h2 (Extended CONNECT)
  • Trailers and 103 Early Hints
  • h2c upgrade for plaintext
Learn more

WebSocket

Real-time channels with broadcasting and named groups.

  • Named channels and recipient filtering
  • permessage-deflate compression
  • Runs over HTTP/1.1 and HTTP/2 (Extended CONNECT)
Learn more

HTTP/1.1

Full server and client: routing, vhosts, TLS.

  • Routes with dynamic parameters
  • Virtual hosts, regex domains, IDN
  • multipart/form-data and file uploads
Learn more

Databases

Four drivers behind one unified API with ORM and migrations.

PostgreSQLMySQLRedisSQLite
  • ORM models and prepared statements
  • Schema migrations out of the box
  • Transactions and connection pools
Learn more

Security

Authentication, sessions and RBAC without external services.

  • PBKDF2-HMAC-SHA256 password hashing
  • Sessions: files, Redis, DB (AES-256-GCM)
  • Rate limiting and data validators
Learn more

Storage & Email

Local FS and S3 plus transactional email with DKIM.

  • S3-compatible services
  • multipart uploads into storage
  • SMTP client and email templates
Learn more

Tooling

Template engine, i18n, JSON, JWT and the task scheduler.

  • gettext i18n: plurals, fallback
  • Scheduler: interval, daily, weekly
  • str_t with SSO, HashMap, JSON parser
Learn more

And that is not all

Hot reload of handlers, logging, the HTTP client, scheduled tasks and more — in the docs.

Open the docs
Use Cases

What you can build

REST API

High-performance APIs for mobile and web applications

Real-time

Chats, notifications and live updates via WebSocket

Microservices

Microservices and monolithic applications

API Gateway

Request routing and proxying between services

Admin panels

Authentication, RBAC and CRUD operations

File uploads

Local and S3-compatible cloud storage

Email services

Transactional email sending with DKIM

i18n

Multilingual content with gettext and pluralization

Get started

Build fast web services in C

Read the introduction, browse the examples, or open the source on GitHub.

Released under the MIT License.