userver-framework/userver

C++userver.tech
Linux

Production-ready C++ Asynchronous Framework with rich functionality

asyncasynchronouscoroutinesdatabase-accesscpluspluswebservermicroserviceshigh-availabilityhttphttp-serverhttp-client
Crecimiento de estrellas
Estrellas
3k
Forks
408
Crecimiento semanal
+12
Issues
88
1k2k
may 2022oct 2023mar 2025sept 2026
README

userver

Ubuntu Fedora Debian MacOS Alpine Arch Docker CI Conan CodeQL

Build and publish ubuntu-24.04-userver images Build and publish ubuntu-22.04-userver images Gentoo Systemd with Overlay CI

uservice-dynconf CI uservice-dynconf Docker build urealmedium CI urealmedium Docker build upastebin CI upastebin Docker

userver is an open source asynchronous framework with a rich set of abstractions for fast and comfortable creation of C++ microservices, services and utilities.

The framework solves the problem of efficient I/O interactions transparently for the developers. Operations that would typically suspend the thread of execution do not suspend it. Instead of that, the thread processes other requests and tasks and returns to the handling of the operation only when it is guaranteed to execute immediately:

#include <userver/easy.hpp>

// schemas::KeyRequest and parsers+serializers generated from JSON schema
#include "schemas/key_value.hpp"

int main(int argc, char* argv[]) {
    using namespace userver;

    easy::HttpWith<easy::PgDep>(argc, argv)
        // Handles multiple HTTP requests to `/kv` URL concurrently
        .Get("/kv", [](schemas::KeyRequest&& request, const easy::PgDep& dep) {
            // Asynchronous execution of the SQL query in transaction. Current thread
            // handles other requests while the response from the DB is being received:
            auto res = dep.pg().Execute(
                storages::postgres::ClusterHostType::kSlave,
                // Query is converted into a prepared statement. Subsequent requests
                // send only parameters in a binary form and meta information is
                // discarded on the DB side, significantly saving network bandwidth.
                "SELECT value FROM key_value_table WHERE key=$1", request.key
            );

            return schemas::KeyValue{
                .key=std::move(request.key),
                .value=res[0][0].As<std::string>(),
            };
        });
}

As a result, with the framework you get straightforward source code, avoid CPU-consuming context switches from OS, efficiently utilize the CPU with a small amount of execution threads.

You can learn more about history and key features of userver from our publications and videos.

Other Features

  • Efficient asynchronous drivers for databases (MongoDB, PostgreSQL, Valkey, Redis, ClickHouse, MySQL/MariaDB, YDB, SQLite ...) and data transfer protocols (HTTP/{1.1, 2.0}, gRPC, AMQP 0-9-1, Kafka, TCP, TLS, WebSocket ...), tasks construction and cancellation.
  • Rich set of high-level components for caches, tasks, distributed locking, logging, tracing, statistics, metrics, JSON/YAML/BSON.
  • Functionality to change the service configuration on-the-fly.
  • On-the-fly configurable drivers, options of the deadline propagation, timeouts, congestion-control.
  • Comprehensive set of asynchronous low-level synchronization primitives and OS abstractions.

See the docs for more info.

Repositorios relacionados
getify/You-Dont-Know-JS

A book series (2 published editions) on the JS language.

tutorialOtherbook-seriesjavascript
amazon.com/dp/B085XXCJ7X
184.8k33.4k
fastapi/fastapi

FastAPI framework, high performance, easy to learn, fast to code, ready for production

PythonPyPIlibraryMIT Licensepythonjson
fastapi.tiangolo.com
102.2k9.9k
TanStack/query

🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query.

TypeScriptnpmMIT Licensereacthooks
tanstack.com/query
50.3k4.2k
caolan/async

Async utilities for node and the browser

JavaScriptnpmlibraryMIT Licensejavascriptasync
caolan.github.io/async/
28.1k2.4k
actix/actix-web

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Rustcrates.iolibraryApache License 2.0rustweb
actix.rs
24.8k1.9k
gitui-org/gitui

Blazing 💥 fast terminal-ui for git written in rust 🦀

Rustcrates.iocliMIT Licenserusttui
22.5k771
avajs/ava

Node.js test runner that lets you develop with confidence 🚀

JavaScriptnpmcliMIT Licensetest-runnerava
20.8k1.5k
Evil0ctal/Douyin_TikTok_Download_API

🚀「Douyin_TikTok_Download_API」是一个开箱即用的高性能异步抖音、快手、TikTok、Bilibili数据爬取工具,支持API调用,在线批量解析及下载。

PythonPyPIlibraryApache License 2.0pythonpywebio
douyin.wtf
20k2.8k
transact-rs/sqlx

🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite.

Rustcrates.iolibraryApache License 2.0sqlrust
17.5k1.7k
aio-libs/aiohttp

Asynchronous HTTP client/server framework for asyncio and Python

PythonPyPIlibraryApache License 2.0aiohttpasyncio
docs.aiohttp.org
16.5k2.4k
jamiebuilds/react-loadable

:hourglass_flowing_sand: A higher order component for loading components with promises.

JavaScriptnpmMIT Licensereactloading
16.5k760
ktorio/ktor

Framework for quickly creating connected applications in Kotlin with minimal effort

KotlinlibraryApache License 2.0kotlinweb-framework
ktor.io
14.5k1.3k