📖 Interactive API reference: https://budget-buddy-org.github.io/budget-buddy-contracts/
This repository serves as the Single Source of Truth for the Budget Buddy ecosystem. We use a "Contract-First" approach, where the API is defined in OpenAPI 3.1 and then used to generate strongly-typed clients and server interfaces for all supported platforms.
The core of this project is the OpenAPI specification located in specs/openapi.yaml. From this single file, we derive three distinct targets:
| Target | Technology | Delivery Method | Usage |
|---|---|---|---|
| Frontend | TypeScript (fetch) | GitHub Packages (npm) | Web dashboard |
| Backend | Java + Spring Boot | GitHub Packages (Maven) | API Service implementation |
| Mobile | Swift 6 | Git Repo (SPM) | iOS / macOS application |
- Type Safety: Eliminate runtime errors caused by mismatched API schemas.
- Parallel Development: Frontend, Backend, and Mobile teams can work simultaneously against a shared interface.
- Documentation: The spec is the documentation.
- Consistency: Standardized error handling (RFC 9457) across all platforms.
pnpm install # installs Spectral and openapi-generator-cli as devDeps| Command | Description |
|---|---|
pnpm run lint |
Lints the spec with Spectral (operationId, tags, descriptions, 500 responses). |
pnpm run validate |
Checks the structural integrity of the OpenAPI document. |
pnpm run mock |
Runs a Prism mock server locally at http://localhost:4010. |
pnpm run generate |
Generates all clients (TS, Java, Swift) locally. |
pnpm run generate:swift |
Regenerates the committed Swift sources under Sources/BudgetBuddyContracts/. |
See the GitHub Release badge above for the latest version.
Add this repository as a dependency in your Package.swift:
dependencies: [
.package(url: "https://github.com/budget-buddy-org/budget-buddy-contracts.git", from: "<latest>")
]Install from GitHub Packages (requires .npmrc configuration pointing @budget-buddy-org to https://npm.pkg.github.com):
pnpm add @budget-buddy-org/budget-buddy-contractsAdd to your pom.xml (requires Maven server credentials for GitHub Packages):
<dependency>
<groupId>com.budgetbuddy</groupId>
<artifactId>budget-buddy-contracts</artifactId>
<version><!-- latest --></version>
</dependency>- Edit the spec:
specs/openapi.yaml(and/orconfig/*.yaml). - Lint and validate:
pnpm run lint && pnpm run validate. - Open a PR with a conventional-commit title (
feat:,fix:,feat!:, …). PRs are squash-merged, so the PR title becomes the commit onmainand drives semantic-release. - CI does the rest — on push to
main, the release pipeline:- calculates the next semver from commit history
- bumps
package.jsonandspecs/openapi.yamlto that version - regenerates and commits the Swift sources under
Sources/BudgetBuddyContracts/ - updates
CHANGELOG.md - creates the Git tag and GitHub Release
- publishes the TypeScript client to GitHub Packages (npm)
- publishes the Java Spring stubs to GitHub Packages (Maven)
- Local commits are checked by Husky + Commitlint.
- PRs are re-checked in CI; invalid messages cannot be merged.
- Release impact follows Conventional Commits:
fix:/perf:→ patchfeat:→ minor!suffix orBREAKING CHANGE:footer → major
- Currency: Monetary amounts are
integer(int64) in minor units — e.g.1050=€10.50. ISO 4217 codes accompany every amount. - Errors: Every error response uses
application/problem+jsonper RFC 9457. Field-level validation errors are surfaced asProblem.errors[]on400responses. - Pagination: List endpoints accept
page(zero-based, default 0) andsize(1–200, default 20) query parameters; the response carries aPaginationMetawithpage,size, andtotal. - Auth: Every endpoint requires a Bearer JWT issued by the OIDC provider — there are no auth endpoints in this spec.