{"id":25149283,"url":"https://github.com/jawherkl/grpc-order-process","last_synced_at":"2025-04-28T14:48:54.561Z","repository":{"id":269819763,"uuid":"876232094","full_name":"JawherKl/grpc-order-process","owner":"JawherKl","description":"A gRPC system for managing order processing with services for inventory, notifications, and payments.","archived":false,"fork":false,"pushed_at":"2025-01-17T15:44:25.000Z","size":50,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T10:41:30.788Z","etag":null,"topics":["express","grpc","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/JawherKl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2024-10-21T16:07:50.000Z","updated_at":"2025-02-18T22:17:30.000Z","dependencies_parsed_at":"2025-02-08T21:31:47.501Z","dependency_job_id":null,"html_url":"https://github.com/JawherKl/grpc-order-process","commit_stats":null,"previous_names":["jawherkl/go-crud-grpc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fgrpc-order-process","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fgrpc-order-process/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fgrpc-order-process/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fgrpc-order-process/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JawherKl","download_url":"https://codeload.github.com/JawherKl/grpc-order-process/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251334156,"owners_count":21572955,"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","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":["express","grpc","nodejs"],"created_at":"2025-02-08T21:20:19.948Z","updated_at":"2025-04-28T14:48:54.537Z","avatar_url":"https://github.com/JawherKl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n---\n\n# Order Process System\n\nThis project demonstrates a real-time order processing system using gRPC with Node.js. It consists of four microservices: Inventory, Notification, Order, and Payment. Each service exposes a gRPC API for interaction.\n\n## Features\n\n- **Inventory Service**: Manages product availability and quantity.\n- **Order Service**: Handles order creation and status retrieval.\n- **Notification Service**: Sends notifications related to orders.\n- **Payment Service**: Processes payments for orders.\n\n## Architecture\n\nEach microservice is independent and communicates using gRPC. The services are designed to be modular and scalable.\n\n## Prerequisites\n\nBefore running the services, install the required dependencies:\n\n```bash\nnpm install @grpc/grpc-js @grpc/proto-loader grpc-node-server-reflection\n```\n\n## gRPC APIs with Command Examples\n\n### 1. **Order Service**\n\n**Proto Definition**: [`order.proto`](proto/order.proto)\n\n**Endpoints**:\n- `CreateOrder`\n- `GetOrderStatus`\n\n**Commands**:\n```bash\n# List services\n./grpcurl -plaintext 127.0.0.1:50051 list\n\n# Describe the OrderService\n./grpcurl -plaintext 127.0.0.1:50051 describe order.OrderService\n\n# Describe CreateOrderRequest\n./grpcurl -plaintext 127.0.0.1:50051 describe order.CreateOrderRequest\n\n# Create an order\n./grpcurl -plaintext -d '{\"customer_id\": \"12345\", \"items\": [\"item1\", \"item2\"]}' 127.0.0.1:50051 order.OrderService/CreateOrder\n\n# Get order status\n./grpcurl -plaintext -d '{\"order_id\": \"order-1734601337651\"}' 127.0.0.1:50051 order.OrderService/GetOrderStatus\n\n# Test invalid order ID\n./grpcurl -plaintext -d '{\"order_id\": \"invalid-id\"}' 127.0.0.1:50051 order.OrderService/GetOrderStatus\n```\n\n---\n\n### 2. **Inventory Service**\n\n**Proto Definition**: [`inventory.proto`](proto/inventory.proto)\n\n**Endpoints**:\n- `CheckAvailability`\n\n**Commands**:\n```bash\n# List services\n./grpcurl -plaintext 127.0.0.1:50052 list\n\n# Describe the InventoryService\n./grpcurl -plaintext 127.0.0.1:50052 describe inventory.InventoryService\n\n# Describe CheckAvailabilityRequest\n./grpcurl -plaintext 127.0.0.1:50052 describe inventory.CheckAvailabilityRequest\n\n# Describe CheckAvailabilityResponse\n./grpcurl -plaintext 127.0.0.1:50052 describe inventory.CheckAvailabilityResponse\n\n# Check item availability\n./grpcurl -plaintext -d '{\"item\":\"item1\"}' 127.0.0.1:50052 inventory.InventoryService/CheckAvailability\n```\n\n---\n\n### 3. **Notification Service**\n\n**Proto Definition**: [`notification.proto`](proto/notification.proto)\n\n**Endpoints**:\n- `SendNotification`\n\n**Commands**:\n```bash\n# List services\n./grpcurl -plaintext 127.0.0.1:50053 list\n\n# Describe SendNotificationRequest\n./grpcurl -plaintext 127.0.0.1:50053 describe notification.SendNotificationRequest\n\n# Describe SendNotificationResponse\n./grpcurl -plaintext 127.0.0.1:50053 describe notification.SendNotificationResponse\n\n# Send a notification\n./grpcurl -plaintext -d '{\"order_id\": \"order-123\", \"message\": \"Your order has been shipped!\"}' 127.0.0.1:50053 notification.NotificationService/SendNotification\n```\n\n---\n\n### 4. **Payment Service**\n\n**Proto Definition**: [`payment.proto`](proto/payment.proto)\n\n**Endpoints**:\n- `ProcessPayment`\n\n**Commands**:\n```bash\n# List services\n./grpcurl -plaintext 127.0.0.1:50054 list\n\n# Describe ProcessPaymentRequest\n./grpcurl -plaintext 127.0.0.1:50054 describe payment.ProcessPaymentRequest\n\n# Describe ProcessPaymentResponse\n./grpcurl -plaintext 127.0.0.1:50054 describe payment.ProcessPaymentResponse\n\n# Process a payment\n./grpcurl -plaintext -d '{\"order_id\": \"order-123\", \"amount\": 15}' 127.0.0.1:50054 payment.PaymentService/ProcessPayment\n```\n\n---\n\n## Installation and Usage\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/JawherKl/api-design.git\n   cd grpc/nodejs/order-process-system\n   ```\n\n2. Install dependencies for each service:\n   ```bash\n   cd \u003cservice-folder\u003e\n   npm install\n   ```\n\n3. Start the services:\n   ```bash\n   node server.js\n   ```\n\n4. Test the gRPC APIs using the commands provided above.\n\n## Contributing\n\nContributions are welcome! Please follow the [contribution guidelines](CONTRIBUTING.md) in the repository.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawherkl%2Fgrpc-order-process","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjawherkl%2Fgrpc-order-process","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawherkl%2Fgrpc-order-process/lists"}