{"id":20084812,"url":"https://github.com/maddsua/lambda","last_synced_at":"2026-02-14T01:31:08.442Z","repository":{"id":65704309,"uuid":"584904214","full_name":"maddsua/lambda","owner":"maddsua","description":"A zero dependency application server library in C++","archived":false,"fork":false,"pushed_at":"2025-02-15T00:20:25.000Z","size":1465,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-22T14:39:56.546Z","etag":null,"topics":["application-server","cpp-library","http-server","websockets-server"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maddsua.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":"2023-01-03T20:20:38.000Z","updated_at":"2025-02-15T00:20:29.000Z","dependencies_parsed_at":"2023-12-07T17:43:38.573Z","dependency_job_id":"5d4fc0c0-ed1b-4833-bb9c-5a669ff5c3e8","html_url":"https://github.com/maddsua/lambda","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/maddsua/lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maddsua%2Flambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maddsua%2Flambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maddsua%2Flambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maddsua%2Flambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maddsua","download_url":"https://codeload.github.com/maddsua/lambda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maddsua%2Flambda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29429290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T22:20:51.549Z","status":"ssl_error","status_checked_at":"2026-02-13T22:20:49.838Z","response_time":78,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["application-server","cpp-library","http-server","websockets-server"],"created_at":"2024-11-13T15:53:24.345Z","updated_at":"2026-02-14T01:31:08.419Z","avatar_url":"https://github.com/maddsua.png","language":"C++","readme":"# lambda\n\n**A zero dependency C++ application server library**\n\nSo this is my fun-project. It started as a really basic REST API server that had to talk to the cloud on one side and some embedded hardware on the other.\n\nOver time it became a self skill measurement contest for me. The goals are pretty simple - make it as good as possible.\n\n## The design\n\nThe initial design was trying to follow AWS Lambda (yeah fr), hence the name. The problem with it was that it's not really extendable. As the result, V3 had it's design done from scratch (for the fourth time in total, not even kidding).\n\nAnyway, have a look at the standard measure of web framework badassness - the \"hello world\" sample app:\n\n```c++\n#include \"../lambda.hpp\"\n\nvoid handler_fn(Lambda::Request\u0026 req, Lambda::ResponseWriter\u0026 wrt) {\n\twrt.write(\"yo, mr white\");\n};\n\nint main() {\n\tLambda::Server(handler_fn, { .port = 8100 }).serve();\n\treturn 0;\n}\n```\n\nDoesn't look too bad for a C++ app, eh?\n\n\u003cimg src=\"docs/what-have-i-done.webp\" style=\"max-width: 720px\" /\u003e\n\n**Here, a Vue project is being served by lambda for no reason at all**\n\n## Features\n\n- Mostly memory safe design\n- HTTP/1.1 implementation with keep-alive and deferred responses\n- ServerSideEvents\n- WebSocket\n- Fileserver extension\n- Custom JSON parser/serializer implementation\n- Custom logger and formatter\n- [in progress] Request router\n\n## Performace (v2, outdated)\n\n\u003cimg src=\"docs/bench-v1-vs-v2.webp\" style=\"max-width: 720px\" /\u003e\n\n**A latency comparison between v1 and v2** (50 rps, 10s)\n\nI was able to push it all the way up to 25k rps but it's not stable at all at that rate.\n\nRemoving the task join list would help smooth that graph, but it's not what you wan't for memory safety.\nAlthough, if you are not planning to destroy a lambda instance (if you only create it once in program lifetime),\nyou may want to disable the task join list.\n\nNow let's get a bit crazy and crank it up to 5000 rps. At this point v1 just died, and v2 didn't even feel it:\n\n\u003cimg src=\"docs/bench-v2-5krps.webp\" style=\"max-width: 720px\" /\u003e\n\n## Error handling/exceptions\n\nBy default all exceptions should be caught by the `serve` handler. However, if you linkt the c++ standard library statically the exception handling may not work, which will break the app. So don't do that.\n\n\n## Building a server app with lambda\n\nI'm using GCC 12 here, you should be fine with any other version that supports C++ 20\nbut don't expect it to work with MSVC without doing a shaman dance first.\n\n### Linking\n\nYou can link lambda both as a dll (shared object) or a static (.a) library.\nBoth ways should be fine. In case you need a dll import object (.dll.a) it's generated too when building the `libshared` target.\n\nWhen on Windows, don't forget to link with winsock2 (add `-lws2_32`) or it will bite you in the ass.\n\n### Compiling your project\n\nLink `lambda.dll` and you're good to go. Oh, don't forget to include some headers, obviously.\n\nGo see [some examples or smthng](/examples)\n\n### A quick note before you start blasting\n\nUse GCC 12 or never. The project uses a few of the c++23 features, and it might not compile with older versions.\n\nOther compilers are not \\*officially\\* supported, but there aren't any super-GCC-specific tricks employed in this project, so theoretically with some tweaking it should compile anywhere.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaddsua%2Flambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaddsua%2Flambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaddsua%2Flambda/lists"}