Crate - Design by Introspection for D web APIs
Bogdan Szabo
contact at szabobogdan.com
Fri Feb 27 22:19:20 UTC 2026
Hey all,
Sharing a project I've been working on for about 9 years now
called Crate. Honestly, I've been hesitant to put it out there
for a long time, but it's been running in production, and I
figured it's finally time. It might still have issues here and
there, but it works great for my projects. Docs and weird code
might still be present, so please excuse any issues in advance.
If you've seen Andrei's Design by Introspection talk, this is
that idea applied to building web APIs. You define your data
models as regular D structs, and Crate uses compile-time
introspection to generate everything else - routing, CRUD
operations, validation, serialisation, the whole stack. No code
generation steps, no external tooling, just D's type system doing
what it does best.
The same model definitions work across REST, JSON:API, GraphQL,
and MCP protocols. Swap one line, and your API speaks a different
protocol. Storage backends (MongoDB, in-memory) are similarly
interchangeable. It all sits on top of vibe.d.
It also introspects to generate OpenAPI docs and client code for
TypeScript, Swift, and Kotlin — directly from your D types at
compile time.
MIT licensed: https://gitlab.com/szabobogdan3/crate
Feedback welcome.
More information about the Digitalmars-d-announce
mailing list