⚠️ Early-stage
A modern, header-only (plus a small .cpp core) C++ client for SpacetimeDB, with HTTP, JSON and WebSocket support out of the box.
- Version: 0.1.0
- Library:
SpacetimeDbSdk(static) - Dependencies: libcpr (HTTP), nlohmann/json (JSON)
⚠️ This SDK is very early-stage many pieces still need implementation, wiring and testing.
-
Project layout (
include/,src/,tools/CodegenTool/,examples/,tests/) -
HttpClient wrapper around
cpr::cpr(Get/Post, headers overload) -
Json alias (
using Json = nlohmann::json;) -
Config & Client classes with Builder pattern
-
Umbrella header (
SpacetimeDB.hpp) andversion.hpp -
POST /v1/database -
POST /v1/database/:name_or_identity -
GET /v1/database/:name_or_identity -
DELETE /v1/database/:name_or_identity -
GET /v1/database/:name_or_identity/names -
POST /v1/database/:name_or_identity/names -
PUT /v1/database/:name_or_identity/names -
GET /v1/database/:name_or_identity/identity -
GET /v1/database/:name_or_identity/subscribe -
POST /v1/database/:name_or_identity/call/:reducer -
GET /v1/database/:name_or_identity/schema -
GET /v1/database/:name_or_identity/logs -
POST /v1/database/:name_or_identity/sql
- Code Generation from Schema (
GET /v1/database/{database}/schema) - Hook
tools/CodegenToolinto the build so thatinclude/Schema/Generated/is always up-to-date - Generate Native Coding from Schemas
- WebSocket client: Keep Spacetime Algebraic Types Fed From Subscriptions
- Identity Client + IdentityModels: All Requests parsed to Native C++
- Examples:
quickstart.cpp - Examples:
subscribe.cpp)
- Tests: Identity
- Tests: Database
- Internal APIs
- Move implementation-only helpers into
SpacetimeDb::detailnamespace - Consider Pimpl in public classes for ABI stability
- Move implementation-only helpers into
- Asynchronous support
- Add
asyncoverloads returning promises (e.g.std::future<Json>) or callbacks
- Add
- CMake install & export
- Add
install(TARGETS … EXPORT …) - Generate
SpacetimeDbSdkConfig.cmakeforfind_package(SpacetimeDbSdk CONFIG)
- Add
- Unit tests & coverage
- Mock
HttpClientto verify request paths, payloads, headers, and JSON marshalling
- Mock
- Documentation
- Populate
docs/api.mdwith class/method overviews and usage snippets - Add Doxygen comments in headers
- Populate
- CI/CD
- Set up GitHub Actions (or similar) for build, test, code-style, and codegen checks
Feel free to pick any of the “Next Steps” and submit a PR. Let’s get this SDK from prototype to production!