Crow Demo Backend
A C++ REST backend on the Crow framework that serves devices (laptops and servers) from a repository-pattern in-memory store. Built with CMake FetchContent.
- Language
- C++
- Year
- 2026
- Team
- Solo
- Stack
- C++
- Crow
- CMake
- REST
- CMake
- FetchContent
- Crow
Features
- Create, read, update and delete devices under /devices.
- Two device types: laptops with their battery life and servers with RAM and cores.
- Every JSON body is validated, and errors come back as 400 Bad Request with a message.
- Ids are unique; a second device with the same id is rejected.
- Ready-made test requests for every endpoint in an .http file.
How it's built
C++ with the header-only Crow framework, which CMake downloads at build time through FetchContent. A build script configures and builds the project and starts the server on port 3000.
Devices use inheritance: Laptop and Server derive from an abstract Device and override getSpecs(). Storage is described by an IDeviceRepository interface and implemented in memory; the routes are given the in-memory class directly.
The routes are registered in one small function per HTTP method. Incoming JSON is parsed with Crow's JSON reader and turned into the right device type, or rejected with an explanation.