Mock gRPC Proto Message Generator
Generates realistic fake Protocol Buffer message definitions and sample JSON representations
Generated 215 words · 1,768 characters
See 3 examples
- Example 1
syntax = "proto3"; package userservice; import "google/protobuf/empty.proto"; import "google/protobuf/timestamp.proto"; option go_package = "./userservicepb"; message User { string id = 1; string name = 2; google.protobuf.Timestamp verified_time = 3; string correlation_id = 4; string reviewer_id = 5; string kind = 6; string language_code = 7; int32 comment_count = 8; string email = 9; map<string, string> annotations = 10; int32 quantity = 11; google.protobuf.Timestamp update_time = 12; } message CreateUserRequest { string name = 1; string email = 2; string kind = 3; map<string, string> annotations = 4; string reviewer_id = 5; string language_code = 6; } message GetUserRequest { string id = 1; } message UpdateUserRequest { User user = 1; repeated string update_mask = 2; } message DeleteUserRequest { string id = 1; } message ListUserRequest { int32 page_size = 1; string page_token = 2; string filter = 3; string order_by = 4; } message ListUserResponse { repeated User items = 1; string next_page_token = 2; int32 total_size = 3; } service UserService { rpc CreateUser(CreateUserRequest) returns (User); rpc GetUser(GetUserRequest) returns (User); rpc ListUser(ListUserRequest) returns (ListUserResponse); rpc UpdateUser(UpdateUserRequest) returns (User); rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty); } // Sample JSON representation // { // "id": "512af5e2-1d0e-42df-9a59-9fc1353a545f", // "name": "Mateo Garcia", // "verifiedTime": "2026-12-08T22:26:56Z", // "correlationId": "a0b184e2-983a-4e60-9d07-08bfb2eb9d95", // "reviewerId": "bf745feb-468e-4915-8873-8cb9878d1940", // "commentCount": 288, // "email": "kofi.okafor76@example.com" // } - Example 2
syntax = "proto3"; package userservice; import "google/protobuf/empty.proto"; import "google/protobuf/timestamp.proto"; option go_package = "./userservicepb"; message User { string id = 1; string name = 2; string state_code = 3; string body_markdown = 4; string correlation_id = 5; int32 retry_count = 6; int32 attempt_count = 7; string website_url = 8; string sync_token = 9; } message CreateUserRequest { string name = 1; string body_markdown = 2; string website_url = 3; string sync_token = 4; string state_code = 5; } message GetUserRequest { string id = 1; } message UpdateUserRequest { User user = 1; repeated string update_mask = 2; } message DeleteUserRequest { string id = 1; } message ListUserRequest { int32 page_size = 1; string page_token = 2; string filter = 3; string order_by = 4; } message ListUserResponse { repeated User items = 1; string next_page_token = 2; int32 total_size = 3; } service UserService { rpc CreateUser(CreateUserRequest) returns (User); rpc GetUser(GetUserRequest) returns (User); rpc ListUser(ListUserRequest) returns (ListUserResponse); rpc UpdateUser(UpdateUserRequest) returns (User); rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty); } // Sample JSON representation // { // "id": "77008a35-3a13-4030-98dd-f37681c5f791", // "name": "Xavier Ali", // "correlationId": "2e2cf9bf-b7b6-49ef-8e27-9d7aa8dfca63", // "retryCount": 275, // "attemptCount": 311, // "websiteUrl": "https://example.com/flint/3e2189", // "syncToken": "d7734071bb102395" // } - Example 3
syntax = "proto3"; package userservice; import "google/protobuf/empty.proto"; import "google/protobuf/timestamp.proto"; option go_package = "./userservicepb"; message User { string id = 1; string name = 2; string country_code = 3; string workspace_id = 4; string license_key = 5; string notes = 6; string lot_number = 7; string correlation_id = 8; string project_id = 9; string state_code = 10; } message CreateUserRequest { string name = 1; string workspace_id = 2; string country_code = 3; } message GetUserRequest { string id = 1; } message UpdateUserRequest { User user = 1; repeated string update_mask = 2; } message DeleteUserRequest { string id = 1; } message ListUserRequest { int32 page_size = 1; string page_token = 2; string filter = 3; string order_by = 4; } message ListUserResponse { repeated User items = 1; string next_page_token = 2; int32 total_size = 3; } service UserService { rpc CreateUser(CreateUserRequest) returns (User); rpc GetUser(GetUserRequest) returns (User); rpc ListUser(ListUserRequest) returns (ListUserResponse); rpc UpdateUser(UpdateUserRequest) returns (User); rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty); } // Sample JSON representation // { // "id": "252f1df8-4738-43e5-85e9-f133b6375cd2", // "name": "Gabriel Haddad", // "workspaceId": "0cd3968c-0dce-4aa4-b666-60f5d278cdaa", // "licenseKey": "b7e97e51684db8c2", // "notes": "Sample topaz hazel 0094", // "lotNumber": "pine-summit-862", // "correlationId": "8d28676f-2ece-457c-b533-bc5197c0c93c" // }
About this generator
Starting a gRPC service means writing a .proto file before any implementation code — but getting the proto3 syntax right, numbering fields correctly, defining request and response message pairs, and declaring the service block all take longer than they should. This generator produces a complete protobuf3 definition for four common service patterns, with a JSON sample appended so you can immediately see what the serialized message looks like. The Service Name field propagates through every identifier in the output: enter OrderService and the generated file uses a package name of orderservice, method names like CreateOrder and GetOrder, message types like CreateOrderRequest and ListOrderResponse, and a Go package option of ./orderservicepb. The Message Type selector determines the service structure. CRUD service generates the entity plus Create, Get, Update, Delete and List request messages, a paginated ListResponse, and five RPCs (Create, Get, List, Update with an update_mask, Delete). Auth service produces LoginRequest, LoginResponse, RefreshRequest, LogoutRequest, and ChangePasswordRequest messages with Login, Refresh, Logout, and ChangePassword RPCs. Payment service generates CreatePaymentRequest, GetPaymentRequest, RefundPaymentRequest, and PaymentResponse with CreatePayment, GetPayment, and RefundPayment RPCs. Notification service adds a map<string, string> metadata field and a server-streaming StreamNotifications RPC alongside SendNotification, GetNotification, and CancelNotification. On every run the core fields stay put while extra, realistic fields are drawn from pools of 18 to 150 per message (timestamps, owner and tenant IDs, labels, idempotency keys, receipt URLs and so on), so each file looks different. Every RPC references a message that is actually defined in the file. The JSON sample below the proto definition shows one realistic message in JSON format — useful for grpc-gateway transcoding tests and for writing fixture data without running protoc first.
How to use
- Type your desired service name in the Service Name field (e.g., "OrderService" or "InventoryService").
- Select a Message Type from the dropdown that matches your service pattern: CRUD, Auth, Payment, or Notification.
- Click Generate to produce the complete .proto definition and JSON sample in the output panel.
- Copy the .proto block into a new file named after your service (e.g., order_service.proto) in your project's proto directory.
- Run protoc with the appropriate language plugin to generate client and server stub code from the copied file.
Use Cases
- •Scaffolding a Go or Python microservice .proto file before running protoc-gen-go or grpcio-tools
- •Creating realistic gRPC server fixtures for Postman or BloomRPC integration test suites
- •Generating a payment service proto definition to review API design with stakeholders before sprint kickoff
- •Seeding a proto registry with sample Auth and Notification service definitions for onboarding documentation
- •Producing a JSON sample alongside the .proto file to validate Envoy or grpc-gateway transcoding config
Tips
- →Use the Auth message type first even for non-auth services — its token and user ID field patterns are reusable building blocks worth studying.
- →Pair the CRUD output with protoc-gen-validate to add field constraint annotations (min_len, gt=0) before compiling — the scaffold gives you the structure, validation is the next layer.
- →If your service name contains multiple words, write it in PascalCase (e.g., "ProductCatalog") so the generated method names like GetProductCatalog compile without warnings in Go and Java.
- →Copy the generated JSON sample into Postman or grpcurl's --data flag to immediately test a running gRPC-JSON transcoding proxy without writing fixture data by hand.
- →Generate all four message types for the same service name and compare them side by side — it's the fastest way to understand how proto service patterns differ structurally.
- →Before committing the generated .proto to version control, add a comment block at the top noting the proto file's version and owner team — protobuf schemas are contracts, and attribution matters once multiple services depend on them.
FAQ
how do I turn the generated .proto file into actual server and client code
Install the protoc compiler plus the language plugin you need — protoc-gen-go for Go, grpcio-tools for Python, or grpc_tools_node_protoc_plugin for Node.js. Run protoc with the --grpc_out and --proto_path flags pointing at your file and it outputs typed stub files you import directly into your project.
can I use this mock gRPC proto output in a real production service
Treat it as a 90% complete scaffold, not a final file. Review field names against your domain model, adjust field numbers if merging with an existing schema, and add validation annotations with protoc-gen-validate. It removes the blank-page problem and the boilerplate — you handle the domain-specific refinements.
what is the difference between the proto definition and the JSON sample in the output
The .proto definition is the binary schema your services compile against. The JSON sample shows what one response message looks like when serialized to JSON instead of binary protobuf. This is especially useful for gRPC-JSON transcoding via Envoy or grpc-gateway, and for writing test fixtures without needing to run protoc first.
which service patterns does this generator support
Four patterns are available: CRUD service (entity model with Create, Get, List, Update, Delete RPCs and a paginated List response), Auth service (Login, Refresh, Logout and ChangePassword RPCs with a token response), Payment service (CreatePayment, GetPayment and RefundPayment RPCs with amount in cents and currency), and Notification service (SendNotification, GetNotification and CancelNotification RPCs plus a server-streaming StreamNotifications RPC with a map metadata field).
You might also like
Popular tools from other categories that share themes with this one.