{"id":18852075,"url":"https://github.com/verma-kunal/blogapi-auth-cerbos","last_synced_at":"2026-04-21T09:32:23.808Z","repository":{"id":240007499,"uuid":"800770101","full_name":"verma-kunal/blogapi-auth-cerbos","owner":"verma-kunal","description":"RESTful API for a blog app with built-in authorization using Cerbos","archived":false,"fork":false,"pushed_at":"2024-05-19T07:20:33.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T05:48:31.414Z","etag":null,"topics":["cerbos","echo-framework","golang","yaml"],"latest_commit_sha":null,"homepage":"","language":"Go","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/verma-kunal.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}},"created_at":"2024-05-15T00:55:12.000Z","updated_at":"2024-10-30T00:09:59.000Z","dependencies_parsed_at":"2024-05-16T08:59:28.763Z","dependency_job_id":"606a4afa-2fa1-40ef-bb4b-f79f430bfee8","html_url":"https://github.com/verma-kunal/blogapi-auth-cerbos","commit_stats":null,"previous_names":["verma-kunal/blogapi-auth-cerbos"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/verma-kunal/blogapi-auth-cerbos","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verma-kunal%2Fblogapi-auth-cerbos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verma-kunal%2Fblogapi-auth-cerbos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verma-kunal%2Fblogapi-auth-cerbos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verma-kunal%2Fblogapi-auth-cerbos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/verma-kunal","download_url":"https://codeload.github.com/verma-kunal/blogapi-auth-cerbos/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verma-kunal%2Fblogapi-auth-cerbos/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32085462,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T06:27:27.065Z","status":"ssl_error","status_checked_at":"2026-04-21T06:27:21.250Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["cerbos","echo-framework","golang","yaml"],"created_at":"2024-11-08T03:37:56.577Z","updated_at":"2026-04-21T09:32:23.788Z","avatar_url":"https://github.com/verma-kunal.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blog REST API w/Authorization Using Cerbos\n\n## Technologies Used\n\n- Go\n- [Echo Web Framework](https://echo.labstack.com/docs)\n- [Cerbos](https://www.cerbos.dev/)\n\n## Overview\n\nThis project implements a RESTful API for a blog application with built-in authorization using Cerbos. The API allows users to perform **CRUD (Create, Read, Update, Delete)** operations on blog posts while enforcing access control policies defined by Cerbos.\n\n## Features\n\n- **User Authentication**: Users can authenticate using basic authentication to access protected endpoints.\n- **Post Management**: Users can create, read, update, and delete blog posts via the API.\n- **Fine-Grained Authorization**: Access to API endpoints is controlled by Cerbos policies, enabling fine-grained control over who can perform specific actions on blog posts based on user roles, resource attributes, and environmental context.\n\n## User Database and Roles\n\n| Users | Passwords | Roles |\n| ----- | --------- | ----- |\n| kunal | kunalPass | admin |\n| bella | bellaPass | user  |\n| john  | johnPass  | user  |\n\n\n## Installation\n\nTo run the project locally, follow these steps:\n\n1. Clone the repository:\n    ```bash\n    git clone https://github.com/verma-kunal/blogapi-auth-cerbos.git\n    ```\n2. Install dependencies:\n    ```bash\n    go mod tidy\n    ```\n3. Build and run the project:\n    ```bash\n    cerbos run --set=storage.disk.directory=cerbos/policies -- go run main.go\n    ```\n\n## Usage\n\nOnce the project is running, you can interact with the API using tools like cURL or Postman. Here are some example API endpoints:\n\n- **Create a Post:**\n    ```bash\n    curl -i -u kunal:kunalPass -X PUT http://localhost:8080/posts -d '{\"title\": \"gitops 101\", \"owner\": \"kunal\"}'\n    ```\n- **Read a Post:**\n    ```bash\n    curl -i -u kunal:kunalPass -X GET http://localhost:8080/posts/1\n    ```\n- **Update a Post:**\n    ```bash\n    curl -i -u kunal:kunalPass -X POST http://localhost:8080/posts/1 -d '{\"title\": \"kubernetes 101\", \"owner\": \"kunal\"}'\n    ```\n- **Delete a Post:**  \n    ```bash\n    curl -i -u kunal:kunalPass -X DELETE http://localhost:8080/posts/1\n    ```\n    \n## Contributing\n\n**Contributions are welcome!** If you'd like to contribute to the project, please fork the repository, make your changes, and submit a pull request. Make sure to follow the contribution guidelines outlined in the repository.\n\n## License\n\nThis project is licensed under the [Apache License](https://github.com/verma-kunal/blogapi-auth-cerbos/blob/main/LICENSE). See the LICENSE file for details.\n    ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fverma-kunal%2Fblogapi-auth-cerbos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fverma-kunal%2Fblogapi-auth-cerbos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fverma-kunal%2Fblogapi-auth-cerbos/lists"}