feat: add REST API with tRPC-to-OpenAPI#700
Conversation
…dAt, drop filter(Boolean)
|
Thanks for this, however, I am curious if you explored using the official tRPC/openapi? I know it's in alpha, but as I recall these openapi projects tend to lose maintainers and I would feel more comfortable with an official dependency. I know it's in alpha, but the API of SplitPro is also not a critical component right now and I think it's fine to experiment with this. Also there is an agent skill which might help with trying this out. |
Raised #707 that uses the official tRPC/openapi alpha |
Description
Adds a REST API to SplitPro using
trpc-to-openapi, exposing a curatedsubset of existing tRPC procedures at
/api/v1/*for integrations withexternal tools (Actual Budget, Firefly III, bots, etc.).
What's included
middleware that validates
X-API-Keyheader, throttledlastUsedAtGET /me,GET /friendsGET /groups,GET /groups/{id},GET /groups/{id}/balances,GET /groups/{id}/expensesGET /expenses,GET /expenses/{id}POST /expenses,PUT /expenses/{id},DELETE /expenses/{id}since,limit,offset) andgroupIdfiltering/api/openapi.jsonand Swagger UI at/api/docssplitService— create, update, and deleteuse existing service functions for transactional safety, group
membership validation, recurrence handling, and push notifications
Architecture
The
openapi.tsrouter is a thin mapping layer: REST JSON input →CreateExpenseformat →splitService, with no duplicated businesslogic. The
createOpenApiContextintrpc.tsauthenticates API keysand synthesizes a session for use with
protectedProcedure.Closes #615
Demo
Swagger UI at
/api/docs:Example request:
Disclaimer
AI was used to create this PR. All code has been throughly reviewed and tested locally.
Checklist
CONTRIBUTING.mdin its entirety