A NestJS-based tool for generating .proto files from gRPC reflection data. The tool connects to a gRPC server, fetches service definitions via reflection, and generates corresponding proto files.
- Generates
.protofiles from gRPC reflection data - Handles cross-package dependencies and imports
- Properly formats service definitions and messages
- Skips well-known Google protobuf types
- Prevents duplicate file generation using content hashing
- Built-in logging for debugging and tracking progress
npm install nestjs-proto-compilerimport { ProtoLoaderModule } from 'nestjs-proto-compiler';
@Module({
imports: [
ProtoLoaderModule.register({
url: 'localhost:50051',
outputDir: './proto'
}),
],
})
export class AppModule {}
npx proto-loader --url localhost:50051 --output ./proto- --url (-u): gRPC server URL (required)
- --output (-o): Output directory for proto files (default: './proto')
- --verbose (-v): Enable verbose logging