feat: add REST API with tRPC-to-OpenAPI#700
Draft
kushpvo wants to merge 9 commits into
Draft
Conversation
…dAt, drop filter(Boolean)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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