Skip to content

Conversation

@ahmedrowaihi
Copy link

@ahmedrowaihi ahmedrowaihi commented Nov 30, 2025

Summary

This PR migrates both internal and public APIs from tRPC/manual REST to oRPC, leveraging automatic OpenAPI generation for improved developer experience and type safety, it's also more portable and better performant.

Changes

enhanced development env docs + 3rd parties lazy required for faster development startup.

decoupled business logic from router, layer-system.

Internal API Migration

  • Migrated from tRPC to oRPC for internal API routes
  • Updated all client components to use oRPC hooks (useORPC) instead of tRPC
  • New oRPC route handler at /api/(internal-api)/orpc/[...orpc]/route.ts
  • Automatic OpenAPI generation for internal routes at /api/orpc/openapi.json
  • Replaced tRPC dependencies with oRPC packages:
    • @orpc/client, @orpc/server, @orpc/react-query, @orpc/openapi, @orpc/zod
  • Updated React provider from TRPCReactProvider to ORPCReactProvider

Public API Refactoring

  • Replaced manual REST route handlers with oRPC-based public API using OpenAPIHandler
  • Removed individual route files under /api/(public-api)/v1/namespace/ (documents, ingest-jobs, hosting, uploads, etc.)
  • New unified handler at /api/(public-api)/v1/[...path]/route.ts using oRPC's OpenAPIHandler
  • Automatic OpenAPI generation for public API at /api/(public-api)/v1/openapi.json
  • Removed manual OpenAPI specification (zod-openapi and all files in src/openapi/ directory)

OpenAPI Generation

  • Automatic OpenAPI 3.1.1 specification generation using @orpc/openapi for both internal and public APIs
  • Removed manual OpenAPI definitions - no longer maintaining manual spec files
  • Type-safe API documentation automatically generated from oRPC routers
  • OpenAPI endpoints:
    • Internal API: /api/orpc/openapi.json
    • Public API: /api/(public-api)/v1/openapi.json

Infrastructure Improvements

  • Enhanced error handling with consistent API responses
  • Rate limiting support with proper headers in API responses
  • Service layer refactoring - extracted business logic into service functions
  • Added DEVELOPMENT.md documentation

Technical Details

Internal API Structure

  • Uses oRPC for type-safe RPC calls
  • React Query integration via @orpc/react-query
  • Automatic OpenAPI generation from oRPC router

Public API Structure

  • Single catch-all route handler using oRPC's OpenAPIHandler
  • Automatic REST endpoint generation from oRPC router
  • OpenAPI spec automatically generated from router definitions

Migration Notes

  • Internal API consumers: Updated to use oRPC hooks - breaking change from tRPC

  • Public API consumers: API endpoints remain the same, but now powered by oRPC with automatic OpenAPI generation

  • OpenAPI specs: Now automatically generated instead of manually maintained

  • OpenAPI endpoints:

    • Internal: /api/orpc/openapi.json
    • Public: /api/(public-api)/v1/openapi.json
  • All internal API routes migrated to oRPC

  • All client components updated to use oRPC hooks

  • Public API endpoints working with oRPC handler

  • OpenAPI specifications generating correctly for both APIs

@vercel
Copy link

vercel bot commented Nov 30, 2025

@ahmedrowaihi is attempting to deploy a commit to the Agentset Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Nov 30, 2025

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

88 files out of 195 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- Migrate from tRPC to oRPC
- enhance public routes
- openapi for all internal routes
- Introduced a new public API handler utilizing oRPC for improved performance and structure.
- Replaced existing namespace, document, hosting, and ingest job routes with new implementations.
- Added OpenAPI specification generation for public API routes.
- Removed deprecated namespace routes and integrated functionality into the new public API structure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant