Web Development in C++: From Basics to Deployment
Web Development in C++: From Basics to Deployment
Summary:
Contrary to stereotypes, C++ is not just about system programming and game engines. The modern C++17/20 standard, powerful libraries (Boost.Asio, Crow, Drogon, Pistache), and mature build tools (CMake, Conan) make C++ an excellent choice for high-load web services, API gateways, and microservices. This book is the first comprehensive practical guide in the Russian-speaking internet that will take you from setting up your environment to production deployment of a C++ web application.
What the book covers
- HTTP and network programming basics — client-server architecture, protocols, sockets, asynchronous I/O with Boost.Asio.
- Frameworks and libraries — overview and comparison of Crow, Drogon, Pistache, oatpp; choosing the right one for your task.
- REST API and JSON — endpoint design, serialization/deserialization using nlohmann/json and Boost.JSON.
- Databases — working with PostgreSQL via libpqxx, SQLite via sqlite_orm, connection pools.
- WebSockets and real-time — chats, notifications, data streaming.
- Security — protection against SQL injection, XSS, CORS, JWT authentication in C++.
- Testing — unit tests (Google Test), integration tests, load testing with wrk.
- Build and CI/CD — CMake + Conan, Docker containerization, deployment on VPS, Kubernetes.
Who this book is for
The book is intended for C++ developers with at least 1 year of experience who want to expand their skills in the web direction. You already know syntax, templates, STL, and CMake — here you will learn to apply them to create production-grade web services. The book will also be useful for backend developers in other languages (Java, Go, Python) who want to learn C++ for high-load components.
What you will learn and be able to do after reading
- Design and implement a RESTful API from scratch in C++.
- Set up an asynchronous web server handling thousands of requests per second.
- Integrate PostgreSQL and Redis into your application.
- Implement authentication via JWT and OAuth2.
- Write tests and set up automated builds in GitHub Actions.
- Package your application into a Docker image and deploy it on a remote server.
Each chapter contains practical code examples, ready to compile and run. All projects are available in a GitHub repository. By the end of the book, you will create a full-fledged microservice for task management (Task Manager API) with support for WebSockets, caching, and authorization.
Don't be afraid of the complexities — the author consistently reveals all the nuances, from choosing an HTTP library to performance optimization and monitoring. This book will be your reliable guide into the world of web development in C++.