{"id":29440862,"url":"https://github.com/ngthecoder/simple_rpc_system","last_synced_at":"2026-04-18T09:32:12.566Z","repository":{"id":303133671,"uuid":"1014496438","full_name":"ngthecoder/simple_rpc_system","owner":"ngthecoder","description":"Cross-language RPC system with Go server and TypeScript client using TCP sockets and JSON serialization. Features concurrent handling, interactive CLI, and demonstrates microservice communication patterns.","archived":false,"fork":false,"pushed_at":"2025-07-05T22:06:20.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-03T03:38:14.451Z","etag":null,"topics":["distributed-systems","golang","rpc","typescript"],"latest_commit_sha":null,"homepage":"","language":"Go","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/ngthecoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-05T20:57:40.000Z","updated_at":"2025-07-05T22:18:53.000Z","dependencies_parsed_at":"2025-07-05T22:40:07.710Z","dependency_job_id":null,"html_url":"https://github.com/ngthecoder/simple_rpc_system","commit_stats":null,"previous_names":["ngthecoder/simple_rpc_system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ngthecoder/simple_rpc_system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngthecoder%2Fsimple_rpc_system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngthecoder%2Fsimple_rpc_system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngthecoder%2Fsimple_rpc_system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngthecoder%2Fsimple_rpc_system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ngthecoder","download_url":"https://codeload.github.com/ngthecoder/simple_rpc_system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngthecoder%2Fsimple_rpc_system/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31963966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"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":["distributed-systems","golang","rpc","typescript"],"created_at":"2025-07-13T12:16:07.471Z","updated_at":"2026-04-18T09:32:12.560Z","avatar_url":"https://github.com/ngthecoder.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Go](https://img.shields.io/badge/go-%2300ADD8.svg?style=for-the-badge\u0026logo=go\u0026logoColor=white)\n![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge\u0026logo=typescript\u0026logoColor=white)\n# Cross-Language RPC System\nA lightweight Remote Procedure Call (RPC) system enabling seamless communication between Go servers and TypeScript clients over TCP sockets.\n\n## Why This Project?\nBuilt to explore distributed systems concepts and demonstrate cross-language communication patterns used in microservices architectures.\n\n## Features\n- **Cross-Language Communication**: Go server and TypeScript client\n- **TCP Socket Communication**: Direct, efficient network protocol\n- **JSON-based Protocol**: Human-readable message format\n- **Type Safety**: Strongly typed interfaces and structs\n- **Interactive Client**: User-friendly command-line interface\n- **Concurrent Server**: Handles multiple clients simultaneously using goroutines\n- **Error Handling**: Robust error management and validation\n\n## Tech Stack\n- **Backend**: Go with native `net` package\n- **Frontend**: TypeScript/Node.js with built-in networking\n- **Protocol**: TCP sockets with JSON serialization\n- **Concurrency**: Go goroutines for handling multiple clients\n\n## Available RPC Functions\n| Function | Parameters | Description | Example |\n|----------|------------|-------------|---------|\n| `floor` | `float` | Returns floor of a number | `floor(3.7)` returns `3` |\n| `nroot` | `int, int` | Calculates nth root | `nroot(3, 27)` returns `3` |\n| `reverse` | `string` | Reverses a string | `reverse(\"hello\")` returns `\"olleh\"` |\n| `validAnagram` | `string, string` | Checks if two strings are anagrams | `validAnagram(\"listen\", \"silent\")` returns `true` |\n| `sort` | `string[]` | Sorts array of strings | `sort([\"c\", \"a\", \"b\"])` returns `[\"a\", \"b\", \"c\"]` |\n\n## Quick Start\n### Prerequisites\n- Go 1.19+ \n- Node.js 16+\n- npm\n\n### 1. Clone the Repository\n```bash\ngit clone https://github.com/ngthecoder/simple_rpc_system\ncd simple_rpc_system\n```\n\n### 2. Start the Go Server\n```bash\ncd server\ngo run main.go\n```\nServer will start listening on `localhost:8090`\n\n### 3. Set Up TypeScript Client\n```bash\ncd client\nnpm install\n```\n\n### 4. Run the Client\n```bash\ntsc client.ts\nnode client.js\n```\n\n### 5. Make RPC Calls\n```\nEnter method name: floor\nEnter params (comma separated): 3.7\n```\n\n## Protocol Specification\n### Request Format\n```json\n{\n  \"method\": \"floor\",\n  \"params\": [3.7],\n  \"param_types\": [\"float\"],\n  \"id\": 1\n}\n```\n\n### Response Format\n```json\n{\n  \"result\": \"3\",\n  \"result_type\": \"float64\", \n  \"id\": 1\n}\n```\n\n## Example Usage\n**Client Input:**\n```\nEnter method name: nroot\nEnter params (comma separated): 3, 27\n```\n\n**Network Communication:**\n```json\n// Request\n{\"method\":\"nroot\",\"params\":[3,27],\"param_types\":[\"int\",\"int\"],\"id\":42}\n\n// Response  \n{\"result\":\"3\",\"result_type\":\"float64\",\"id\":42}\n```\n\n**Output:**\n```\nSending: { method: 'nroot', params: [3, 27], param_types: ['int', 'int'] }\nConnection Established\n{\"result\":\"3\",\"result_type\":\"float64\",\"id\":42}\n```\n\n## Project Structure\n```\nrpc-system/\n├── server/\n│   └── main.go              # Go RPC server\n├── client/\n│   ├── client.ts            # TypeScript RPC client\n│   ├── package.json         # Node.js dependencies\n│   └── package-lock.json    # Dependency lock file\n├── README.md\n└── .gitignore\n```\n\n## Technical Implementation\n### Server (Go)\n- **Concurrent Handling**: Each client connection spawned in separate goroutine\n- **JSON Unmarshaling**: Automatic parsing using struct tags\n- **Function Registry**: Map-based function lookup and execution\n- **Type Safety**: Interface{} with type assertions for dynamic typing\n\n### Client (TypeScript)\n- **Interactive CLI**: Readline interface for user input\n- **Smart Parameter Parsing**: Function-specific input handling\n- **Type Definitions**: Interfaces matching server protocol\n- **Error Handling**: Network and parsing error management\n\n## Future Enhancements\n- [ ] Authentication and authorization\n- [ ] HTTP REST API wrapper\n- [ ] Client connection pooling\n- [ ] Message compression\n- [ ] Async/await client API\n- [ ] Load balancing support\n- [ ] Metrics and monitoring\n\n## License\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Learning Outcomes\nThis project demonstrates:\n- **Network Programming**: TCP socket implementation\n- **Serialization**: JSON protocol design\n- **Concurrency**: Goroutine-based server architecture  \n- **Cross-Language Integration**: Communication between Go and TypeScript\n- **System Design**: RPC architecture patterns\n- **Error Handling**: Production-ready error management\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngthecoder%2Fsimple_rpc_system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fngthecoder%2Fsimple_rpc_system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngthecoder%2Fsimple_rpc_system/lists"}