{"id":23440945,"url":"https://github.com/ansh-devs/userdatalink","last_synced_at":"2025-08-26T03:30:47.221Z","repository":{"id":242476084,"uuid":"807486456","full_name":"ansh-devs/UserDataLink","owner":"ansh-devs","description":"RPC based User Service with Search functionality","archived":false,"fork":false,"pushed_at":"2024-06-26T10:13:03.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-13T09:13:28.595Z","etag":null,"topics":["remote-procedure-call"],"latest_commit_sha":null,"homepage":"","language":"Go","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/ansh-devs.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":"2024-05-29T07:39:33.000Z","updated_at":"2024-06-26T10:13:40.000Z","dependencies_parsed_at":"2024-06-03T09:06:20.487Z","dependency_job_id":"7ae7898a-65ce-4b7c-9d19-e9caa5f4ed81","html_url":"https://github.com/ansh-devs/UserDataLink","commit_stats":null,"previous_names":["ansh-devs/tc-assessment","ansh-devs/userdatalink"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansh-devs%2FUserDataLink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansh-devs%2FUserDataLink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansh-devs%2FUserDataLink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansh-devs%2FUserDataLink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ansh-devs","download_url":"https://codeload.github.com/ansh-devs/UserDataLink/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230987356,"owners_count":18311195,"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":["remote-procedure-call"],"created_at":"2024-12-23T16:27:00.314Z","updated_at":"2024-12-23T16:27:01.175Z","avatar_url":"https://github.com/ansh-devs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## **User Service with Search Functionality using gRPC as transportation layer**\r\n\r\n[](https://github.com/ansh-devs/userdatalink/actions/workflows/go-test.yml/badge.svg)\r\n\r\n\r\n\u003c!-- ### **Aspects Taken in considerations**\r\n\r\n- \u0026#9745; Get-Users with a list of IDs provided\r\n- \u0026#9745; Get-User-Details with a specific ID provided --\u003e\r\n\r\n\u003c!-- -  \u0026#9746; --\u003e\r\n\r\n### **Software Architecture Patterns and paradiagms used -**\r\n\r\n- **_Repository Pattern_** \u0026#8594; used in Repository-Layer/Database layer inside the _`internal/database`_ directory to make business logic and database layer logic decoupled. In future if needed just make the struct and implement the [_`UserRepository`_](/internal/database/repository.go) interface to the desired database (Postgres/Cassandra/MongoDb) such that there will be no need to make any changes in the [_`UserService`_](/internal/gapi/server.go) Service layer.\r\n- **_Separation Of Concern (from SOLID)_** \u0026#8594; there is a separation between the transportation layer **_gRPC_** and the Service layer and the repository layer\r\n- **_Dependency Inversion Principle (from SOLID)_** \u0026#8594; Dependency of `UserRepository` is injected in the `UserService` to perform **Db-calls**.\r\n- **_Builder Pattern from Design Principles_** \u0026#8594; used in the constructor of the `UserService` which itself configure the **gRPC's Reflection** and bind the **PORT** to the service.\r\n- **_Idiomatic practices encouraged by the Golang Community_** \u0026#8594; efficient use of `maps`, `slices` etc.\r\n\r\n### **Protocol Buffers v3 Definition**\r\n\r\n- UserService Proto Definition-\r\n\r\n```\r\n+-------------+--------------------+---------------------------+----------------------------+\r\n|   SERVICE   |        RPC         |       REQUEST TYPE        |       RESPONSE TYPE        |\r\n+-------------+--------------------+---------------------------+----------------------------+\r\n| UserService | GetUserById        | GetUserByIdRequest        | GetUserByIdResponse        |\r\n| UserService | GetUsersListByIds  | GetUsersListByIdsRequest  | GetUsersListByIdsResponse  |\r\n| UserService | GetUsersByCriteria | GetUsersByCriteriaRequest | GetUsersByCriteriaResponse |\r\n+-------------+--------------------+---------------------------+----------------------------+\r\n```\r\n\r\n- Available Proto Message Types-\r\n```\r\n+----------------------------+\r\n|          MESSAGE           |\r\n+----------------------------+\r\n| GetUserByIdRequest         |\r\n| GetUserByIdResponse        |\r\n| GetUsersByCriteriaRequest  |\r\n| GetUsersByCriteriaResponse |\r\n| GetUsersListByIdsRequest   |\r\n| GetUsersListByIdsResponse  |\r\n+----------------------------+\r\n```\r\n\r\n* **GetUserById RPC types-**\r\n    * _Request_\r\n\r\n    ```\r\n    +-------+------------+----------+\r\n    | FIELD |    TYPE    | REPEATED |\r\n    +-------+------------+----------+\r\n    | id    | TYPE_INT64 | false    |\r\n    +-------+------------+----------+\r\n\r\n    ```\r\n\r\n    * _Response_\r\n    ```\r\n    +-------+---------------------+----------+\r\n    | FIELD |        TYPE         | REPEATED |\r\n    +-------+---------------------+----------+\r\n    | user  | TYPE_MESSAGE (User) | false    |\r\n    +-------+---------------------+----------+\r\n    ```\r\n\r\n* **GetUsersListByIds RPC types-**\r\n    * _Request_\r\n\r\n    ```\r\n    +-------+------------+----------+\r\n    | FIELD |    TYPE    | REPEATED |\r\n    +-------+------------+----------+\r\n    | ids   | TYPE_INT64 | true     |\r\n    +-------+------------+----------+\r\n\r\n    ```\r\n\r\n    * _Response_\r\n    ```\r\n    +-------+---------------------+----------+\r\n    | FIELD |        TYPE         | REPEATED |\r\n    +-------+---------------------+----------+\r\n    | users | TYPE_MESSAGE (User) | true     |\r\n    +-------+---------------------+----------+\r\n    ```\r\n\r\n* **GetUsersByCriteria RPC types-**\r\n    * _Request_\r\n\r\n    ```\r\n    +-------+---------------------------+----------+\r\n    | FIELD |           TYPE            | REPEATED |\r\n    +-------+---------------------------+----------+\r\n    | type  | TYPE_ENUM (UserCriterias) | false    |\r\n    | value | TYPE_STRING               | false    |\r\n    +-------+---------------------------+----------+\r\n\r\n    ```\r\n\r\n    * _Response_\r\n    ```\r\n    +-------+---------------------+----------+\r\n    | FIELD |        TYPE         | REPEATED |\r\n    +-------+---------------------+----------+\r\n    | users | TYPE_MESSAGE (User) | true     |\r\n    +-------+---------------------+----------+\r\n    ```\r\n\r\n\r\nFor the request and response of RPC calls checkout the [`user_service.proto`](/protos/user_service.proto)\r\n\r\n* **Grpc Interceptor Logging for Incoming Requests**\r\n![alt-logging-image](https://private-user-images.githubusercontent.com/73169410/335441726-dbfb8e6b-90ba-4851-84be-b589080b09a0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTcxMjg2MzcsIm5iZiI6MTcxNzEyODMzNywicGF0aCI6Ii83MzE2OTQxMC8zMzU0NDE3MjYtZGJmYjhlNmItOTBiYS00ODUxLTg0YmUtYjU4OTA4MGIwOWEwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MzElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTMxVDA0MDUzN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFmZjg0OGE2MTExZTk0ZTgzNmI3YzRiOTc0NzkwOTEyM2JlYWM5MzNkODQwNGI4MzY5MmZmODk4NzVmN2QzNWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.2thX25r1tv5-xawpcVycrkPIdv4QfKUmBT9JrG4WY38)\r\n\r\n### **Environment Variable**\r\n\r\nTo run this project, The environment variable `PORT` must be in the accessible scope which is used to set the port where the _gRPC_ server will be listening for the incoming connections.\r\n\r\n### **Steps To Run**\r\n* Without Docker in Linux/WSL Environment:\r\n    * `make run` - will execute the source code. \r\n    * `make build` - will build the executable binary from the source code. \r\n* With Docker:\r\n    * `docker build . -t user-service` - will build image from Dockerfile.\r\n    * `docker run -d --restart=always -p 8080:8080 user-service` - will run the image inside container. \r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansh-devs%2Fuserdatalink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fansh-devs%2Fuserdatalink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansh-devs%2Fuserdatalink/lists"}