{"id":15104850,"url":"https://github.com/solo21-12/google-cloud-run","last_synced_at":"2026-01-27T13:02:40.988Z","repository":{"id":255495478,"uuid":"849820681","full_name":"solo21-12/google-cloud-run","owner":"solo21-12","description":"This project is a Golang-based REST API designed to manage users, groups, and roles within a PostgreSQL database. It provides complete CRUD operations for each entity, along with specific endpoints to handle the relationships between users, groups, and roles. The API is optimized to run on Google Cloud Run.","archived":false,"fork":false,"pushed_at":"2024-09-04T14:43:14.000Z","size":19944,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-31T00:44:52.609Z","etag":null,"topics":["docker","golang","postgres","rest-api"],"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/solo21-12.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-08-30T10:08:50.000Z","updated_at":"2024-09-04T07:20:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f95163b-735c-48aa-a7b0-863e395a9639","html_url":"https://github.com/solo21-12/google-cloud-run","commit_stats":{"total_commits":49,"total_committers":2,"mean_commits":24.5,"dds":"0.10204081632653061","last_synced_commit":"e0221495c4bcb5c574e97976e604fec3d46b3c1e"},"previous_names":["solo21-12/google-cloud-run"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/solo21-12/google-cloud-run","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solo21-12%2Fgoogle-cloud-run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solo21-12%2Fgoogle-cloud-run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solo21-12%2Fgoogle-cloud-run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solo21-12%2Fgoogle-cloud-run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solo21-12","download_url":"https://codeload.github.com/solo21-12/google-cloud-run/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solo21-12%2Fgoogle-cloud-run/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28813225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T12:25:15.069Z","status":"ssl_error","status_checked_at":"2026-01-27T12:25:05.297Z","response_time":168,"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":["docker","golang","postgres","rest-api"],"created_at":"2024-09-25T20:03:01.829Z","updated_at":"2026-01-27T13:02:40.968Z","avatar_url":"https://github.com/solo21-12.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\n\n# Go REST API for User, Group, and Role Management\n\n![Go](https://img.shields.io/badge/Go-1.22-blue.svg) ![PostgreSQL](https://img.shields.io/badge/PostgreSQL-13-blue.svg) ![Docker](https://img.shields.io/badge/Docker-20.10-blue.svg) ![Makefile](https://img.shields.io/badge/Makefile-Enabled-brightgreen.svg)\n\n## Overview\n\nThis project is a Golang-based REST API designed to manage users, groups, and roles within a PostgreSQL database. It provides complete CRUD operations for each entity, along with specific endpoints to handle the relationships between users, groups, and roles. The API is optimized to run on Google Cloud Run.\n\n## Features\n\n- **Users**: Create, update, delete, and manage user details. Query users by UID or search by name.\n- **Groups**: Manage groups, including adding/removing users from groups.\n- **Roles**: Assign roles to users, manage role details including rights stored as JSON.\n- **JWT-Based Authentication**: Secure endpoints using JWT tokens.\n- **Dynamic Database Selection**: Middleware dynamically selects the database based on the authorization header.\n\n## Endpoints\n\n### Users\n- `GET /users`: Retrieve all users.\n- `GET /users?search=searchterm\u0026limit=max_results\u0026orderby=column`: Search users by name.\n- `GET /users/{uid}`: Retrieve user details by UID, including assigned role.\n- `GET /users/{uid}/groups`: Retrieve all groups associated with the user.\n- `POST /users`: Create a new user.\n- `PUT /users/{uid}`: Update user details.\n- `DELETE /users/{uid}`: Delete a user.\n- `Patch  /users/{uid}/groups`: Add user to groups\n\n### Groups\n- `GET /groups`: Retrieve all groups.\n- `GET /groups/{uid}`: Retrieve group details by UID.\n- `GET /groups/{uid}/users`: Retrieve all users within a specific group.\n- `POST /groups`: Create a new group.\n- `PUT /groups/{uid}`: Update group details.\n- `DELETE /groups/{uid}`: Delete a group.\n\n### Roles\n- `GET /roles`: Retrieve all roles.\n- `GET /roles/{uid}`: Retrieve role details by UID.\n- `GET /roles/{uid}/users`: Retrieve all users assigned to a specific role.\n- `POST /roles`: Create a new role.\n- `PUT /roles/{uid}`: Update role details.\n- `DELETE /roles/{uid}`: Delete a role.\n\n## Project Structure\n\n```plaintext\n├── cmd\n│   └── main.go\n├── config\n│   ├── env.go\n│   └── postgres.go\n├── Delivery\n│   ├── Controllers\n│   ├── Middlewares\n│   └── Routers\n├── Dockerfile\n├── Domain\n│   ├── Dtos\n│   ├── Interfaces\n│   └── Models\n├── Infrastructure\n├── Repository\n├── Tests\n├── tmp\n└── Usecases\n```\n\n## Local Setup\n\nTo run this project locally, you need to set up the following environment variables in the docker-compose file:\n\n```plaintext\nJWT_SECRET=\"your-jwt-secret\"\nDB_USER=\"your-db-user\"\nDB_PASS=\"your-db-password\"\nDB_HOST=\"localhost\"\nDB_PORT=5432\n```\n\n### Running the Application\n\n- **Using Docker**:  \n  Build and run the Docker container:\n  ```bash\n  make run\n  ```\n\n**Note**: Make sure to update the `Docker-compose` with your environment variable information.\n\n### Running Tests\n\nTo execute the tests, run:\n```bash\nmake test\n```\n\n### To stop the server\n```bash\nmake down\n```\n\n### To see logs\n```bash\nmake logs\n```\n\n## API Documentation\n\nFor detailed API documentation, please refer to the [Postman Collection](https://documenter.getpostman.com/view/22911710/2sAXjM2qbR).\n\n## Deployment on Google Cloud Run\n\nThis project is designed to be deployed on Google Cloud Run. Ensure all necessary configurations are set before deploying.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolo21-12%2Fgoogle-cloud-run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolo21-12%2Fgoogle-cloud-run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolo21-12%2Fgoogle-cloud-run/lists"}