{"id":19022080,"url":"https://github.com/kerelko/microservices","last_synced_at":"2026-02-17T00:33:17.010Z","repository":{"id":245329718,"uuid":"817938131","full_name":"KERELKO/microservices","owner":"KERELKO","description":"Simple microservices example of communication through gRPC and RabbitMQ","archived":false,"fork":false,"pushed_at":"2025-03-19T13:06:48.000Z","size":499,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T10:49:01.099Z","etag":null,"topics":["architecture","docker","docker-compose","fastapi","grpc","grpc-python","microservice","microservices","mongodb","postgresql","rabbitmq","rabbitmq-client","rabbitmq-consumer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KERELKO.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":"2024-06-20T18:56:14.000Z","updated_at":"2025-03-19T13:06:51.000Z","dependencies_parsed_at":"2024-06-21T13:15:48.207Z","dependency_job_id":"2af281de-937d-47e4-a85e-451fb9382e75","html_url":"https://github.com/KERELKO/microservices","commit_stats":null,"previous_names":["kerelko/microservices"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KERELKO/microservices","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KERELKO%2Fmicroservices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KERELKO%2Fmicroservices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KERELKO%2Fmicroservices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KERELKO%2Fmicroservices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KERELKO","download_url":"https://codeload.github.com/KERELKO/microservices/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KERELKO%2Fmicroservices/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29526834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T21:45:09.491Z","status":"ssl_error","status_checked_at":"2026-02-16T21:44:58.452Z","response_time":115,"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":["architecture","docker","docker-compose","fastapi","grpc","grpc-python","microservice","microservices","mongodb","postgresql","rabbitmq","rabbitmq-client","rabbitmq-consumer"],"created_at":"2024-11-08T20:24:45.215Z","updated_at":"2026-02-17T00:33:16.988Z","avatar_url":"https://github.com/KERELKO.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Microservices example\n\n*Simple microservices example of communication through gRPC and RabbitMQ*\n\n### Schema\n![image](https://github.com/user-attachments/assets/f2c25a16-f6e9-499f-b62f-c13425db5eb3)\n\n## Technologies\n1. [gRPC](https://grpc.io/)\n2. [FastAPI](https://fastapi.tiangolo.com/)\n3. [RabbitMQ](https://www.rabbitmq.com/)\n4. [MongoDB](https://www.mongodb.com/)\n5. [PostgreSQL](https://www.postgresql.org/)\n6. [Docker](https://www.docker.com/) \u0026 [Docker Compose](https://docs.docker.com/compose/)\n\n## How to Use\n\n### Requirements\n1. [Docker](https://www.docker.com/)\n2. [Docker Compose](https://docs.docker.com/compose/)\n\n### Install \u0026 Run\n1. Clone the repository\n```\ngit clone https://github.com/KERELKO/microservices\n```\n2. Copy the `.env.example` files to `.env` for each service and fill in the required environment variables. Run this commands from the root directory\n```\ncd product_service\ncat .env.example \u003e .env\ncd ../auth_service\ncat .env.example \u003e .env\n```\n3. Run services with command\n```\n./entrypoint.sh\n```\nThe `./entrypoint.sh` script starts up the necessary *Docker* containers\n\n### Usage\nAfter installing and running *Docker containers* you must see API docs on your \nlocal machine on the url `http://127.0.0.1:8001/api/docs` (*auth-service*) and `http://127.0.0.1:8000/api/docs` (*product-service*)\n\n## How to use RabbitMQ RPC instead of gRPC\n1. Go to `/product_service/src/common/container.py`\n2. Replace line\n```py\ncontainer.register(AbstractAuthService, instance=gRPCAuthService())\n```\nwith \n```py\ncontainer.register(AbstractAuthService, instance=RabbitAuthService())\n```\n3. Run the following command in the root directory\n```\n./entrypoint.rmq.sh\n```\n4. Result is the same as in [Usage](README.md) section\n\n## Testing\nTo test the functionality of the services, you can use `Postman` or `pytest`; you can also use Swagger, but only for endpoints that do not have `Cookie` requirements.\n\u003e [!IMPORTANT]\n\u003e At the moment (*23.09.2024*) API docs (Swagger) cannot set cookies, so it will always throw `401 Unauthorized` to *product-service* api calls\n\n### Pytest\nYou can run tests with pytest in *product-service* with command (only in `product_service` directory):\n```\npytest tests/\n```\nthis command will execute all available tests for the *product-service*  \nthere are available only e2e tests that ensure communication with *auth-service* and *product-service*\n## Project Structure\n\u003e [!NOTE]\n\u003e If you are developing microservices, it's a good practice to separate each microservice in its own repository. Here all microservices are in one repository for illustrative purposes, particularly for communication between services. \n\n```\n.\n├── auth_service\n│   ├── docker-compose.yaml\n│   ├── Dockerfile\n│   ├── entrypoint.sh\n│   ├── grpc_\n│   │   ├── __init__.py\n│   │   ├── unary_auth_pb2_grpc.py\n│   │   ├── unary_auth_pb2.py\n│   │   ├── unary_auth_pb2.pyi\n│   │   └── unary_auth.proto\n│   ├── Makefile\n│   ├── poetry.lock\n│   ├── pyproject.toml\n│   └── src\n│       ├── common\n│       │   ├── config.py\n│       │   ├── db\n│       │   │   ├── __init__.py\n│       │   │   └── sqlalchemy\n│       │   │       ├── config.py\n│       │   │       ├── __init__.py\n│       │   │       └── models.py\n│       │   ├── di.py\n│       │   ├── dto.py\n│       │   ├── exceptions.py\n│       │   ├── __init__.py\n│       │   └── utils.py\n│       ├── entrypoints\n│       │   ├── fastapi_app.py\n│       │   ├── grpc_server.py\n│       │   ├── __init__.py\n│       │   └── rabbitmq_consumer.py\n│       ├── services\n│       │   ├── auth.py\n│       │   ├── exceptions.py\n│       │   └── __init__.py\n│       ├── storages\n│       │   ├── __init__.py\n│       │   └── repositories\n│       │       ├── base.py\n│       │       └── impl.py\n│       └── web\n│           ├── exceptions.py\n│           ├── handlers.py\n│           ├── __init__.py\n│           └── schemas.py\n├── entrypoint.sh\n├── LICENSE\n├── Makefile\n├── message_broker\n│   ├── docker-compose.yaml\n│   └── rabbitmq\n│       └── log\n├── product_service\n│   ├── docker-compose.yaml\n│   ├── Dockerfile\n│   ├── grpc_\n│   │   ├── __init__.py\n│   │   ├── unary_auth_pb2_grpc.py\n│   │   ├── unary_auth_pb2.py\n│   │   ├── unary_auth_pb2.pyi\n│   │   └── unary_auth.proto\n│   ├── main.py\n│   ├── poetry.lock\n│   ├── pyproject.toml\n│   ├── src\n│   │   ├── common\n│   │   │   ├── config.py\n│   │   │   ├── container.py\n│   │   │   ├── dto.py\n│   │   │   └── __init__.py\n│   │   ├── __init__.py\n│   │   ├── repositories\n│   │   │   ├── base.py\n│   │   │   ├── __init__.py\n│   │   │   └── mongo.py\n│   │   ├── services\n│   │   │   ├── base.py\n│   │   │   ├── exceptions.py\n│   │   │   ├── impl.py\n│   │   │   └── __init__.py\n│   │   └── web\n│   │       ├── handlers.py\n│   │       ├── __init__.py\n│   │       ├── middlewares.py\n│   │       ├── schemas.py\n│   │       └── utils.py\n│   └── tests\n│       ├── e2e\n│       │   ├── conftest.py\n│       │   ├── __init__.py\n│       │   └── test_gw_communication.py\n│       └── __init__.py\n└── README.md\n\n24 directories, 71 files\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkerelko%2Fmicroservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkerelko%2Fmicroservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkerelko%2Fmicroservices/lists"}