{"id":31821597,"url":"https://github.com/alenon/grpc-mock-server","last_synced_at":"2026-04-05T12:04:10.180Z","repository":{"id":34290835,"uuid":"175481207","full_name":"alenon/grpc-mock-server","owner":"alenon","description":"gRPC mock server written in typescript","archived":false,"fork":false,"pushed_at":"2025-09-23T12:11:14.000Z","size":1571,"stargazers_count":22,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-23T14:21:36.794Z","etag":null,"topics":["grpc","javascript","mock","server","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alenon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-03-13T18:55:43.000Z","updated_at":"2025-09-23T12:10:23.000Z","dependencies_parsed_at":"2023-02-15T15:01:09.777Z","dependency_job_id":"5666766c-84f4-41cf-a516-c389876eb427","html_url":"https://github.com/alenon/grpc-mock-server","commit_stats":{"total_commits":378,"total_committers":12,"mean_commits":31.5,"dds":"0.23809523809523814","last_synced_commit":"da178bf6e761fa27bf042bc4c2bb29a4e8820974"},"previous_names":[],"tags_count":74,"template":false,"template_full_name":null,"purl":"pkg:github/alenon/grpc-mock-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alenon%2Fgrpc-mock-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alenon%2Fgrpc-mock-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alenon%2Fgrpc-mock-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alenon%2Fgrpc-mock-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alenon","download_url":"https://codeload.github.com/alenon/grpc-mock-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alenon%2Fgrpc-mock-server/sbom","scorecard":{"id":113820,"data":{"date":"2025-08-11","repo":{"name":"github.com/alenon/grpc-mock-server","commit":"ee10988b57966373dd38f88d8ca4ae7dfc61d725"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.9,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Security-Policy","score":4,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Warn: no linked content found","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:28","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:29","Warn: no topLevel permission defined: .github/workflows/changelog.yml:1","Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/node.js.yml:1","Warn: no topLevel permission defined: .github/workflows/npm-publish.yml:1","Warn: no topLevel permission defined: .github/workflows/release-bump.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":4,"reason":"dependency not pinned by hash detected -- score normalized to 4","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/changelog.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/changelog.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/changelog.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/changelog.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:70: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/node.js.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/node.js.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-bump.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/release-bump.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-bump.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/release-bump.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-bump.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/release-bump.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-bump.yml:72: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/release-bump.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-bump.yml:77: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/release-bump.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-bump.yml:109: update your workflow using https://app.stepsecurity.io/secureworkflow/alenon/grpc-mock-server/release-bump.yml/master?enable=pin","Info:   0 out of  17 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned","Info:   4 out of   4 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":9,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 20 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-15T20:40:10.689Z","repository_id":34290835,"created_at":"2025-08-15T20:40:10.689Z","updated_at":"2025-08-15T20:40:10.689Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007349,"owners_count":26084282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grpc","javascript","mock","server","typescript"],"created_at":"2025-10-11T13:49:03.089Z","updated_at":"2026-03-16T12:02:32.633Z","avatar_url":"https://github.com/alenon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grpc-mock-server\n\n\u003e A lightweight, TypeScript-first gRPC mock server designed for testing. Easily create mock gRPC services from your `.proto` files without complex setup.\n\n[![NPM CI](https://github.com/alenon/grpc-mock-server/workflows/NPM%20CI/badge.svg)](https://github.com/alenon/grpc-mock-server/actions)\n[![npm version](https://img.shields.io/npm/v/@alenon/grpc-mock-server.svg)](https://www.npmjs.com/package/@alenon/grpc-mock-server)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## ✨ Features\n\n- 🚀 **Zero Configuration** - Get started in seconds with minimal setup\n- 📦 **TypeScript Support** - Built with TypeScript, includes type definitions\n- 🔧 **Flexible** - Support for single and multiple proto files with cross-package imports\n- 🧪 **Test-Friendly** - Perfect for unit and integration testing\n- 🎯 **Simple API** - Clean, intuitive interface\n- 🔄 **Async/Await** - Modern Promise-based API\n\n## 📦 Installation\n\n```bash\nnpm install @alenon/grpc-mock-server\n```\n\nOr with yarn:\n\n```bash\nyarn add @alenon/grpc-mock-server\n```\n\n## 🚀 Quick Start\n\nCreate a mock server in just a few lines:\n\n```typescript\nimport { GrpcMockServer } from '@alenon/grpc-mock-server';\n\n// Create server instance\nconst server = new GrpcMockServer();\n\n// Define your service implementations\nconst implementations = {\n  GetUser: (call: any, callback: any) =\u003e {\n    callback(null, { name: 'John Doe', id: '123' });\n  }\n};\n\n// Add service from proto file\nserver.addService(\n  './path/to/user.proto',\n  'user',           // package name from proto\n  'UserService',    // service name from proto\n  implementations\n);\n\n// Start the server\nawait server.start();\nconsole.log(`Server running at: ${server.serverAddress}`);\n\n// Don't forget to stop when done!\nawait server.stop();\n```\n\n## 📚 Usage Examples\n\n### Basic Example - Single Proto File\n\nThis example demonstrates the simplest use case with a single proto file.\n\n**example.proto:**\n```protobuf\nsyntax = \"proto3\";\n\npackage com.alenon.example;\n\nservice ExampleService {\n    rpc ex1 (ExampleRequest) returns (ExampleResponse) {}\n}\n\nmessage ExampleRequest {\n    string msg = 1;\n}\n\nmessage ExampleResponse {\n    string msg = 1;\n}\n```\n\n**example.ts:**\n```typescript\nimport { GrpcMockServer } from '@alenon/grpc-mock-server';\nimport * as grpc from '@grpc/grpc-js';\nimport * as proto_loader from '@grpc/proto-loader';\nimport { ProtoUtils } from '@alenon/grpc-mock-server';\n\nasync function example() {\n  const server = new GrpcMockServer();\n\n  // Define implementations\n  const implementations = {\n    ex1: (call: any, callback: any) =\u003e {\n      console.log('Received:', call.request.msg);\n      callback(null, { msg: 'Hello from mock server!' });\n    }\n  };\n\n  // Add service\n  server.addService(\n    __dirname + '/example.proto',\n    'com.alenon.example',\n    'ExampleService',\n    implementations\n  );\n\n  // Start server\n  await server.start();\n  console.log(`Server listening at: ${server.serverAddress}`);\n\n  // Create client and test\n  const pkgDef = grpc.loadPackageDefinition(\n    proto_loader.loadSync(__dirname + '/example.proto')\n  );\n  const proto = ProtoUtils.getProtoFromPkgDefinition('com.alenon.example', pkgDef);\n  \n  const client = new proto.ExampleService(\n    server.serverAddress,\n    grpc.credentials.createInsecure()\n  );\n\n  // Make request\n  const response = await new Promise((resolve, reject) =\u003e {\n    client.ex1({ msg: 'Hello!' }, (error: any, response: any) =\u003e {\n      error ? reject(error) : resolve(response);\n    });\n  });\n\n  console.log('Response:', response);\n  \n  await server.stop();\n}\n\nexample().catch(console.error);\n```\n\n### Advanced Example - Multiple Proto Files\n\nWhen your proto files import from other packages, use an array of proto paths with `includeDirs`:\n\n**user.proto:**\n```protobuf\nsyntax = \"proto3\";\n\npackage user;\n\nimport \"address.proto\";\n\nmessage User {\n  string name = 1;\n  common.Address address = 2;\n}\n\nservice UserService {\n  rpc GetUser (UserRequest) returns (UserResponse);\n}\n\nmessage UserRequest {\n  string id = 1;\n}\n\nmessage UserResponse {\n  User user = 1;\n}\n```\n\n**address.proto:**\n```protobuf\nsyntax = \"proto3\";\n\npackage common;\n\nmessage Address {\n  string postal_code = 1;\n  string city = 2;\n  string country = 3;\n}\n```\n\n**multi-proto-example.ts:**\n```typescript\nimport { GrpcMockServer } from '@alenon/grpc-mock-server';\n\nasync function multiProtoExample() {\n  const server = new GrpcMockServer();\n\n  const implementations = {\n    GetUser: (call: any, callback: any) =\u003e {\n      callback(null, {\n        user: {\n          name: 'John Doe',\n          address: {\n            postal_code: '12345',\n            city: 'San Francisco',\n            country: 'USA'\n          }\n        }\n      });\n    }\n  };\n\n  // Use array of proto files with options\n  server.addService(\n    [\n      __dirname + '/user.proto',\n      __dirname + '/address.proto'\n    ],\n    'user',\n    'UserService',\n    implementations,\n    {\n      includeDirs: [__dirname],  // Required for imports\n      keepCase: true,             // Preserve field names\n      longs: String,              // Convert longs to strings\n      enums: String,              // Convert enums to strings\n      defaults: true,             // Include default values\n      oneofs: true                // Handle oneof fields\n    }\n  );\n\n  await server.start();\n  // ... use server ...\n  await server.stop();\n}\n```\n\n### Testing Example\n\nPerfect for Jest or other testing frameworks:\n\n```typescript\nimport { GrpcMockServer, ProtoUtils } from '@alenon/grpc-mock-server';\nimport * as grpc from '@grpc/grpc-js';\nimport * as proto_loader from '@grpc/proto-loader';\n\ndescribe('ExampleService Tests', () =\u003e {\n  let server: GrpcMockServer;\n  let client: any;\n\n  beforeAll(async () =\u003e {\n    server = new GrpcMockServer();\n    \n    server.addService(\n      __dirname + '/example.proto',\n      'com.alenon.example',\n      'ExampleService',\n      {\n        ex1: (call: any, callback: any) =\u003e {\n          callback(null, { msg: 'Test response' });\n        }\n      }\n    );\n\n    await server.start();\n\n    // Setup client\n    const pkgDef = grpc.loadPackageDefinition(\n      proto_loader.loadSync(__dirname + '/example.proto')\n    );\n    const proto = ProtoUtils.getProtoFromPkgDefinition('com.alenon.example', pkgDef);\n    client = new proto.ExampleService(\n      server.serverAddress,\n      grpc.credentials.createInsecure()\n    );\n  });\n\n  afterAll(async () =\u003e {\n    await server.stop();\n  });\n\n  it('should return response data', async () =\u003e {\n    const response = await new Promise((resolve, reject) =\u003e {\n      client.ex1({ msg: 'Test request' }, (error: any, response: any) =\u003e {\n        error ? reject(error) : resolve(response);\n      });\n    });\n\n    expect(response.msg).toBe('Test response');\n  });\n});\n```\n\n## 📖 API Reference\n\n### `GrpcMockServer`\n\nMain class for creating and managing mock gRPC servers.\n\n#### Constructor\n\n```typescript\nnew GrpcMockServer(serverAddress?: string)\n```\n\n- `serverAddress` (optional): Server address in format `host:port`. Default: `'127.0.0.1:50777'`\n\n#### Methods\n\n##### `addService(protoPath, pkgName, serviceName, implementations, protoLoadOptions?)`\n\nAdds a gRPC service to the mock server.\n\n**Parameters:**\n- `protoPath`: `string | string[]` - Path to proto file(s). Use array for multiple files with imports.\n- `pkgName`: `string` - Package name as defined in your `.proto` file.\n- `serviceName`: `string` - Service name as defined in your `.proto` file.\n- `implementations`: `object` - Object mapping RPC method names to their implementations.\n  - Each implementation is a function: `(call: any, callback: any) =\u003e void`\n  - Call `callback(null, response)` for success\n  - Call `callback(error)` for errors\n- `protoLoadOptions` (optional): Options for `@grpc/proto-loader`. Common options:\n  - `includeDirs`: `string[]` - Directories to search for imported proto files\n  - `keepCase`: `boolean` - Preserve field name casing (default: `false`)\n  - `longs`: `Function` - How to handle long values (e.g., `String`)\n  - `enums`: `Function` - How to handle enum values (e.g., `String`)\n  - `defaults`: `boolean` - Include default values (default: `false`)\n  - `oneofs`: `boolean` - Handle oneof fields (default: `false`)\n\n**Returns:** `GrpcMockServer` (for method chaining)\n\n##### `start()`\n\nStarts the mock server.\n\n**Returns:** `Promise\u003cGrpcMockServer\u003e`\n\n##### `stop()`\n\nStops the mock server gracefully.\n\n**Returns:** `Promise\u003cGrpcMockServer\u003e`\n\n##### `serverAddress`\n\n**Property:** `string` - The address where the server is listening.\n\n##### `server`\n\n**Property:** `grpc.Server` - Access to the underlying gRPC server instance.\n\n## 🔍 Common Use Cases\n\n### Custom Server Address\n\n```typescript\nconst server = new GrpcMockServer('localhost:50051');\n```\n\n### Error Handling\n\n```typescript\nimport * as grpc from '@grpc/grpc-js';\n\nconst implementations = {\n  GetUser: (call: any, callback: any) =\u003e {\n    if (!call.request.id) {\n      callback({ code: grpc.status.INVALID_ARGUMENT, message: 'ID required' });\n      return;\n    }\n    callback(null, { name: 'User', id: call.request.id });\n  }\n};\n```\n\n### Method Chaining\n\n```typescript\nawait new GrpcMockServer()\n  .addService(protoPath, pkgName, serviceName, impl1)\n  .addService(protoPath2, pkgName2, serviceName2, impl2)\n  .start();\n```\n\n## 🐛 Troubleshooting\n\n### \"Seems like the package name is wrong\"\n\n- Verify the `pkgName` matches exactly the `package` declaration in your `.proto` file\n- Check for typos and case sensitivity\n\n### \"Seems like the service name is wrong\"\n\n- Verify the `serviceName` matches exactly the service name in your `.proto` file\n- Check for typos and case sensitivity\n\n### Import errors with multiple proto files\n\n- Ensure `includeDirs` includes the directory containing imported proto files\n- Verify import paths in your proto files are correct relative to `includeDirs`\n- Use `keepCase: true` if your proto uses snake_case field names\n\n### Port already in use\n\n- Change the server address: `new GrpcMockServer('127.0.0.1:50778')`\n- Ensure previous server instances are stopped\n\n## 📝 Examples\n\nCheck out the [examples directory](./example/) for complete working examples:\n\n- [Basic example](./example/example.ts) - Single proto file\n- [Multi-proto example](./example/multi-proto-example.ts) - Multiple proto files with imports\n\nRun examples:\n```bash\nnpm run example\nnpm run multi-proto-example\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## 📄 License\n\nMIT License - see [LICENSE](./LICENSE) file for details.\n\n## 🔗 Links\n\n- [NPM Package](https://www.npmjs.com/package/@alenon/grpc-mock-server)\n- [GitHub Repository](https://github.com/alenon/grpc-mock-server)\n- [Issue Tracker](https://github.com/alenon/grpc-mock-server/issues)\n\n## 💡 Tips\n\n- Always call `stop()` after tests to clean up resources\n- Use `keepCase: true` if your proto files use snake_case naming\n- For complex proto structures, use `defaults: true` and `oneofs: true`\n- The server uses insecure credentials by default (perfect for testing)\n\n---\n\nMade with ❤️ for the gRPC testing community\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falenon%2Fgrpc-mock-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falenon%2Fgrpc-mock-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falenon%2Fgrpc-mock-server/lists"}