Skip to content
Open source · MIT License

The C framework for web

A high-performance server with HTTP/1, HTTP/2 and HTTP/3 (QUIC), WebSockets, databases and ORM out of the box

HTTP/1 HTTP/2 HTTP/3 WebSocket PostgreSQL
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/cpdy -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/1.1

A complete HTTP/1.1 server and client — routing, virtual hosts, middleware and TLS.

  • Full HTTP/1.1 support
  • Flexible routing with dynamic parameters
  • Virtual hosts with regex domains and IDN support
  • Middleware and filters: gzip, range, chunked, cache control
  • Cookies with secure, httpOnly, sameSite
  • multipart/form-data parsing and file uploads
  • Automatic gzip compression for supported content types
  • Redirects with regular expressions and capture groups
  • Built-in HTTP client: TLS 1.2+, keep-alive pool, redirects
Learn more

HTTP/2

Multiplexing, HPACK compression and flow control — many requests over a single connection.

  • Multiplexing up to 100 streams per connection
  • Two-level flow control with auto window scaling
  • HPACK header compression with Huffman coding
  • Trailers and 103 Early Hints
  • WebSocket over HTTP/2 (Extended CONNECT)
  • h2c upgrade for plaintext connections
  • Rapid Reset and other DoS protection
  • Enabled automatically via ALPN over TLS
Learn more

HTTP/3

QUIC transport over UDP — no HOL-blocking, fast startup and independent request streams.

  • Full QUIC stack (RFC 9000) over UDP
  • TLS 1.3 handshake in a single RTT
  • Connection migration and path validation
  • QPACK header compression
  • Trailers, 103 Early Hints and 100 Continue
  • Concurrent requests over one connection
  • Auto-advertised via the Alt-Svc header
  • Requires OpenSSL 3.5+ (-DINCLUDE_HTTP3=yes flag)
Learn more

WebSocket

Bidirectional real-time channels with broadcasting and named recipient groups.

  • Full WebSocket protocol support
  • Broadcasting system for groups of clients
  • Named channels with recipient filtering
  • Built-in JSON message support
  • Middleware for WebSocket requests
Learn more

Databases

PostgreSQL, MySQL, SQLite and Redis behind one unified API with ORM and migrations.

  • PostgreSQL — native support with prepared statements
  • MySQL — native support with SQL injection protection
  • SQLite — embedded database without a separate server
  • Redis — for caching and sessions
  • ORM models for working with tables
  • Migrations — database schema versioning
  • Query Builder — safe SQL query construction
  • Transactions and connection pool
Learn more

Security

Authentication, sessions, RBAC, rate limiting and modern password hashing.

  • Built-in registration and authorization system
  • Sessions in files, Redis and the database
  • Session secrets protected with AES-256-GCM
  • Password hashing with PBKDF2-HMAC-SHA256
  • Validators for email, passwords and other data
  • RBAC — role-based access control
  • Rate Limiting — DDoS protection
Learn more

Storage & Email

Local and S3 storage plus transactional email with DKIM.

  • Local file storage
  • S3-compatible services
  • CRUD operations on files
  • multipart uploads saved to storage
  • SMTP client for sending email
  • DKIM signatures for sender authentication
  • Email templates
Learn more

Tooling

Template engine, i18n, JSON, JWT, task scheduler and the str_t / HashMap toolkit.

  • Template engine: variables, loops, model integration
  • i18n on gettext: pluralization, language auto-detection, fallback
  • High-performance JSON parser and serialization
  • JWT, UUID, Base64, SHA-1/256
  • Task scheduler: interval, daily, weekly, monthly
  • AES-256-GCM, random number generator
  • str_t with SSO, Array, HashMap/Map, ordered queue
Learn more
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.