Skip to main content
Back to Dev generators

Dev

Mock gRPC Proto Message 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 OrderInput and ListOrderResponse, and a Go package option of ./orderservicepb. The Message Type selector determines the service structure. CRUD service generates four messages (entity, CreateRequest, GetRequest, ListRequest, ListResponse) and four RPCs (Create, Get, List, Delete). Auth service produces LoginRequest, LoginResponse, and RefreshRequest messages with Login, Refresh, and Logout RPCs. Payment service generates CreatePaymentRequest, PaymentResponse, and GetPaymentRequest with CreatePayment and GetPayment RPCs. Notification service adds a map<string, string> metadata field and a server-streaming StreamNotifications RPC. 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.

Read the complete guide — 4 min read

How to use

  1. Choose your options above
  2. Click Generate
  3. Copy your result

Detailed instructions

  1. Type your desired service name in the Service Name field (e.g., "OrderService" or "InventoryService").
  2. Select a Message Type from the dropdown that matches your service pattern: CRUD, Auth, Payment, or Notification.
  3. Click Generate to produce the complete .proto definition and JSON sample in the output panel.
  4. Copy the .proto block into a new file named after your service (e.g., order_service.proto) in your project's proto directory.
  5. 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, Delete RPCs and a paginated List response), Auth service (Login, Refresh, Logout RPCs with token response), Payment service (CreatePayment and GetPayment RPCs with amount in cents and currency), and Notification service (SendNotification RPC plus a server-streaming StreamNotifications RPC with map metadata field).

You might also like

Popular tools from other categories that share themes with this one.

Try these next

More free tools from other corners of the catalog, picked by shared themes.