{"id":15368044,"url":"https://github.com/anonrig/microservices-example","last_synced_at":"2025-06-21T03:34:54.248Z","repository":{"id":68448817,"uuid":"357598564","full_name":"anonrig/microservices-example","owner":"anonrig","description":"Example architecture using GRPC and MQ on node.js","archived":false,"fork":false,"pushed_at":"2021-04-14T19:13:18.000Z","size":1599,"stargazers_count":32,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T12:52:46.930Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/anonrig.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}},"created_at":"2021-04-13T15:17:49.000Z","updated_at":"2025-04-04T08:11:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa1892e8-a1e9-4adc-a968-bb2c2da27426","html_url":"https://github.com/anonrig/microservices-example","commit_stats":{"total_commits":42,"total_committers":1,"mean_commits":42.0,"dds":0.0,"last_synced_commit":"308795abeb7593e2dcc7f4f476bf8db5d1cc722e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anonrig%2Fmicroservices-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anonrig%2Fmicroservices-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anonrig%2Fmicroservices-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anonrig%2Fmicroservices-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anonrig","download_url":"https://codeload.github.com/anonrig/microservices-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249076542,"owners_count":21208811,"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":[],"created_at":"2024-10-01T13:28:00.293Z","updated_at":"2025-04-15T12:52:58.221Z","avatar_url":"https://github.com/anonrig.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Microservices with GRPC and Kafka on Node.js\n\nThis is an example microservices architecture which uses GRPC communication between microservices for requests that need instant reply, and uses fault-tolerant messaging queue for HA.\n\nEach microservice supports both GRPC communication and consumption through Kafka topics. If you need to get a response from a certain microservice, GRPC is recommended. If the task can be done asyncronously, please do it within Kafka's boundaries.\n\n## Architecture Overview\n\n![Architecture Overview](https://raw.githubusercontent.com/anonrig/microservices-example/main/k8s/architecture.png)\n\n## Requirements\n\n- Node (preferably \u003e= 15, since ESM is enabled by default)\n- PostgreSQL (preferably \u003e= 12)\n- Kafka\n\n## Development\n\n1. Install dependencies using `npm install` on the root directory\n2. Run `docker-compose up` on the root directory\n3. Prepare database using the directions in `packages/subscription`\n\n## Deployment\n\nPublic:\n\n- has `/metrics` endpoint where it exposes certain memory and cpu consumption metrics for Prometheus support.\n- has `/health` endpoint for readiness and liveliness probe checks.\n\nGRPC microservices:\n\n- supports `grpc.health.v1.Health` grpc health checks\n\nFor further information regarding Kubernets deployment, please look into the k8s folder.\n\n### Security\n\n- inter microservice communication\n\n  - In general all communications between microservices should be encrypted, preferably using SSL. Right now, all of the requests are signed but have insecure SSL configuration.\n\n- All microservices hide stacktraces and error messages from client by default.\n\n- _Rate limiting_ is enabled on public microservice. the default configuration is max 100 requests per minute.\n\n  - Right now we're using memory based rate limiting which is bad for production since it will reset on deployment, and work be suitable if you have scale to more than 1 horizontal pods.\n  - Exposes `x-ratelimit-limit`, `x-ratelimit-remaining`, `x-ratelimit-reset` and `retry-after` headers to client.\n\n- _CORS configuration_: Before using this code on production make sure that the necessary CORS headers should only allow requests from your owned domains to disallow unwanted requests from browsers and websites.\n\n### OpenAPI 3 Specification\n\nYou can access OpenAPI 3 based documentation generated by `public` microservice using `docs` next.js project which consumes the OpenAPI specification and creates a developer friendly website.\n\n### Privacy Issues\n\n- Subscription microservice is not GDPR friendly. We shouldn't store any personal information unless we particularly need it. Since some of the issues regarding personal information was inside the task itself, I left it there, but in order comply with the regulations, I didn't soft delete a subscription but removed it completely upon cancellation.\n\n### Development Issues\n\n- Lerna npmClientArgs does not work for Node 15 \u0026 NPM 7. Please refer to https://github.com/n8n-io/n8n/issues/1149. In order to solve installation issues you need to run `npm config set legacy-peer-deps true`. By default using `npm install` triggers `prepare-build.js` command which handles this error.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanonrig%2Fmicroservices-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanonrig%2Fmicroservices-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanonrig%2Fmicroservices-example/lists"}