-
-
Notifications
You must be signed in to change notification settings - Fork 27
feat(nest): implement contract in NestJS #480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
## Walkthrough
This update introduces a comprehensive oRPC integration for the NestJS framework, centered around a new `@orpc/nest` package. It includes implementation, utility functions, and decorators for contract-based RPC in NestJS, extensive documentation, type and runtime tests, and a full-featured NestJS playground app demonstrating contract definition, controller implementation, service logic, OpenAPI generation, and client integration.
## Changes
| Files/Groups | Change Summary |
|--------------------------------------------------------------------------------------------------|----------------|
| `packages/nest/src/implement.ts`, `packages/nest/src/utils.ts`, `packages/nest/src/index.ts` | Added core implementation: `@Implement` decorator, interceptor, contract path utilities, and re-exports for oRPC/NestJS integration. |
| `packages/nest/src/implement.test.ts`, `packages/nest/src/implement.test-d.ts`, `packages/nest/src/utils.test.ts`, `packages/nest/src/utils.test-d.ts` | Added runtime and type-level tests for decorator, interceptor, and utility functions. |
| `packages/nest/package.json`, `packages/nest/README.md`, `packages/nest/.gitignore`, `packages/nest/tsconfig.json`, `packages/nest/tsconfig.test.json` | Added package metadata, documentation, gitignore, and TypeScript configs for the new package. |
| `apps/content/docs/openapi/nest/implement-contract.md`, `apps/content/.vitepress/config.ts`, `apps/content/docs/playgrounds.md`, `apps/content/index.md` | Added/updated documentation and sidebar entries for NestJS integration and playground. |
| `playgrounds/nest/**` | Introduced a full NestJS playground: controllers, services, contract definitions, schemas, OpenAPI reference, client integration, configs, and documentation. |
| `eslint.config.js`, `tsconfig.json`, `package.json`, `vitest.jsdom.ts` | Updated project-level configs for type-checking, linting, and testing to accommodate new package and playground. |
| `packages/*/README.md` | Added `@orpc/nest` to the list of packages in all relevant oRPC package READMEs. |
| `playgrounds/*/README.md` (other playgrounds) | Corrected Scalar API Client URL paths in documentation. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant Client
participant NestController
participant @Implement Decorator
participant ORPC Procedure/Router
participant NestInterceptor
participant Service
Client->>NestController: HTTP request (matches contract route)
NestController->>@Implement Decorator: Method decorated
@Implement Decorator->>NestInterceptor: Attach interceptor, route metadata
NestInterceptor->>ORPC Procedure/Router: Decode, invoke handler
ORPC Procedure/Router->>Service: (Business logic)
Service-->>ORPC Procedure/Router: Result/Error
ORPC Procedure/Router-->>NestInterceptor: Encoded response/error
NestInterceptor-->>NestController: Send HTTP response
NestController-->>Client: HTTP response Assessment against linked issues
Poem
|
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
More templates
@orpc/arktype
@orpc/client
@orpc/nest
@orpc/contract
@orpc/openapi
@orpc/openapi-client
@orpc/react
@orpc/react-query
@orpc/server
@orpc/shared
@orpc/solid-query
@orpc/standard-server
@orpc/standard-server-fetch
@orpc/standard-server-node
@orpc/standard-server-peer
@orpc/svelte-query
@orpc/valibot
@orpc/vue-colada
@orpc/vue-query
@orpc/zod
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 20
🧹 Nitpick comments (34)
playgrounds/nest/.gitignore (4)
1-4
: Consider adding TypeScript incremental build artifacts
It's common for projects usingtsc --incremental
to generate.tsbuildinfo
files. Ignoring them prevents accidental commits of build metadata.Apply this diff to include the pattern:
/dist /node_modules /build +*.tsbuildinfo
15-17
: Add common Windows OS artifacts
You already ignore macOS.DS_Store
. You may also want to ignore Windows shell files likeThumbs.db
anddesktop.ini
to cover cross-OS development.# OS .DS_Store +Thumbs.db +desktop.ini
22-30
: Editor swap and backup files
You ignore IDE project files, but vim/emacs swap or backup files can slip in. Consider adding patterns like*~
and*.swp
.# IDEs and editors /idea ... *.sublime-workspace +*~ # Emacs/Vim backup files +*.swp # Vim swap files
55-57
: Ensure file ends with a single newline
A trailing newline at EOF is a small but helpful convention to prevent issues with some tools and diffs.playgrounds/nest/src/main.ts (1)
4-8
: Consider enhancing the bootstrap function with additional configurations.The bootstrap function works correctly, but could benefit from:
- Error handling
- CORS configuration if the API will be accessed from different origins
- Logging to indicate when the server starts and on which port
- Swagger/OpenAPI documentation setup for this playground environment
async function bootstrap() { const app = await NestFactory.create(AppModule) + // Enable CORS for all origins in playground + app.enableCors() + + // Log when server starts + const port = process.env.PORT ?? 3000 - await app.listen(process.env.PORT ?? 3000) + await app.listen(port) + console.log(`🚀 Server running on port ${port}`) } bootstrap().catch(err => { console.error('Failed to start server:', err) process.exit(1) })playgrounds/nest/src/app.module.ts (1)
9-14
: Module structure looks good with proper organization of components.The AppModule correctly registers all controllers and providers, following NestJS best practices with proper separation of concerns (auth, planet, reference, and other controllers).
For a more comprehensive playground, you might consider adding commonly used NestJS modules:
@Module({ - imports: [], + imports: [ + // ConfigModule.forRoot({ isGlobal: true }), // For environment variables + // TypeOrmModule.forRoot({...}), // For database integration example + ], controllers: [AuthController, PlanetController, ReferenceController, OtherController], providers: [PlanetService, ReferenceService], }) export class AppModule {}packages/nest/tsconfig.test.json (1)
1-16
: Test configuration setup looks appropriate for NestJS testing.The tsconfig.test.json file is properly configured for testing a NestJS package:
- Extends the base configuration
- Enables experimentalDecorators (required for NestJS)
- Includes necessary type definitions
- Correctly specifies test files to include
If you're using custom type definitions or assertion libraries in your tests, consider adding them to the "types" array:
"compilerOptions": { "experimentalDecorators": true, - "types": ["node", "vitest/globals"] + "types": ["node", "vitest/globals"/* , other types if needed */] },playgrounds/nest/src/schemas/auth.ts (1)
8-10
: Token schema provides simple token validation.The
TokenSchema
correctly validates that the token is a string. Consider adding more specific validation if your tokens follow a particular format (e.g., JWT pattern validation).playgrounds/nest/src/other/other.controller.ts (2)
7-10
: Remove unnecessary empty constructor.The empty constructor serves no purpose and should be removed.
@Controller() export class OtherController { - constructor() {} @Implement(contract.sse)
🧰 Tools
🪛 Biome (1.9.4)
[error] 9-9: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
16-20
: Consider making the event interval configurable.The interval between events is hardcoded to 1000ms. For better flexibility, consider making this configurable.
const MAX_EVENTS = 5 +const EVENT_INTERVAL_MS = 1000 @Controller() export class OtherController { @Implement(contract.sse) list() { return implement(contract.sse).handler(async function* () { let count = 0 while (count < MAX_EVENTS) { count++ yield { time: new Date() } - await new Promise(resolve => setTimeout(resolve, 1000)) + await new Promise(resolve => setTimeout(resolve, EVENT_INTERVAL_MS)) } }) } }playgrounds/nest/src/auth/auth.controller.ts (1)
7-7
: Remove unnecessary constructorThe constructor doesn't have any injected dependencies or initialization logic, making it unnecessary.
- constructor() {}
🧰 Tools
🪛 Biome (1.9.4)
[error] 7-7: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
playgrounds/nest/src/contract/index.ts (2)
12-17
: Add JSDoc comments to clarify renamed method aliasesThe planet methods have been renamed from their original form (e.g.,
listPlanets
tolist
). While this creates a cleaner API, it could cause confusion. Consider adding JSDoc comments to clarify the mapping.planet: { + /** + * Alias for listPlanets - Lists all planets with pagination + */ list: listPlanets, + /** + * Alias for createPlanet - Creates a new planet + */ create: createPlanet, + /** + * Alias for findPlanet - Finds a planet by ID + */ find: findPlanet, + /** + * Alias for updatePlanet - Updates a planet by ID + */ update: updatePlanet, },
1-20
: Add module JSDoc documentationConsider adding JSDoc documentation at the top of the file to explain the contract's purpose and structure. This improves code readability and helps developers understand how to use the contract.
+/** + * Central contract definition that consolidates all API contracts. + * This object serves as the single entry point for both server-side implementations + * and client-side consumption of the API. + * + * Contracts are organized by domain: + * - auth: Authentication related endpoints + * - planet: Planet management endpoints + * - sse: Server-sent events endpoints + */ import { me, signin, signup } from './auth' import { createPlanet, findPlanet, listPlanets, updatePlanet } from './planet' import { sse } from './sse'playgrounds/nest/package.json (2)
16-22
: Consider using fixed versions instead of 'next' tag for oRPC dependencies.Using the
next
tag for dependencies (@orpc/*
) can lead to unexpected behavior as the packages may update with breaking changes. For a playground that's meant to be stable and demonstrative, consider using fixed versions.- "@orpc/client": "next", - "@orpc/contract": "next", - "@orpc/nest": "next", - "@orpc/openapi": "next", - "@orpc/openapi-client": "next", - "@orpc/react-query": "next", - "@orpc/zod": "next", + "@orpc/client": "^1.0.0", // Replace with actual version + "@orpc/contract": "^1.0.0", // Replace with actual version + "@orpc/nest": "^1.0.0", // Replace with actual version + "@orpc/openapi": "^1.0.0", // Replace with actual version + "@orpc/openapi-client": "^1.0.0", // Replace with actual version + "@orpc/react-query": "^1.0.0", // Replace with actual version + "@orpc/zod": "^1.0.0", // Replace with actual version
5-9
: Consider adding a test script to the package.json.The package.json includes scripts for preview, development, and type checking, but no script for running tests. Adding a test script would make it easier for developers to run tests for this playground.
"scripts": { "preview": "nest build && tsx dist/main.js", "start:dev": "nest start --watch", - "type:check": "tsc --noEmit" + "type:check": "tsc --noEmit", + "test": "jest" },playgrounds/nest/src/contract/auth.ts (1)
25-32
: Consider adding authentication requirement metadata to the 'me' endpoint.The 'me' endpoint typically requires authentication but there's no metadata indicating this requirement. Consider adding authentication metadata to make this explicit for consumers and documentation systems.
export const me = oc .route({ method: 'GET', path: '/auth/me', summary: 'Get the current user', tags: ['Authentication'], + security: [{ BearerAuth: [] }], // Explicitly indicate auth requirement }) .output(UserSchema)
packages/nest/src/utils.test.ts (2)
11-11
: Consider adding a descriptive comment for the mixed pattern test case.The test case for
'/{id}/name{name}'
is testing an edge case mixing path parameters with parameter-like segments in the path. A comment would help clarify what this test is verifying.- expect(toNestPattern('/{id}/name{name}')).toBe('/:id/name{name}') + // Test that path parameters within segments are not transformed + expect(toNestPattern('/{id}/name{name}')).toBe('/:id/name{name}')
14-38
: Consider adding tests for edge cases in path generation.While the tests are comprehensive, consider adding tests for additional edge cases:
- Empty path segments
- Multiple levels of nesting
- Routes with both input and output schemas
- Custom path overrides at different nesting levels
it('populateContractRouterPaths', () => { // Existing test cases... + // Test deeper nesting levels + const deeplyNested = { + level1: { + level2: { + level3: oc.input(inputSchema), + } + } + } + + const populatedDeep = populateContractRouterPaths(deeplyNested) + expect(populatedDeep.level1.level2.level3['~orpc'].route.path).toBe('/level1/level2/level3') + + // Test with both input and output schemas + const bothSchemas = { + complete: oc.input(inputSchema).output(outputSchema) + } + + const populatedBoth = populateContractRouterPaths(bothSchemas) + expect(populatedBoth.complete['~orpc'].route.path).toBe('/complete') + expect(populatedBoth.complete['~orpc'].inputSchema).toBe(inputSchema) + expect(populatedBoth.complete['~orpc'].outputSchema).toBe(outputSchema) })packages/nest/src/index.ts (3)
1-2
: Ensure local module exports are tested.
Static analysis indicates that exports from./implement
and./utils
are not covered by tests. Please add unit or integration tests that import these modules via the public API (@orpc/nest
) and verify their exported members behave as expected.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 2-2: packages/nest/src/index.ts#L2
Added line #L2 was not covered by tests
4-4
: Add test coverage for external re-exports.
Theimplement
andORPCError
exports from@orpc/server
aren’t covered by the existing test suite. Validate through tests that these symbols are accessible and function correctly when imported from@orpc/nest
.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 4-4: packages/nest/src/index.ts#L4
Added line #L4 was not covered by tests
5-13
: Consider adding type-level tests for re-exported types.
You’ve re-exported several types (ImplementedProcedure
,Implementer
, etc.). It’s worth adding a*.test-d.ts
to assert that these types correctly resolve and match expectations, ensuring consumers get the intended type definitions.playgrounds/nest/src/schemas/user.ts (2)
7-22
: Well-formedNewUserSchema
with OpenAPI examples.
This schema correctly defines required fields and attaches example metadata. Consider adding adescription
or aminLength
constraint forpassword
if you want more realistic playground validation.
24-39
:UserSchema
is accurate and leverages examples.
The output schema is concise and correctly decorated for OpenAPI. Optionally, you could include field descriptions or deprecation notices if necessary in the future.packages/nest/src/implement.test-d.ts (1)
13-13
: Consider creating type-safe mocks rather than usingas any
casts.While using
({}) as any
is acceptable in test files to focus on specific type checks, consider creating proper type-safe mock implementations to improve readability and maintainability of tests.- return implement(contract).handler(() => ({}) as any) + return implement(contract).handler(() => ({ /* mock response matching outputSchema */ }))Also applies to: 50-50, 64-64, 94-94, 102-102
playgrounds/nest/src/reference/reference.controller.ts (1)
39-42
: Consider adding error handling for spec generation.The
spec()
method call lacks error handling. If the reference service throws an exception, it will propagate to the client without a graceful response.@Get('spec.json') spec() { - return this.referenceService.spec() + try { + return this.referenceService.spec() + } catch (error) { + // Log the error + throw new InternalServerErrorException('Could not generate API specification') + } }playgrounds/nest/src/planet/planet.service.ts (1)
49-64
: Create method has potential issue with image URL generation.The
create
method has a potential issue with image URL generation when the image is undefined. The current implementation will setimageUrl
to undefined, but it might be better to set a default image URL.create(newPlanet: NewPlanet, creator: User = { id: '1', name: 'John Doe', email: 'john@doe.com' }): Planet { const id = planets.length + 1 - const imageUrl = newPlanet.image ? `https://example.com/cdn/${newPlanet.image.name}` : undefined + const imageUrl = newPlanet.image + ? `https://example.com/cdn/${newPlanet.image.name}` + : 'https://example.com/default-planet.jpg' const planet: Planet = { creator, id, name: newPlanet.name, description: newPlanet.description, imageUrl, } planets.push(planet) return planet }playgrounds/nest/src/planet/planet.controller.ts (2)
17-28
: Inconsistent error–handling approach
find()
throws a rawORPCError
, whileupdate()
uses the contract-generated, type-safeerrors.NOT_FOUND(...)
. Pick one style (preferably the type-safe helper) for consistency and stronger static guarantees.- throw new ORPCError('NOT_FOUND', { message: 'Planet not found' }) + throw errors.NOT_FOUND({ data: { id: input.id } })This also lets you remove the unused
ORPCError
import if it’s no longer needed.
10-35
: Micro-allocation of handlersEvery request instantiates a new handler closure (
implement(...).handler(...)
).
Although lightweight, doing this per call is unnecessary—implement(...).handler(...)
is stateless and can be evaluated once at class construction time:private readonly listHandler = implement(contract.planet.list) .handler(({ input }) => this.planetService.list(input.limit, input.cursor)); @Implement(contract.planet.list) list() { return this.listHandler; }This avoids needless allocations inside Hot paths.
playgrounds/nest/src/schemas/planet.ts (1)
1-8
: Forward type aliases rely on later declarationsPlacing the
type ... = z.infer<typeof Schema>
aliases before the schema constants compiles, but it relies on forward value references and can confuse readers. Moving the aliases below the schema declarations improves readability without functional impact.packages/nest/src/implement.test.ts (1)
226-246
: Expecting specific error shape couples test to implementationThe test asserts an exact error message:
message: 'Malformed request. Ensure the request body is properly formatted …'
A minor copy edit in the error text will break the test. Consider asserting only the error
code
or usingtoMatchObject
with partial fields to make the test less brittle.packages/nest/src/implement.ts (1)
67-78
: Metadata & descriptor cloning should preserve property attributesAssigning a function directly (
target[methodName] = async …
) makes the new property enumerable and configurable by default and drops other descriptor flags (e.g.,writable: false
).
Better clone the original descriptor:- target[methodName] = async function (...args: any[]) { + Object.defineProperty(target, methodName, { + ...descriptor, + async value(...args: any[]) { const router = await descriptor.value!.apply(this, args) return getRouter(router, [key]) - } + }, + })apps/content/docs/openapi/nest/implement-contract.md (3)
61-64
: Grammar nit – drop the comma before “because”“…, because …” should be “… because …” when the clause is essential.
-…not compile `node_modules`, because Fastify does not… +…not compile `node_modules` because Fastify does not…
138-140
: Same comma-before-because issue-…Fastify platform, because Fastify does not allow… +…Fastify platform because Fastify does not allow…🧰 Tools
🪛 LanguageTool
[formatting] ~138-~138: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ... not work on the NestJS Fastify platform, because Fastify does not allow wildcard (*
) a...(COMMA_BEFORE_BECAUSE)
218-219
: Missing comma after introductory phrase-Please refer to the [OpenAPILink](/docs/openapi/client/openapi-link) documentation… +Please refer to the [OpenAPILink](/docs/openapi/client/openapi-link) documentation,…🧰 Tools
🪛 LanguageTool
[typographical] ~218-~218: Consider adding a comma here.
Context: ...> = createORPCClient(link) ``` ::: info Please refer to the [OpenAPILink](/docs/openap...(PLEASE_COMMA)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (69)
README.md
(1 hunks)apps/content/.vitepress/config.ts
(1 hunks)apps/content/docs/openapi/nest/implement-contract.md
(1 hunks)apps/content/docs/playgrounds.md
(2 hunks)apps/content/index.md
(1 hunks)eslint.config.js
(1 hunks)package.json
(1 hunks)packages/arktype/README.md
(1 hunks)packages/client/README.md
(1 hunks)packages/contract/README.md
(1 hunks)packages/nest/.gitignore
(1 hunks)packages/nest/README.md
(1 hunks)packages/nest/package.json
(1 hunks)packages/nest/src/implement.test-d.ts
(1 hunks)packages/nest/src/implement.test.ts
(1 hunks)packages/nest/src/implement.ts
(1 hunks)packages/nest/src/index.ts
(1 hunks)packages/nest/src/utils.test-d.ts
(1 hunks)packages/nest/src/utils.test.ts
(1 hunks)packages/nest/src/utils.ts
(1 hunks)packages/nest/tsconfig.json
(1 hunks)packages/nest/tsconfig.test.json
(1 hunks)packages/openapi-client/README.md
(1 hunks)packages/openapi/README.md
(1 hunks)packages/react-query/README.md
(1 hunks)packages/react/README.md
(1 hunks)packages/server/README.md
(1 hunks)packages/shared/README.md
(1 hunks)packages/solid-query/README.md
(1 hunks)packages/standard-server-fetch/README.md
(1 hunks)packages/standard-server-node/README.md
(1 hunks)packages/standard-server-peer/README.md
(1 hunks)packages/standard-server/README.md
(1 hunks)packages/svelte-query/README.md
(1 hunks)packages/valibot/README.md
(1 hunks)packages/vue-colada/README.md
(1 hunks)packages/vue-query/README.md
(1 hunks)packages/zod/README.md
(1 hunks)playgrounds/contract-first/README.md
(1 hunks)playgrounds/nest/.gitignore
(1 hunks)playgrounds/nest/README.md
(1 hunks)playgrounds/nest/nest-cli.json
(1 hunks)playgrounds/nest/package.json
(1 hunks)playgrounds/nest/src/app.module.ts
(1 hunks)playgrounds/nest/src/auth/auth.controller.ts
(1 hunks)playgrounds/nest/src/contract/auth.ts
(1 hunks)playgrounds/nest/src/contract/index.ts
(1 hunks)playgrounds/nest/src/contract/planet.ts
(1 hunks)playgrounds/nest/src/contract/sse.ts
(1 hunks)playgrounds/nest/src/lib/orpc.ts
(1 hunks)playgrounds/nest/src/main.ts
(1 hunks)playgrounds/nest/src/other/other.controller.ts
(1 hunks)playgrounds/nest/src/planet/planet.controller.ts
(1 hunks)playgrounds/nest/src/planet/planet.service.ts
(1 hunks)playgrounds/nest/src/playground-client.ts
(1 hunks)playgrounds/nest/src/playground-query.ts
(1 hunks)playgrounds/nest/src/reference/reference.controller.ts
(1 hunks)playgrounds/nest/src/reference/reference.service.ts
(1 hunks)playgrounds/nest/src/schemas/auth.ts
(1 hunks)playgrounds/nest/src/schemas/planet.ts
(1 hunks)playgrounds/nest/src/schemas/user.ts
(1 hunks)playgrounds/nest/tsconfig.build.json
(1 hunks)playgrounds/nest/tsconfig.json
(1 hunks)playgrounds/nextjs/README.md
(1 hunks)playgrounds/nuxt/README.md
(1 hunks)playgrounds/solid-start/README.md
(1 hunks)playgrounds/svelte-kit/README.md
(1 hunks)tsconfig.json
(1 hunks)vitest.jsdom.ts
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (14)
playgrounds/nest/src/planet/planet.service.ts (1)
playgrounds/nest/src/schemas/planet.ts (3)
Planet
(7-7)NewPlanet
(5-5)UpdatePlanet
(6-6)
packages/nest/src/utils.test.ts (3)
packages/nest/src/utils.ts (2)
toNestPattern
(7-11)populateContractRouterPaths
(32-56)packages/contract/src/builder.ts (1)
oc
(189-198)packages/contract/tests/shared.ts (2)
inputSchema
(6-6)outputSchema
(8-8)
playgrounds/nest/src/auth/auth.controller.ts (3)
playgrounds/nest/src/other/other.controller.ts (1)
Controller
(7-23)playgrounds/nest/src/planet/planet.controller.ts (1)
Controller
(6-61)packages/nest/src/implement.ts (1)
Implement
(31-83)
playgrounds/nest/src/playground-client.ts (1)
playgrounds/nest/src/lib/orpc.ts (1)
orpc
(17-17)
playgrounds/nest/src/contract/sse.ts (1)
packages/contract/src/builder.ts (1)
oc
(189-198)
packages/nest/src/utils.ts (5)
packages/openapi-client/src/adapters/standard/utils.ts (1)
standardizeHTTPPath
(6-8)packages/contract/src/router.ts (1)
AnyContractRouter
(17-17)packages/shared/src/array.ts (1)
toArray
(1-3)packages/contract/src/procedure.ts (1)
isContractProcedure
(51-66)packages/client/src/adapters/standard/utils.ts (1)
toHttpPath
(4-6)
playgrounds/nest/src/contract/planet.ts (2)
packages/contract/src/builder.ts (1)
oc
(189-198)playgrounds/nest/src/schemas/planet.ts (3)
PlanetSchema
(22-28)NewPlanetSchema
(9-13)UpdatePlanetSchema
(15-20)
playgrounds/nest/src/schemas/user.ts (1)
packages/zod/src/index.ts (1)
oz
(16-22)
playgrounds/nest/src/contract/index.ts (1)
playgrounds/nest/src/contract/planet.ts (4)
listPlanets
(5-18)createPlanet
(20-28)findPlanet
(30-40)updatePlanet
(42-56)
packages/nest/src/utils.test-d.ts (3)
packages/nest/src/utils.ts (1)
PopulatedContractRouterPaths
(13-18)packages/contract/src/builder.ts (1)
oc
(189-198)packages/contract/tests/shared.ts (3)
inputSchema
(6-6)baseErrorMap
(12-17)outputSchema
(8-8)
playgrounds/nest/src/contract/auth.ts (3)
packages/contract/src/builder.ts (1)
oc
(189-198)playgrounds/nest/src/schemas/user.ts (2)
NewUserSchema
(7-22)UserSchema
(24-39)playgrounds/nest/src/schemas/auth.ts (2)
CredentialSchema
(3-6)TokenSchema
(8-10)
playgrounds/nest/src/playground-query.ts (1)
playgrounds/nest/src/lib/orpc.ts (1)
orpc
(17-17)
packages/nest/src/implement.ts (12)
packages/shared/src/index.ts (1)
Promisable
(15-15)packages/server/src/router.ts (1)
Router
(12-17)packages/contract/src/procedure.ts (1)
isContractProcedure
(51-66)packages/contract/src/config.ts (1)
fallbackContractConfig
(20-26)packages/nest/src/utils.ts (1)
toNestPattern
(7-11)packages/server/src/router-utils.ts (1)
getRouter
(13-49)packages/server/src/lazy.ts (1)
unlazy
(42-44)packages/server/src/procedure.ts (1)
isProcedure
(75-87)packages/standard-server-node/src/types.ts (2)
NodeHttpRequest
(4-10)NodeHttpResponse
(12-12)packages/standard-server/src/types.ts (1)
StandardResponse
(34-41)packages/client/src/error.ts (1)
toORPCError
(139-146)packages/standard-server-node/src/response.ts (1)
sendStandardResponse
(8-39)
playgrounds/nest/src/schemas/planet.ts (2)
packages/zod/src/index.ts (1)
oz
(16-22)playgrounds/nest/src/schemas/user.ts (1)
UserSchema
(24-39)
🪛 LanguageTool
packages/standard-server-peer/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/openapi-client/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/valibot/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/shared/README.md
[style] ~57-~57: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/arktype/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/react/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/standard-server-fetch/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/vue-query/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/contract/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/svelte-query/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/server/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/standard-server/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/standard-server-node/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/client/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/zod/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/solid-query/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/react-query/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/vue-colada/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/openapi/README.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/nest/README.md
[misspelling] ~33-~33: Possible spelling mistakes found.
Context: ...tack Query (React, Vue, Solid, Svelte), Pinia Colada, and more. - 🚀 Server Actions: Ful...
(EN_MULTITOKEN_SPELLING_TWO)
[style] ~51-~51: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... your API or implement API contract. - [@orpc/client](https://www.npmjs.com/package/@...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~53-~53: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...: Deeply integrate oRPC with NestJS. - [@orpc/react](https://www.npmjs.com/package/@o...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~54-~54: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...with React and React Server Actions. - [@orpc/react-query](https://www.npmjs.com/pack...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~55-~55: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...test/docs/framework/react/overview). - [@orpc/vue-query](https://www.npmjs.com/packag...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~56-~56: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...latest/docs/framework/vue/overview). - [@orpc/solid-query](https://www.npmjs.com/pack...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~57-~57: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...test/docs/framework/solid/overview). - [@orpc/svelte-query](https://www.npmjs.com/pac...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~58-~58: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...est/docs/framework/svelte/overview). - [@orpc/vue-colada](https://www.npmjs.com/packa...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[misspelling] ~58-~58: Possible spelling mistakes found.
Context: ...ge/@orpc/vue-colada): Integration with Pinia Colada. - [@or...
(EN_MULTITOKEN_SPELLING_TWO)
[style] ~59-~59: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ada](https://pinia-colada.esm.dev/). - [@orpc/openapi](https://www.npmjs.com/package/...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~60-~60: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...I specs and handle OpenAPI requests. - [@orpc/zod](https://www.npmjs.com/package/@orp...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~61-~61: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...tps://zod.dev/) doesn't support yet. - [@orpc/valibot](https://www.npmjs.com/package/...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~62-~62: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...rom Valibot. - [@orpc/arktype](https://www.npmjs.com/package/...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
apps/content/docs/openapi/nest/implement-contract.md
[formatting] ~138-~138: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ... not work on the NestJS Fastify platform, because Fastify does not allow wildcard (*
) a...
(COMMA_BEFORE_BECAUSE)
[typographical] ~218-~218: Consider adding a comma here.
Context: ...> = createORPCClient(link) ``` ::: info Please refer to the [OpenAPILink](/docs/openap...
(PLEASE_COMMA)
🪛 Biome (1.9.4)
playgrounds/nest/src/other/other.controller.ts
[error] 9-9: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
playgrounds/nest/src/auth/auth.controller.ts
[error] 7-7: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
🪛 GitHub Check: codecov/patch
packages/nest/src/index.ts
[warning] 2-2: packages/nest/src/index.ts#L2
Added line #L2 was not covered by tests
[warning] 4-4: packages/nest/src/index.ts#L4
Added line #L4 was not covered by tests
🔇 Additional comments (81)
playgrounds/nest/.gitignore (7)
6-13
: Log file patterns look comprehensive
Thelogs
,*.log
, and various package manager debug patterns cover the usual cases. Good to go.
18-21
: Test output directories are properly excluded
Ignoring/coverage
and/.nyc_output
aligns with standard coverage tooling.
31-37
: VSCode folder exclusions are appropriate
The pattern excludes everything under.vscode/
except the committed workspace configs. This matches the intended behavior.
38-43
: dotenv files are correctly ignored
All environment variants (.env*
) are covered to avoid leaking secrets.
45-48
: Temporary directories are covered
Ignoring.temp
and.tmp
will catch most transient build artifacts or cache directories.
49-54
: Runtime data files are excluded
Patterns for PID and seed files look good and prevent leftover runtime data from polluting commits.
55-56
: Diagnostic reports pattern is correct
The Node.js diagnostic report glob matches the official naming scheme.eslint.config.js (1)
61-66
: LGTM! Configuration correctly scoped for NestJS integrationThe ESLint override for NestJS playground files appropriately disables rules that would conflict with typical NestJS coding patterns, particularly around process access and type imports. The changes are well-scoped and only target the new playground files.
packages/nest/.gitignore (1)
1-26
: LGTM! Comprehensive and well-structured .gitignoreThe .gitignore file is well-organized with appropriate patterns for a TypeScript/Node.js package. It properly excludes build artifacts, temporary files, and sensitive configuration files that shouldn't be version-controlled.
playgrounds/svelte-kit/README.md (1)
14-14
: LGTM! Documentation path correctionThis update correctly fixes the path for accessing the Scalar API Client, ensuring consistency with other playground environments that also use the
/api
endpoint.packages/shared/README.md (1)
57-57
: LGTM! Documentation properly updatedThe README is correctly updated to include the new
@orpc/nest
package in the packages list, maintaining consistency with the documentation of other packages.🧰 Tools
🪛 LanguageTool
[style] ~57-~57: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
playgrounds/solid-start/README.md (1)
14-14
: Update Scalar API Client endpoint
The URL has been correctly updated from/scalar
to/api
, aligning with other playgrounds. This ensures users access the right endpoint for the Scalar API Client.packages/server/README.md (1)
52-52
: Document NestJS integration
The@orpc/nest
package entry has been added to the list, reflecting the new NestJS integration. The change is clear and consistent with the monorepo’s other package READMEs.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/arktype/README.md (1)
52-52
: Add@orpc/nest
to package list
Including@orpc/nest
here correctly updates the documentation to reflect the newly introduced NestJS integration package.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/contract/README.md (1)
52-52
: Add@orpc/nest
to package list
The new@orpc/nest
entry aligns the@orpc/contract
README with the other packages, ensuring consistent documentation of NestJS support.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/client/README.md (1)
52-52
: Add@orpc/nest
to package list
Adding@orpc/nest
here keeps the client package’s documentation in sync with the rest of the ecosystem for NestJS integration.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
README.md (1)
52-52
: Add @orpc/nest to Packages section.
The new package entry for deep integration with NestJS is correctly added under "Packages", fulfilling the PR objective.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
tsconfig.json (1)
39-41
: Properly scope NestJS package compilation.
Adding"packages/nest/**"
to the rootexclude
isolates the new@orpc/nest
package into its own TypeScript project, preventing it from being compiled twice by the main config.playgrounds/nuxt/README.md (1)
14-14
: Correct Scalar API Client endpoint.
The URL path has been updated to/api
to align with the actual route, matching other playgrounds.packages/standard-server/README.md (1)
52-52
: List @orpc/nest in supported packages.
Including the NestJS integration in the package listing ensures consistency across all standard-server documentation.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
playgrounds/nextjs/README.md (1)
14-14
: Update Scalar API Client URL to/api
.
Aligns the Next.js playground instructions with the corrected endpoint, consistent with other guides.packages/standard-server-node/README.md (1)
52-52
: ✅ Consistent addition of@orpc/nest
in Packages list
The new- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest)
entry is formatted correctly and aligns with the existing package entries.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/react/README.md (1)
52-52
: ✅ Added@orpc/nest
to the Packages section
The inserted@orpc/nest
entry follows the existing list pattern and is consistent with other package READMEs.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/solid-query/README.md (1)
52-52
: ✅ Inserted@orpc/nest
entry in the list
The new bullet for@orpc/nest
is correctly placed and matches the style of the surrounding items.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/zod/README.md (1)
52-52
: ✅ Documentation update:@orpc/nest
added
The new package link for@orpc/nest
is properly integrated into the Packages section with consistent formatting.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/svelte-query/README.md (1)
52-52
: ✅ Added@orpc/nest
to the Packages list
The entry for@orpc/nest
is correctly formatted and in line with the other framework integrations.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
playgrounds/contract-first/README.md (1)
14-14
: Correct URL for Scalar API Client
The update aligns the playground documentation with the actual API route (/api
instead of/scalar
), improving accuracy and consistency.packages/vue-query/README.md (1)
52-52
: Add@orpc/nest
package entry
The new bullet accurately introduces the NestJS integration for oRPC in the Vue Query package documentation, aligning with other package READMEs.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/openapi-client/README.md (1)
52-52
: Include@orpc/nest
in related packages
This entry keeps the package list consistent by adding the NestJS integration to the OpenAPI Client docs.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/valibot/README.md (1)
52-52
: Announce NestJS integration
The@orpc/nest
package is now included in the Valibot README, maintaining uniform documentation across all integrations.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
apps/content/index.md (1)
33-33
: Update Framework Integrations section
Adding "NestJS" to the integrations list ensures the homepage reflects the new NestJS support. Please verify that the VitePress sidebar config (apps/content/.vitepress/config.ts
) also includes the NestJS section.packages/standard-server-peer/README.md (1)
52-52
: Approve: Add@orpc/nest
package entry
The new bullet for@orpc/nest
correctly extends the related packages list with the NestJS integration, preserving alphabetical order.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/standard-server-fetch/README.md (1)
52-52
: Approve: Add@orpc/nest
package entry
The newly added@orpc/nest
bullet integrates the NestJS support into the package list, matching the formatting and ordering of existing entries.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/vue-colada/README.md (1)
52-52
: Approve: Add@orpc/nest
package entry
This update introduces the NestJS integration reference alongside other oRPC packages, maintaining consistency in the list.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/openapi/README.md (1)
52-52
: Approve: Add@orpc/nest
package entry
The new entry for@orpc/nest
aligns with the pattern of framework integrations and follows the existing list’s style and order.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
packages/react-query/README.md (1)
52-52
: Approve: Add@orpc/nest
package entry
Adding the@orpc/nest
bullet enriches the list of supported integrations and keeps the alphabetical structure intact.🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence 10000 or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
vitest.jsdom.ts (1)
1-1
: Appropriate dependency update for NestJS integration testingThe change from
@testing-library/jest-dom
to@testing-library/dom
aligns with the NestJS integration requirements and provides more general DOM testing utilities instead of Jest-specific matchers.apps/content/docs/playgrounds.md (2)
20-20
: Well-integrated NestJS playground documentationThe NestJS playground entry follows the established format and provides consistent links to both StackBlitz and GitHub source repositories.
36-36
: Complete local development instructionsThe degit command for cloning the NestJS playground locally is correctly added, maintaining consistency with the other playground examples.
playgrounds/nest/tsconfig.build.json (1)
1-4
: Standard NestJS build configurationThis TypeScript build configuration properly extends the base configuration and excludes appropriate directories and test files, following NestJS project conventions.
playgrounds/nest/README.md (3)
1-4
: Clear playground introductionThe README provides a concise introduction to the playground, clearly identifying it as an integration between oRPC and NestJS with appropriate links to both projects.
5-14
: Complete getting started instructionsThe instructions for running the development server and accessing the Scalar API Client are clear and sufficient for users to begin using the playground.
15-21
: Consistent sponsors sectionThe sponsors section maintains the same format found in other oRPC documentation, using a centered image from the JSDelivr CDN.
apps/content/.vitepress/config.ts (1)
203-209
: Looks good! Documentation properly organized.The addition of the NestJS section to the sidebar follows the existing documentation structure and is properly placed under the OpenAPI section, making it easy for users to discover the new NestJS integration.
playgrounds/nest/nest-cli.json (1)
1-9
: Standard NestJS configuration properly implemented.The NestJS CLI configuration follows best practices with appropriate settings for schema validation, source root, and build options. Using webpack as the builder is a good choice for the playground environment.
playgrounds/nest/src/contract/sse.ts (1)
1-11
: Well-designed SSE contract with proper typing.The SSE contract is well-implemented with appropriate method (GET), tagging, and proper type definitions using the event iterator pattern. The zod schema ensures type safety for the event payload.
package.json (1)
12-12
: Enhanced type checking to include test files is a good practice.Adding
pnpm run -r type:check:test
to the type checking process ensures that test files are also type-checked, which helps maintain type safety across both implementation and test code. This is especially valuable for the new NestJS integration.playgrounds/nest/src/playground-client.ts (1)
9-9
:❓ Verification inconclusive
Use the authentication token for subsequent API calls.
The token from authentication isn't being used in the planet update request. Typically, you would include this token in the headers for authenticated requests.
🏁 Script executed:
#!/bin/bash # Check if the orpc client automatically uses tokens or if manual configuration is needed # First, search for the client setup rg -A 10 "export const client" --glob "*.ts" ./playgrounds/nest/src/Length of output: 331
Could you share how the
link
passed intocreateORPCClient(link)
is configured? I’d like to confirm whether it automatically attaches the auth token or if we need to inject it manually (e.g. via headers in a custom fetch/link).playgrounds/nest/src/schemas/auth.ts (1)
3-6
: Credential schema implements standard authentication validation.The
CredentialSchema
correctly validates email format and ensures the password is a string. This follows good security practices by validating inputs at the schema level.playgrounds/nest/src/other/other.controller.ts (1)
11-22
: Server-Sent Events implementation looks good.The SSE implementation correctly uses the
@Implement
decorator withimplement().handler()
pattern to create a server-sent events endpoint. The async generator function properly yields events with timestamps at regular intervals.playgrounds/nest/src/lib/orpc.ts (2)
8-13
: Hard-coded URL and authorization token in OpenAPILink.The URL is hard-coded to
http://localhost:3000
and the authorization token is set to a static value. For a playground this is fine, but for production code these values should be configurable.In a production environment, consider replacing these with environment variables or configuration parameters:
const link = new OpenAPILink(contract, { - url: new URL('/', 'http://localhost:3000'), + url: new URL('/', process.env.API_BASE_URL || 'http://localhost:3000'), headers: () => ({ - Authorization: 'Bearer default-token', + Authorization: `Bearer ${getAuthToken()}`, }), }) +function getAuthToken() { + // Get token from secure storage or context + return process.env.AUTH_TOKEN || 'default-token'; +}
15-17
: Client and React Query utility exports look good.The client is properly typed using
JsonifiedClient<ContractRouterClient<typeof contract>>
and the React Query utilities are correctly created from the client.packages/nest/src/utils.test-d.ts (2)
7-25
: Type-level tests for PopulatedContractRouterPaths look correct.The test verifies that
PopulatedContractRouterPaths
properly preserves the type structure of contract routers. The test is well-structured, usingexpectTypeOf
from Vitest to assert type equality.
17-24
: Complex type assertion with nested generics.The type assertion correctly verifies that
PopulatedContractRouterPaths
preserves the structure of aContractProcedure
with its input schema, output schema, error map, and metadata. This is a good practice to ensure type safety.packages/nest/tsconfig.json (1)
1-20
: Configuration looks appropriate for a NestJS integration packageThe TypeScript configuration correctly enables experimental decorators (required for NestJS) and sets up project references to dependencies. The include/exclude patterns are appropriate for a library package.
playgrounds/nest/src/contract/auth.ts (2)
5-14
: Well-structured authentication route with comprehensive metadata.The signup route is properly defined with clear HTTP method, path, summary, and appropriate tags. The input and output schemas provide strong typing and validation.
15-24
: The signin endpoint uses appropriate schemas for authentication flow.The signin route appropriately accepts credentials and returns a token using well-defined schemas. This follows security best practices by clearly defining the input validation requirements.
packages/nest/src/utils.test.ts (2)
5-12
: Well-structured tests for the toNestPattern utility function.The tests thoroughly verify that the toNestPattern function correctly converts oRPC path patterns to NestJS-compatible patterns, including path parameters and wildcards.
14-38
: Comprehensive tests for the populateContractRouterPaths utility.These tests effectively verify that the populateContractRouterPaths function correctly handles:
- Preserving explicitly defined paths
- Auto-generating paths for routes without explicit paths
- Preserving input and output schemas
- Processing nested routes correctly
This ensures the utility functions will work correctly in the NestJS integration.
playgrounds/nest/src/schemas/user.ts (1)
1-5
: Schemas imports and type exports are correctly defined.
Theoz
andz
imports along withNewUser
/User
type inferences are properly set up for OpenAPI metadata and Zod validation.playgrounds/nest/tsconfig.json (5)
3-6
: Compiler target and libs are appropriate.
UsingES2022
with the corresponding library is consistent with the NestJS playground requirements.
6-8
: Decorator metadata settings look good.
emitDecoratorMetadata
andexperimentalDecorators
are correctly enabled for NestJS.
9-11
: Module resolution configuration is valid.
module: "ES2022"
andmoduleResolution: "bundler"
align with the playground’s ESM setup, and includingnode
types is correct.
12-16
: Review relaxed strictness settings.
You have disabledstrictBindCallApply
,noFallthroughCasesInSwitch
, andnoImplicitAny
. Please confirm that these relaxations are intentional for the playground (e.g., for rapid prototyping) and won’t mask type errors in example code.
17-24
: Output and declaration settings are solid.
Generating declarations, source maps, and cleaning comments for thedist
directory supports a clear playground build.packages/nest/package.json (5)
4-4
: Verify the initial version placeholder.
The version is currently set to"0.0.0"
. Ensure you bump this to an actual release version (e.g.,0.1.0
) before publishing.
31-36
: Build and type-check scripts are configured.
Thebuild
,build:watch
, andtype:check
scripts look good for development and CI.
37-44
: Peer dependencies appropriately defined.
Requiring NestJS v11+, Express/Fastify optional, and RxJS is correct for this integration.
53-61
: Runtime dependencies are accurate.
Listing the necessary@orpc/*
packages ensures your package can operate at runtime.
62-75
: Development dependencies cover testing and schema validation.
Including@nestjs/testing
,supertest
, andzod
is appropriate for your test suites.packages/nest/src/implement.test-d.ts (3)
1-4
: Imports look complete and appropriate.The imports correctly bring in necessary dependencies from
@orpc/contract
,@orpc/server
, and the local testing schemas. TheImplement
decorator is correctly imported for testing.
6-39
: Well-structured type tests for single procedure implementations.This test suite thoroughly validates the
@Implement
decorator's type behavior for single procedures, covering both valid usage patterns and correctly catching invalid implementations. The test cases check:
- Basic implementation
- Middleware context usage
- Invalid return types
- Prohibited initial context
- Contract mismatch
Using
@ts-expect-error
annotations appropriately ensures type errors are caught during compilation.
41-106
: Comprehensive type tests for router object implementations.This test suite effectively validates the
@Implement
decorator's behavior with router objects, covering essential scenarios including:
- Basic router implementation
- Middleware context in routers
- Lazy loading with the
lazy()
function- Error cases for invalid returns
- Prohibited initial context (both direct and lazy-loaded)
- Contract mismatches (both direct and lazy-loaded)
The test cases ensure type safety at the compile time, which is crucial for the correctness of the integration.
playgrounds/nest/src/reference/reference.controller.ts (2)
1-7
: Controller setup looks correct.The controller is properly configured with the necessary imports and decorators. The dependency injection of
ReferenceService
follows NestJS best practices.
8-37
: Security concern with hardcoded authentication token.The API reference viewer is configured with a hardcoded bearer token (
default-token
). While this may be acceptable for a playground, it would be a security risk in production.For a playground environment, consider:
- Making the token configurable through environment variables
- Adding a comment clarifying this is for demonstration purposes only
- Implementing a more secure authentication method
data-configuration="${JSON.stringify({ authentication: { preferredSecurityScheme: 'bearerAuth', http: { - bearer: { token: 'default-token' }, + bearer: { token: process.env.API_REFERENCE_TOKEN || 'default-token' }, }, }, -}).replaceAll('"', '"')}"> +// Note: This token is for demonstration purposes only +}).replaceAll('"', '"')}">playgrounds/nest/src/planet/planet.service.ts (2)
1-38
: In-memory storage implementation is appropriate for a playground.The planet data array provides a good example structure with realistic sample data. Each planet includes all required properties according to the schema, which is helpful for demonstration purposes.
40-48
: List and find methods implemented correctly.The
list
method properly implements pagination with cursor and limit parameters. Thefind
method correctly looks up planets by ID, returning undefined when not found.playgrounds/nest/src/contract/planet.ts (4)
1-4
: Imports are appropriate and well-organized.The imports bring in necessary dependencies for schema validation and contract definition. Using the
oc
object from@orpc/contract
follows the library's recommended pattern.
5-18
: List planets endpoint is well-defined with pagination.The contract for listing planets correctly:
- Uses the GET method with an appropriate path
- Provides meaningful summary and tags for documentation
- Defines input schema with sensible pagination defaults
- Specifies the output as an array of planets
This follows RESTful API design practices.
20-28
: Create planet endpoint is properly defined.The contract for creating a planet correctly:
- Uses the POST method with an appropriate path
- Provides meaningful summary and tags for documentation
- Uses the predefined
NewPlanetSchema
for input validation- Returns the created planet with the full
PlanetSchema
This follows RESTful API design practices.
42-56
: Update planet endpoint correctly includes error handling.The contract for updating a planet:
- Uses the PUT method with an appropriate path
- Provides meaningful summary and tags for documentation
- Properly defines a NOT_FOUND error with structured error data
- Uses the predefined schema for input validation
- Returns the updated planet with the full schema
This follows best practices for robust API contract definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
playgrounds/nest/README.md (2)
18-20
: Add alt text to the sponsors image for accessibilityThe sponsors image is missing alt text, which is important for screen readers and accessibility compliance.
<a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg"> - <img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/> + <img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg' alt="ORPC Sponsors"/> </a>🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
19-19: Images should have alternate text (alt text)
null(MD045, no-alt-text)
5-13
: Consider adding more detailed playground instructionsThe getting started section is minimal. Consider adding more information about what features the playground demonstrates and how to interact with it beyond just opening the Scalar API Client.
You could include:
- Brief explanation of what APIs are demonstrated
- How to use the Scalar client to interact with them
- Where to find the relevant code files for learning
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/nest/src/implement.ts
(1 hunks)playgrounds/nest/README.md
(1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
playgrounds/nest/README.md
19-19: Images should have alternate text (alt text)
null
(MD045, no-alt-text)
🔇 Additional comments (3)
packages/nest/src/implement.ts (3)
31-88
: Great implementation of theImplement
decoratorThe decorator intelligently handles both individual procedures and nested routers, correctly applying NestJS method decorators and interceptors. The error message for missing paths is clear and actionable, suggesting the
populateContractRouterPaths
utility as a solution.
97-151
: Well-structured error handling in the interceptorThe
ImplementInterceptor
provides robust error handling by differentiating between decoding errors (resulting in BAD_REQUEST status) and other ORPC errors. It also gracefully handles both Express and Fastify HTTP adapters.
153-166
: Good utility for flattening parametersThe
flattenParams
function correctly handles both regular string parameters and array parameters, joining array values with forward slashes as expected for path parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
apps/content/docs/openapi/nest/implement-contract.md (2)
132-140
: Informative path parameters section with platform-specific limitation warning.The explanation about path parameter limitations on NestJS Fastify platform is valuable for developers using that combination.
There's a minor grammar issue with the comma before "because". While not incorrect, you could consider removing it for cleaner style:
- Path Parameter matching with slashes (/) does not work on the NestJS Fastify platform, because Fastify does not allow wildcard (`*`) aliasing in path parameters. + Path Parameter matching with slashes (/) does not work on the NestJS Fastify platform because Fastify does not allow wildcard (`*`) aliasing in path parameters.🧰 Tools
🪛 LanguageTool
[formatting] ~138-~138: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ... not work on the NestJS Fastify platform, because Fastify does not allow wildcard (*
) a...(COMMA_BEFORE_BECAUSE)
223-247
: Clear client setup instructions with proper type definitions.The section on creating a type-safe client provides all necessary information, including imports, configuration options, and type definitions.
Consider adding a comma before "Please" in line 245 for improved readability:
- Please refer to the [OpenAPILink](/docs/openapi/client/openapi-link) documentation for more information on client setup and options. + Please, refer to the [OpenAPILink](/docs/openapi/client/openapi-link) documentation for more information on client setup and options.🧰 Tools
🪛 LanguageTool
[typographical] ~244-~244: Consider adding a comma here.
Context: ...> = createORPCClient(link) ``` ::: info Please refer to the [OpenAPILink](/docs/openap...(PLEASE_COMMA)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apps/content/docs/openapi/nest/implement-contract.md
(1 hunks)packages/nest/package.json
(1 hunks)packages/nest/src/index.ts
(1 hunks)playgrounds/nest/src/main.ts
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/nest/package.json
🧰 Additional context used
🪛 LanguageTool
apps/content/docs/openapi/nest/implement-contract.md
[formatting] ~138-~138: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ... not work on the NestJS Fastify platform, because Fastify does not allow wildcard (*
) a...
(COMMA_BEFORE_BECAUSE)
[uncategorized] ~202-~202: A comma might be missing here.
Context: ... a file with application/json
content type the NestJS parser not treat it as a fil...
(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
[typographical] ~244-~244: Consider adding a comma here.
Context: ...> = createORPCClient(link) ``` ::: info Please refer to the [OpenAPILink](/docs/openap...
(PLEASE_COMMA)
🪛 GitHub Check: codecov/patch
packages/nest/src/index.ts
[warning] 2-3: packages/nest/src/index.ts#L2-L3
Added lines #L2 - L3 were not covered by tests
[warning] 5-5: packages/nest/src/index.ts#L5
Added line #L5 was not covered by tests
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: publish-commit
- GitHub Check: lint
🔇 Additional comments (7)
playgrounds/nest/src/main.ts (1)
1-11
: Well-structured NestJS bootstrap with proper oRPC configuration.The bootstrap function correctly initializes the NestJS application with
bodyParser: false
, which is recommended for oRPC integration to avoid conflicts with bracket notation parsing and file uploads, as documented in the implementation guide.The port configuration using environment variables with a fallback is a good practice for deployment flexibility.
apps/content/docs/openapi/nest/implement-contract.md (6)
1-7
: Clear and informative documentation header with appropriate metadata.The title and description effectively communicate the purpose of this guide to users.
8-13
: Good introduction with appropriate experimental status warning.The introduction clearly establishes the purpose of the guide and properly warns users about the experimental nature of the feature, setting appropriate expectations.
14-39
: Comprehensive installation instructions for multiple package managers.The code-group with instructions for npm, yarn, pnpm, bun, and deno provides excellent developer experience.
40-64
: Clear ESM configuration requirements with helpful warnings.The section clearly explains the ESM requirements and potential bundler configuration needs, which is crucial for successful integration.
65-131
: Well-structured contract definition example with helpful utility explanation.The example contract provides a clear demonstration of defining an oRPC contract with the required paths for NestJS implementation. The explanation of
populateContractRouterPaths
utility is especially valuable.
141-196
: Excellent implementation examples covering both standalone and full contract approaches.The code examples clearly demonstrate how to implement both individual procedures and entire contract routers, which gives developers flexibility in their implementation approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
apps/content/docs/openapi/nest/implement-contract.md (2)
133-140
: Refine Grammar in Warning Clause
Remove the comma before “because” as the clause is essential to the meaning:- does not work on the NestJS Fastify platform, because Fastify does not allow wildcard (`*`) aliasing in path parameters. + does not work on the NestJS Fastify platform because Fastify does not allow wildcard (`*`) aliasing in path parameters.🧰 Tools
🪛 LanguageTool
[formatting] ~138-~138: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ... not work on the NestJS Fastify platform, because Fastify does not allow wildcard (*
) a...(COMMA_BEFORE_BECAUSE)
206-214
: Clarify Code Highlight Directive
The inline comment// [!code highlight]
may not be recognized by all markdown renderers. Consider using VitePress’s line highlight syntax, for example:- bodyParser: false, // [!code highlight] + bodyParser: false, // highlight-next-line
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/content/docs/openapi/nest/implement-contract.md
(1 hunks)
🧰 Additional context used
🪛 LanguageTool
apps/content/docs/openapi/nest/implement-contract.md
[formatting] ~138-~138: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ... not work on the NestJS Fastify platform, because Fastify does not allow wildcard (*
) a...
(COMMA_BEFORE_BECAUSE)
[uncategorized] ~202-~202: A comma might be missing here.
Context: ...n standard oRPC parsers. - In some edge cases like uploading a file with `application...
(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
[typographical] ~244-~244: Consider adding a comma here.
Context: ...> = createORPCClient(link) ``` ::: info Please refer to the [OpenAPILink](/docs/openap...
(PLEASE_COMMA)
🔇 Additional comments (7)
apps/content/docs/openapi/nest/implement-contract.md (7)
1-4
: Frontmatter and Metadata Look Good
The document title, description, and YAML frontmatter are correctly specified and conform to VitePress standards.
10-12
: Experimental Warning Section Is Clear
The warning block clearly communicates the experimental nature of this feature. No changes needed.
16-38
: Installation Code-Group Correct
The multi-package installation example using::: code-group
covers npm, yarn, pnpm, bun, and deno. The grouping and code fences are properly structured.
40-64
: Requirements Section Is Accurate
The ESM setup instructions and bundler notes are precise and informative.
65-127
: Define Contract Guide Is Comprehensive
The example contract code correctly demonstratesoc.route
, Zod schemas, andpopulateContractRouterPaths
.
197-222
: Body Parser Recommendation Is Clear
The recommendation to disable the default NestJS body parser aligns with the oRPC interceptor behavior. This section is well explained.🧰 Tools
🪛 LanguageTool
[uncategorized] ~202-~202: A comma might be missing here.
Context: ...n standard oRPC parsers. - In some edge cases like uploading a file with `application...(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
223-246
: Type-Safe Client Section Is Correct
The client example usingOpenAPILink
andcreateORPCClient
is accurate and follows the documented API.🧰 Tools
🪛 LanguageTool
[typographical] ~244-~244: Consider adding a comma here.
Context: ...> = createORPCClient(link) ``` ::: info Please refer to the [OpenAPILink](/docs/openap...(PLEASE_COMMA)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
♻️ Duplicate comments (2)
packages/nest/README.md (1)
5-6
: Empty main header – please fill in the package name
The<h1></h1>
element renders nothing and hurts accessibility / SEO.
Same issue was pointed out previously.-<h1></h1> +<h1>@orpc/nest</h1>packages/nest/src/implement.test.ts (1)
123-135
: Nest application is never closed – potential resource leak
Each suite spins up anINestApplication
, but nothing callsapp.close()
. This leaves open handles that slow the suite and may fail CI with “open handles” warnings. The same issue was flagged earlier.const moduleRef = await Test.createTestingModule({ controllers: [Controller] }).compile() const app = moduleRef.createNestApplication() await app.init() +afterAll(async () => { + await app.close() +})Apply the same pattern to every place a new Nest application is created (lines 226-233, 257-264, 306-309, 363-365).
🧹 Nitpick comments (4)
packages/nest/tsconfig.json (1)
3-5
: Consider addingemitDecoratorMetadata
for full NestJS reflection support
Most NestJS samples enable bothexperimentalDecorators
andemitDecoratorMetadata
. Without the latter, runtime reflection data (e.g. for automatic provider injection or class-validator pipes) is unavailable and may surface as “undefined metadata” errors when consumers rely on reflection."compilerOptions": { "experimentalDecorators": true, + "emitDecoratorMetadata": true },
packages/nest/README.md (1)
125-128
: Add alt text to the sponsor image
Markdown-lint (MD045) flags images without alternative text. Provide a short description for screen-reader users.-<img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/> +<img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg' alt="oRPC sponsors"/>🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
126-126: Images should have alternate text (alt text)
null(MD045, no-alt-text)
packages/nest/src/implement.ts (2)
78-85
: Metadata copy loop can duplicate keysCalling
Reflect.defineMetadata
inside the same iteration that enumeratesReflect.getOwnMetadataKeys(target, propertyKey)
risks duplicating metadata when the decorator is evaluated multiple times (e.g. hot-reload). Consider checking for existing metadata before redefining or useReflect.hasMetadata
to avoid duplication.
118-122
: Minor: double-promise is harmless but avoidable
Promise.resolve(req.body ?? fallbackStandardBody())
may wrap the originalPromise
returned byfallbackStandardBody()
in anotherPromise
, relying on promise-flattening. For clarity you could eliminate the extra layer:-standardRequest.body = () => Promise.resolve(req.body ?? fallbackStandardBody()) +standardRequest.body = () => + req.body !== undefined ? Promise.resolve(req.body) : fallbackStandardBody()
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
packages/nest/README.md
(1 hunks)packages/nest/package.json
(1 hunks)packages/nest/src/implement.test.ts
(1 hunks)packages/nest/src/implement.ts
(1 hunks)packages/nest/tsconfig.json
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/nest/package.json
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/nest/src/implement.ts (12)
packages/contract/src/procedure.ts (1)
isContractProcedure
(51-66)packages/contract/src/config.ts (1)
fallbackContractConfig
(20-26)packages/nest/src/utils.ts (1)
toNestPattern
(7-11)packages/server/src/router-utils.ts (1)
getRouter
(13-49)packages/server/src/lazy.ts (1)
unlazy
(42-44)packages/server/src/procedure.ts (1)
isProcedure
(75-87)packages/standard-server-node/src/types.ts (2)
NodeHttpRequest
(4-10)NodeHttpResponse
(12-12)packages/standard-server/src/types.ts (1)
StandardResponse
(34-41)packages/server/src/procedure-client.ts (1)
createProcedureClient
(72-124)packages/standard-server/src/utils.ts (1)
flattenHeader
(51-61)packages/client/src/error.ts (1)
toORPCError
(139-146)packages/standard-server-node/src/response.ts (1)
sendStandardResponse
(8-39)
🪛 LanguageTool
packages/nest/README.md
[misspelling] ~33-~33: Possible spelling mistakes found.
Context: ...tack Query (React, Vue, Solid, Svelte), Pinia Colada, and more. - 🚀 Server Actions: Ful...
(EN_MULTITOKEN_SPELLING_TWO)
[style] ~51-~51: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... your API or implement API contract. - [@orpc/client](https://www.npmjs.com/package/@...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~53-~53: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...: Deeply integrate oRPC with NestJS. - [@orpc/react](https://www.npmjs.com/package/@o...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~54-~54: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...with React and React Server Actions. - [@orpc/react-query](https://www.npmjs.com/pack...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~55-~55: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...test/docs/framework/react/overview). - [@orpc/vue-query](https://www.npmjs.com/packag...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~56-~56: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...latest/docs/framework/vue/overview). - [@orpc/solid-query](https://www.npmjs.com/pack...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~57-~57: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...test/docs/framework/solid/overview). - [@orpc/svelte-query](https://www.npmjs.com/pac...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~58-~58: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...est/docs/framework/svelte/overview). - [@orpc/vue-colada](https://www.npmjs.com/packa...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[misspelling] ~58-~58: Possible spelling mistakes found.
Context: ...ge/@orpc/vue-colada): Integration with Pinia Colada. - [@or...
(EN_MULTITOKEN_SPELLING_TWO)
[style] ~59-~59: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ada](https://pinia-colada.esm.dev/). - [@orpc/openapi](https://www.npmjs.com/package/...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~60-~60: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...I specs and handle OpenAPI requests. - [@orpc/zod](https://www.npmjs.com/package/@orp...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~61-~61: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...tps://zod.dev/) doesn't support yet. - [@orpc/valibot](https://www.npmjs.com/package/...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~62-~62: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...rom Valibot. - [@orpc/arktype](https://www.npmjs.com/package/...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
🪛 markdownlint-cli2 (0.17.2)
packages/nest/README.md
126-126: Images should have alternate text (alt text)
null
(MD045, no-alt-text)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: publish-commit
- GitHub Check: lint
🔇 Additional comments (2)
packages/nest/src/implement.ts (2)
12-12
: 👍 Switched to public package entry – thank you!
toORPCError
is now imported from@orpc/client
, eliminating the prior cross-package relative import and making the new package consumable when published.
158-168
: Edge-case: path wildcards may produce empty segments
flattenParams
joinsstring[]
params with'/'
, but Fastify splits*
(catch-all) params on/
, meaning"foo//bar"
could emerge for consecutive slashes. If your codec treats empty segments as meaningful, normalise the array before joining:- flatten[key] = value.join('/') + flatten[key] = value.filter(Boolean).join('/')
describe('@Implement', async () => { | ||
const ping_handler = vi.fn(() => ({ body: 'pong', headers: { 'x-ping': 'pong' } })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid async
callbacks in describe
blocks – they are ignored
Vitest/Jest do not await promises returned from describe
, so side-effects inside the async
callback may run after the tests start or be silently swallowed.
Move asynchronous setup into beforeAll/afterAll
hooks instead.
-describe('@Implement', async () => {
+describe('@Implement', () => {
// put async preparation inside hooks
})
Committable suggestion skipped: line range outside the PR's diff.
const MethodDecoratorMap = { | ||
HEAD: Head, | ||
GET: Get, | ||
POST: Post, | ||
PUT: Put, | ||
PATCH: Patch, | ||
DELETE: Delete, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard against unsupported / future HTTP methods
MethodDecoratorMap
hard-codes six verbs. If a contract’s route.method
is anything else (e.g. OPTIONS
, TRACE
or a future verb), MethodDecoratorMap[method]
will be undefined
, producing a runtime TypeError
when applyDecorators
is called.
const MethodDecoratorMap = {
HEAD: Head,
GET: Get,
POST: Post,
PUT: Put,
PATCH: Patch,
DELETE: Delete,
+ // Consider: OPTIONS: Options,
}
Below (see lines 56-61) add an explicit check and helpful error:
const nestMethodDecorator = MethodDecoratorMap[method]
-if (!nestMethodDecorator) {
- throw new Error(`Unsupported HTTP method "${method}" – extend MethodDecoratorMap.`)
-}
-
-applyDecorators(
- nestMethodDecorator(toNestPattern(path)),
- UseInterceptors(ImplementInterceptor),
-)(target, propertyKey, descriptor)
+if (!nestMethodDecorator) {
+ throw new Error(
+ `@Implement: HTTP method "${method}" is not supported. ` +
+ `Add it to MethodDecoratorMap or adjust your contract.`,
+ )
+}
+
+applyDecorators(
+ nestMethodDecorator(toNestPattern(path)),
+ UseInterceptors(ImplementInterceptor),
+)(target, propertyKey, descriptor)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const MethodDecoratorMap = { | |
HEAD: Head, | |
GET: Get, | |
POST: Post, | |
PUT: Put, | |
PATCH: Patch, | |
DELETE: Delete, | |
} | |
// … earlier in the file … | |
const MethodDecoratorMap = { | |
HEAD: Head, | |
GET: Get, | |
POST: Post, | |
PUT: Put, | |
PATCH: Patch, | |
DELETE: Delete, | |
// Consider: OPTIONS: Options, | |
} | |
// … later around line 56 … | |
const nestMethodDecorator = MethodDecoratorMap[method] | |
if (!nestMethodDecorator) { | |
throw new Error( | |
`@Implement: HTTP method "${method}" is not supported. ` + | |
`Add it to MethodDecoratorMap or adjust your contract.`, | |
) | |
} | |
applyDecorators( | |
nestMethodDecorator(toNestPattern(path)), | |
UseInterceptors(ImplementInterceptor), | |
)(target, propertyKey, descriptor) |
This PR is heavily inspired by the NestJS integration from ts-rest.
Closes: #85
Summary by CodeRabbit
New Features
@orpc/nest
for deep integration of oRPC with NestJS.Documentation
Tests
Chores