OpenAPI specifications and TypeScript type definitions for the SecPal API.
This repository contains the API contracts that define the interface between the SecPal frontend and backend services. It includes:
- OpenAPI Specifications: RESTful API definitions in OpenAPI 3.x format
- TypeScript Types: Generated TypeScript interfaces and types
- Validation Schemas: Request/response validation schemas
- API Documentation: Human-readable API documentation
contracts/
βββ openapi/ # OpenAPI specification files
β βββ main.yaml # Main API specification
β βββ schemas/ # Reusable schema definitions
βββ src/ # TypeScript source files
β βββ types/ # Generated TypeScript types
βββ docs/ # Generated API documentation
βββ tests/ # Contract tests and validation
- Node.js 22+
- npm or yarn
npm install
npm run generate
npm run validate
npm run build
import { User, LogEntry, Shift } from "@secpal/contracts";
const user: User = {
id: "123",
email: "user@example.com",
// ...
};
import { CreateLogEntryRequest, LogEntryResponse } from "@secpal/contracts";
// Use for request/response typing
Before EVERY commit, run these checks locally:
# 1. Quick validation
npm run check
# 2. Check for uncommitted changes
git status
# 3. Commit with signed commit
git commit -S -m "type(scope): description"
npm run format:check # Code formatting
npm test # Run all tests
npm run validate # OpenAPI validation
npm run build # TypeScript compilation
npm audit # Security vulnerabilities
npx reuse lint # License compliance
./scripts/check-licenses.sh # License compatibility check
Recommended scripts in package.json
:
{
"scripts": {
"check": "npm run format:check && npm test && npm run validate && npm run build && npm audit --production && npx reuse lint",
"check:full": "npm run check && ./scripts/check-licenses.sh"
}
}
π‘ Tip: Running
npm run check
catches most CI failures before push!
- Update OpenAPI specification in
openapi/main.yaml
- Run
npm run generate
to update TypeScript types - Run
npm run validate
to ensure spec is valid - Run
npm run check
to validate everything - Create a PR with your changes
npm test # Run tests once
npm run test:watch # Run tests in watch mode
npm run check # Run all validations
Types are automatically published to npm when a new version tag is pushed:
npm version patch|minor|major
git push --tags
This project is licensed under the AGPL-3.0-or-later license.
See LICENSE for the full license text.
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
For security issues, please email security@sepal.app. Do not create public issues for security vulnerabilities.
See SECURITY.md for our security policy.