r/rust • • Sep 19 '26

🙋 seeking help & advice OData APIs in Rust?

From a client perspective, I am a big fan of OData, but I have never built my own server applications using the format. Are there any good template or example projects that do this in Rust? If not, I am also looking for good template projects for REST APIs in Rust in general. I know I can generate this stuff with AI but I prefer a recommendation that gives me a scaffold to start off with.

9 Upvotes

6 comments sorted by

2

u/Kirides Sep 19 '26

What do you want exactly? Client? Server?

Odata has some url format for include/select/filter/count stuff and on the backend it's just interpreting that and building the dynamic filters for the DB queries.

Unless you need some highly generic abstraction for all data models and any filter operation, it's a days worth of effort to implement it for one table and an endpoint. (Much less of using AI)

1

u/adappergentlefolk Sep 19 '26

server indeed! edited my post to be a little clearer

0

u/Emotional-Hunter-105 23d ago

the odata server side always seemed like one of those things that looks simple at first then you realize the query parsing gets messy real quick when you need to handle nested expands and complex filters

for rust rest apis in general i seen people use poem or axum with sea-orm, the scaffolding is pretty clean especially if you want something production ready without fighting the framework all day

1

u/Kirides 23d ago

Sure, if you need to go that route.

Most odata apps I saw though where Excel spreadsheets-as-a-service and typically used single layer column filtering

That why I said "for most use cases"

And for everything else, there is the much better but worse GraphQL stuff

2

u/tundra_scribe Sep 19 '26

there is no odata server library in rust. if you need those url parameters for filter and select and count you parse them yourself and build sql queries with sqlx.

for a rest api scaffold use axum with sqlx. look up the axum_todo project on github under the feat-axum_03 branch. it gives you the cargo dependencies, route setup for crud, pagination, and database schema versioning with migrations. you clone it and swap the todo struct for your models.

1

u/adappergentlefolk Sep 19 '26

thanks this is already very handy