Introduction
Vitae uses oRPC (Open RPC) as its API framework, providing a type-safe, modern approach to building and consuming APIs. oRPC combines the developer experience of tRPC with OpenAPI compatibility, giving you end-to-end type safety with TypeScript while maintaining REST-like accessibility.Base URL
The API is served from your Vitae server instance:localhost:3000 with your deployed server URL.
The
/rpc prefix is used for all oRPC procedure calls. There’s also an /api-reference endpoint for OpenAPI documentation.Type Safety with TypeScript
One of the key benefits of oRPC is full end-to-end type safety. The client automatically infers types from your server router definition.Setting Up the Client
Here’s how the Vitae web app creates a type-safe client:The
credentials: 'include' option is crucial for sending authentication cookies with each request.TanStack Query Integration
Vitae integrates oRPC with TanStack Query for powerful data fetching and caching:Response Format
Success Response
Successful API calls return the data directly:Array Responses
List operations return arrays:Error Handling
Vitae uses oRPC’s built-in error handling with standardized error codes.Error Codes
Thrown when authentication is required but not provided. HTTP status: 401
Thrown when the user doesn’t have permission to access the resource. HTTP status: 403
Thrown when the requested resource doesn’t exist. HTTP status: 404
Thrown when an unexpected server error occurs. HTTP status: 500
Error Response Example
Handling Errors in Client Code
Here’s how the Vitae web app handles errors globally:Rate Limiting
Currently, Vitae does not implement rate limiting. For production deployments, consider adding rate limiting middleware using packages like
@hono/rate-limiter or implementing it at the reverse proxy level.Quick Example
Here’s a complete example of making an API call to list all resumes:Available Endpoints
Vitae exposes the following procedure categories:- Health & Status: Health check endpoints
- Resume Management: Create, read, update, and delete resumes
- Resume Sharing: Manage public/private status and get public resumes
- Analytics: Track views and downloads
- Assets: Upload resume thumbnails
Next Steps
Authentication
Learn how authentication works with Better-Auth
Endpoints
Explore all available API endpoints