Skip to content

Conversation

@FaiiFaiipuipui
Copy link
Collaborator

Issue ID/Name

Description

Checklist

  • I have self-reviewed my code.
  • I have commented on my code, particularly in the hard-to-understand area.
  • [-] New and existing unit tests pass locally with my change.
  • I have tagged a reviewer for this PR.
  • (Should Be) I have NOT committed the modified environment/config file(s) to this PR.

Additional configuration/environment

Test result

Screenshot(s) or demo video

Reviewer

Remark

Upgrade to ESM module system to enable use of zod 3.25.0 and @orpc packages (required for OpenAPI generation from tRPC). Both packages are ESM-only and cannot be imported in CommonJS projects.

Changes:
- Add type: module to package.json and configure ESNext in tsconfig
- Install and configure @swc-node/register for ESM runtime with decorator support
- Replace __dirname with ESM-compatible import.meta.url
- Add explicit enum types to TypeORM columns for proper metadata emission
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates ORPC (OpenAPI Router for Procedure Calls) to wrap the existing tRPC implementation, enabling automatic OpenAPI documentation generation for the ESC Project Tracker API. The changes upgrade tRPC from v10 to v11 and add API documentation endpoints accessible via Scalar UI.

Key Changes:

  • Upgraded tRPC from v10.45.2 to v11.7.0 across both web and api packages
  • Integrated ORPC libraries (@orpc/trpc, @orpc/openapi, @orpc/zod) to generate OpenAPI specifications
  • Added metadata tags and summaries to all tRPC procedures for API documentation
  • Configured ESM module system for the API package

Reviewed Changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
apps/web/package.json Updated tRPC client dependencies to v11.7.0 and reordered @repo/shared
apps/api/package.json Added ORPC packages, upgraded tRPC to v11.7.0, configured ESM support, and updated dev scripts
apps/api/tsconfig.json Changed module system from NodeNext to ESNext with bundler resolution
apps/api/src/app.module.ts Added ESM-compatible __dirname polyfill using fileURLToPath
apps/api/src/trpc/trpc.service.ts Added ORPCMeta type to tRPC initialization for metadata support
apps/api/src/trpc/trpc.router.ts Implemented OpenAPI generator, created /openapi.json endpoint, and added Scalar reference UI at /reference
apps/api/src/entities/document.entity.ts Explicitly typed enum columns in TypeORM entity definition
apps/api/src/trpc/routers/*.router.ts Added .meta() calls with tags and summaries to all tRPC procedures for documentation
README.md Added API documentation section with instructions for accessing and exporting OpenAPI specs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@FaiiFaiipuipui
Copy link
Collaborator Author

Further comment on Trpc migration of v10 to v11. From the website, we're not using any feature impacted by the new major version, so I've decided to migrate.

It's another thing for Zod v4 tho...

@FaiiFaiipuipui
Copy link
Collaborator Author

Also, migrated to ESM module bc Orpc does not support commonjs. Honestly zod 3.25 also stopped supporting commonjs. If we did not change to ESM we'll need to use older version of at least these pacakges: Orpc, Trpc, Zod. The second two are migrated to newer version because of peer dependency warning when install Orpc and Orpc/zod.

@neennera neennera merged commit 21afe09 into main Oct 27, 2025
4 checks passed
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.

2 participants