Backend & APIOpen source
C++ SQLite RESTful Library API
A high-performance, statically compiled REST API built in C++ to manage library transactions, leveraging the SQLite3 C API for direct memory-to-disk persistence.
Tech stack
- Languages
- Frameworks & libraries
- Tools
Performance & metrics
- Zero-overhead HTTP multiplexing and JSON parsing achieved by compiling directly to native machine code
- Eliminates ORM abstraction penalties by managing database cursors and statement lifecycles directly via C-level raw pointers
Why I built it
I needed a lightweight, dependency-free backend to handle relational data without the inherent memory overhead and GC pauses of frameworks like Spring Boot or Node.js. This project demonstrates how to build a highly concurrent REST architecture in raw C++ by directly orchestrating HTTP multiplexing, JSON serialization, and deterministic SQL execution entirely at the memory level.
Architecture & decisions
The application relies on cpp-httplib to bind a multithreaded HTTP listener to OS network interfaces. Incoming payloads are deserialized via nlohmann/json into strictly typed C++ domain objects (User, Book). To guarantee memory safety and absolute immunity to SQL injection, all database operations strictly bypass raw query execution; instead, they utilize the SQLite C-level prepared statement lifecycle (sqlite3_prepare_v2, sqlite3_bind_*, sqlite3_step, and sqlite3_finalize) using raw pointers.
Key features
- 01Multithreaded RESTful endpoints managing CRUD operations for relational library entities
- 02Strictly parameterized SQLite C API integration preventing malicious SQL injection payloads
- 03In-memory JSON deserialization mapping directly to C++ Object-Oriented domain models
- 04Autonomous HTTP routing and server execution utilizing header-only C++ network bindings