Overview
QeetMart uses contract-first API development with OpenAPI 3.0.3 specifications as the source of truth. All API changes are validated through automated linting and breaking change detection.Contract location
All OpenAPI specifications are stored in thecontracts/openapi/ directory:
Contract validation commands
Lint contracts
Validate that all OpenAPI specs follow required standards:tools/ci/openapi-lint.mjs which checks:
Path structure
Verifies each path:
- Starts with
/ - Contains at least one HTTP operation
- Has valid HTTP methods (GET, POST, PUT, PATCH, DELETE, etc.)
Check breaking changes
Detect breaking changes between the current branch and base branch:tools/ci/openapi-breaking.mjs which enforces:
- No file deletion: Removing a contract file is breaking
- No path removal: Deleting endpoints breaks existing clients
- No operation removal: Removing HTTP methods is breaking
- No new required parameters: Adding required params breaks clients
- No new required request fields: Adding required body fields is breaking
- No response code removal: Removing documented responses is breaking
Contract linting rules
The linter enforces these requirements:Required metadata
Path validation
- Paths must start with
/ - Each path must have at least one HTTP operation
- Path items must be objects
Operation validation
summary: Brief description of the operationoperationId: Unique identifier (used for client generation)responses: At least one response code defined
Duplicate detection
The linter ensures nooperationId appears twice in the same spec.
Breaking change detection
The breaking change checker compares the current spec against the base branch:How it works
Breaking change examples
Non-breaking changes
These changes are safe and won’t fail the breaking change check:- Adding new paths or operations
- Adding optional parameters
- Adding optional request fields
- Adding new response codes
- Updating descriptions or examples
- Adding new response fields (additive changes)
Generated API clients
After syncing OpenAPI specs to the docs app, you can generate TypeScript API clients:packages/openapi-clients/ and can be imported in frontend apps:
Contract sync workflow
When you update a contract:Check for breaking changes
CI enforcement
The CI workflow (.github/workflows/ci.yml) runs contract checks automatically:
Example: Auth Service contract
The auth service contract defines identity endpoints:Best practices
- Update contracts before implementing features
- Run both lint and breaking checks before committing
- Document all parameters and response schemas
- Use semantic versioning for
info.version - Keep contracts and implementation in sync
- Never delete contracts without coordinating with consumers
Next steps
- Review the API Reference for detailed endpoint documentation
- Learn about deployment workflows