{"id":28263440,"url":"https://github.com/martinthenth/rust-service-template","last_synced_at":"2026-04-12T01:37:37.583Z","repository":{"id":294223364,"uuid":"980506368","full_name":"martinthenth/rust-service-template","owner":"martinthenth","description":"🦀 A modern Rust microservice template with GraphQL, gRPC, Kafka, PostgreSQL, and full observability out of the box.","archived":false,"fork":false,"pushed_at":"2025-05-19T22:53:00.000Z","size":85,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-12T01:37:06.086Z","etag":null,"topics":["debezium","graphql","grpc","kafka","microservice","opentelemetry","postgres","rust","template"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinthenth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-05-09T08:39:35.000Z","updated_at":"2026-02-06T03:33:41.000Z","dependencies_parsed_at":"2025-05-19T13:23:43.216Z","dependency_job_id":"b4fd57f8-7399-4772-8c57-b85ca821ec50","html_url":"https://github.com/martinthenth/rust-service-template","commit_stats":null,"previous_names":["martinthenth/rust-service-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/martinthenth/rust-service-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinthenth%2Frust-service-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinthenth%2Frust-service-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinthenth%2Frust-service-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinthenth%2Frust-service-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinthenth","download_url":"https://codeload.github.com/martinthenth/rust-service-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinthenth%2Frust-service-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31701641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T21:17:31.016Z","status":"ssl_error","status_checked_at":"2026-04-11T21:17:24.556Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["debezium","graphql","grpc","kafka","microservice","opentelemetry","postgres","rust","template"],"created_at":"2025-05-20T08:11:21.129Z","updated_at":"2026-04-12T01:37:37.575Z","avatar_url":"https://github.com/martinthenth.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🦀 Rust Service Template\n\n\u003c!-- TODO: Review and improve README.md with ChatGPT --\u003e\n\n## Introduction\n\nA modern template for building production-ready **Rust microservices**. Clone this project to kickstart services with:\n\n- **GraphQL over HTTP** using `axum` (`web`)\n- **gRPC with Protobuf** using `tonic` (`rpc`)\n- **Kafka consumer** using `rdkafka` and `sea-streamer` (`bus`)\n- **Kafka producer** using `debezium` using the **Outbox Pattern**\n- **PostgreSQL** with `sqlx` and `sea-query`\n- **Observability** with `opentelemetry` and Jaeger\n- **Async runtime** powered by `tokio`\n\nIdeal for software engineers looking to quickly scaffold scalable and testable microservices in Rust.\n\n## 🚀 Getting Started\n\n### Pre-requisites:\n\nInstall the following tools:\n\n1. [asdf](https://asdf-vm.com) version manager\n2. Required `asdf` plugins:\n   - [rust](https://github.com/code-lever/asdf-rust.git)\n   - [protoc](https://github.com/paxosglobal/asdf-protoc.git)\n   - [task](https://github.com/particledecay/asdf-task.git)\n   - [buf](https://github.com/truepay/asdf-buf.git) (optional for testing)\n   - [grpcurl](https://github.com/asdf-community/asdf-grpcurl) (optional for testing)\n3. [Docker](https://www.docker.com) for running dependencies (Postgres, Kafka, Jaeger, etc.)\n\n### Setup\n\nRun the following:\n\n```sh\ndocker-compose up -d           # Start database, Kafka, Jaeger, etc.\nasdf install                   # Install tool versions from .tool-versions\ntask install                   # Install dependencies and tooling\ntask migrate                   # Run database migrations\n./register-debezium.sh         # Register Debezium for CDC (optional)\n```\n\nIf you see an error about `sqlx` not found, run:\n\n```sh\nasdf reshim\n```\n\n## 🧪 Running Services\n\nStart individual services using Cargo:\n\n- Web Server:\n  ```sh\n  cargo run -p web\n  ```\n- RPC Server:\n  ```sh\n  cargo run -p rpc\n  ```\n- Bus Server:\n  ```sh\n  cargo run -p bus\n  ```\n\n## 🔍 Manual Testing\n\n### Web Server (GraphQL)\n\nSend a mutation to the GraphQL endpoint:\n\n```sh\ncurl -X POST http://localhost:4000/graph \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"query\": \"mutation CreateUser($input: CreateUserInput!) { createUser(input: $input) { id firstName lastName createdAt } }\",\n    \"variables\": {\n      \"input\": {\n        \"firstName\": \"John\",\n        \"lastName\": \"Doe\"\n      }\n    }\n  }'\n```\n\nThis will trigger both a database write and a message to Kafka (via the outbox table).\n\n### RPC Server (gRPC)\n\nCall the gRPC GetUser method using grpcurl:\n\n```sh\ngrpcurl -plaintext \\\n  -import-path ./protos \\\n  -proto protos/example/users/v1/rpc/users.proto \\\n  -d '{ \"id\": \"\u003cYOUR USER ID\u003e\" }' \\\n  0.0.0.0:50051 \\\n  example.users.v1.rpc.Users/GetUser\n```\n\n### Bus Server (Kafka Consumer)\n\nTo test the Kafka consumer flow:\n\n1. Run the Debezium registration script:\n   ```sh\n   ./register-debezium.sh\n   ```\n2. Start the bus server:\n   ```sh\n   cargo run -p bus\n   ```\n3. Trigger a GraphQL mutation (as shown above under Web Server).\n\nThe Bus Server will consume the message published by Debezium and process it.\n\n## ⚙️ Continuous Integration\n\nA basic GitHub Actions workflow is available in `.github/workflows/ci.yml`. It includes steps for:\n\n- Formatting and linting\n- Running tests\n\n## 🧱 Project Structure\n\n```sh\n.\n├── workspace/\n│   ├── base/             # Business logic\n│   ├── web/              # GraphQL server\n│   ├── rpc/              # gRPC server\n│   ├── bus/              # Kafka consumer\n│   └── meta/             # Test macros\n├── protos/               # Protobuf definitions\n├── migrations/           # Database migrations\n├── docs/                 # Service documentation\n├── buf.yaml              # Protobuf linter\n├── docker-compose.yaml   # Docker containers\n├── register-debezium.sh  # Debezium connector\n├── taskfile.yaml         # Task runner commands\n├── .github               # GitHub Actions\n└── .tool-versions        # asdf tool versions\n```\n\n## 🤝 Contributing\n\nThis project is a template and not meant for external PRs.\nFeel free to fork it and make it your own!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinthenth%2Frust-service-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinthenth%2Frust-service-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinthenth%2Frust-service-template/lists"}