OPRA is a TypeScript framework for building RICH APIs — APIs that go beyond simple REST endpoints. Define your schema once and get validation, documentation, and a fully typed client for free. Run the same service over HTTP, WebSocket, Kafka, RabbitMQ, or Socket.io without changing your business logic.
@ComplexType({ description: 'Application user' })
export class User {
@ApiField({ type: 'integer' }) declare id: number;
@ApiField() declare name: string;
@ApiField() declare email: string;
}
@HttpController({ path: 'users' })
export class UsersController {
@HttpOperation.Entity.FindMany({ type: User })
async findMany() { }
@HttpOperation.Entity.GetOne({ type: User })
@HttpOperation.PathParam('id', 'integer')
async getOne(id: number) { }
}That's it — schema, validation, docs, and a typed client are all derived automatically.
| Without OPRA | With OPRA |
|---|---|
| Define models, write OpenAPI spec, add validation — keep all three in sync | Define once. Everything else is derived. |
| Handwrite an HTTP client. Update it every time something changes | Run oprimp. Get a fully typed client. |
| Implement pagination, filtering, sorting for every entity | Extend a base service class — it's built in |
| Separate implementations for HTTP, WebSocket, Kafka, RabbitMQ | One schema. All transports. |
| Write docs separately. Watch them drift | Docs are always correct — they can't not be |
OPRA is a monorepo. Pick what you need:
| Package | Description |
|---|---|
@opra/common |
Core schema model, decorators, type system, filter DSL |
@opra/core |
Runtime engine — request lifecycle, validation, routing |
@opra/http |
Standalone HTTP adapter |
@opra/client |
Auto-generated type-safe HTTP client |
@opra/cli |
CLI tools — oprimp for client generation |
@opra/nestjs |
NestJS integration |
@opra/nestjs-http |
NestJS HTTP adapter |
@opra/nestjs-kafka |
NestJS + Kafka transport |
@opra/nestjs-rabbitmq |
NestJS + RabbitMQ transport |
@opra/nestjs-socketio |
NestJS + Socket.io transport |
@opra/kafka |
Standalone Kafka transport |
@opra/rabbitmq |
Standalone RabbitMQ transport |
@opra/socketio |
Standalone Socket.io transport |
@opra/mongodb |
MongoDB data service base |
@opra/elastic |
Elasticsearch data service base |
@opra/sqb |
SQL (SQB) data service base |
@opra/angular |
Angular client integration |
@opra/testing |
Testing utilities |
npm install @opra/common @opra/core @opra/nestjs-httpSee the Getting Started guide for a complete walkthrough.
- node >= 20.x
Found a bug or have a question? Open an issue on the GitHub issues page. Please include your Node.js version when reporting bugs.
OPRA is available under the MIT license.