What I learned building an xAPI 2.0 library and LRS for .NET
Description and use
xapi-dotnet is a modern .NET library and LRS for xAPI 2.0, fully ADL‑conformant, with a durable outbox and Unity/WebGL support.
Problem
Existing .NET xAPI libraries lack xAPI 2.0 support and have performance and reliability issues.
Outcome
xapi-dotnet now fully supports xAPI 2.0, passes all ADL conformance tests, offers durable outbox, and runs in Unity/WebGL. It improves JSON parsing performance by ~60% and reduces memory allocation.
Workflow
- 1. Implement statement models and validation for xAPI 2.0.
- 2. Build async client with durable disk‑based outbox.
- 3. Embed LRS in ASP.NET Core with EF Core on SQLite/PostgreSQL.
- 4. Integrate ADL conformance suite in CI, parsing JSON log to enforce test floor.
- 5. Optimize JSON parsing performance and validation error reporting.
- 6. Add Unity support, including WebGL handler and async file read adjustments.
- 7. Publish NuGet package and Docker image, provide migration guide from TinCan.NET.
Evidence
TinCan.NET last changed in 2018. It targets net35, its calls block, and it has no xAPI 2.0 support.
The LRS now passes all 1,365 and all 1,435 tests, on both databases, in four CI jobs on every pull request.
Reading the same statement takes 5.48 μs and 5.2 KB, about four times the cost of JsonDocument.Parse over the same bytes.
The file store flushes its journal to disk before EnqueueAsync returns, and that turned out to be almost all of the cost: 4.7 ms per enqueue on my M1 Pro.
- Record date: 2026-10-17T18:56:13.142Z