{"id":29345575,"url":"https://github.com/lordzerato/wrappergithubapi","last_synced_at":"2025-07-22T20:34:50.314Z","repository":{"id":300025973,"uuid":"1004064176","full_name":"lordzerato/WrapperGithubApi","owner":"lordzerato","description":"Wrapper for GitHub API to securely access data while hiding the GitHub token from the client/front end, supporting the RepEx - GitHub Repositories Explorer project.","archived":false,"fork":false,"pushed_at":"2025-07-10T15:23:48.000Z","size":84,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-10T21:20:32.194Z","etag":null,"topics":["cachetools","fastapi","github-api","graphql","httpx","pydantic","pydantic-v2","pylance","python","python-3","rate-limiter","slowapi","uvicorn"],"latest_commit_sha":null,"homepage":"https://wrappergithubapi-production.up.railway.app/docs","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lordzerato.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":"2025-06-18T04:20:16.000Z","updated_at":"2025-07-10T15:23:51.000Z","dependencies_parsed_at":"2025-06-19T14:33:14.738Z","dependency_job_id":"70b69640-244c-4d73-8c4d-bed60d104a1e","html_url":"https://github.com/lordzerato/WrapperGithubApi","commit_stats":null,"previous_names":["lordzerato/wrappergithubapi"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lordzerato/WrapperGithubApi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordzerato%2FWrapperGithubApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordzerato%2FWrapperGithubApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordzerato%2FWrapperGithubApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordzerato%2FWrapperGithubApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lordzerato","download_url":"https://codeload.github.com/lordzerato/WrapperGithubApi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lordzerato%2FWrapperGithubApi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266567729,"owners_count":23949406,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cachetools","fastapi","github-api","graphql","httpx","pydantic","pydantic-v2","pylance","python","python-3","rate-limiter","slowapi","uvicorn"],"created_at":"2025-07-08T15:28:44.038Z","updated_at":"2025-07-22T20:34:50.304Z","avatar_url":"https://github.com/lordzerato.png","language":"Python","readme":"# WrapperGithubApi\n\nWrapperGithubApi is a backend service designed to support the **RepEx - GitHub Repositories Explorer** project. This API acts as a secure wrapper around GitHub's REST and GraphQL APIs, hiding the GitHub token to prevent exposure on the frontend.\n\n## Purpose\n\nThis project serves as a secure intermediary layer for GitHub data access in the RepEx project ([GitHub Repository Explorer](https://github.com/lordzerato/GitHub-repositories-explorer)).\n\n## Key Features\n\n- Secure GitHub API access (REST \u0026 GraphQL)\n- Built with FastAPI + Uvicorn for high performance\n- Response time logging via middleware\n- Centralized error handler for consistent API responses\n- Centralized configuration using `pydantic_settings` for cleaner and consistent environment management\n- Rate limiting using SlowAPI to prevent abuse\n- Middleware integrations: CORS, GZip, Trusted Host\n- Secure headers via middleware to prevent Clickjacking, XSS, and insecure redirects\n- Built-in caching using `cachetools`\n- OpenAPI and ReDoc auto-generated documentation at `/docs` and `/redoc`\n- `docker-compose.yml` to assist local development by provisioning Redis, Redpanda, Redpanda Console, Prometheus, and Grafana services.\n\n## Technologies Used\n\n- **Python**: The primary programming language.\n- **FastAPI**: A modern, fast (high-performance) web framework for building APIs with Python.\n- **HTTPX**: An async HTTP client for making requests to the GitHub API.\n- **python-dotenv**: A library to load environment variables from a `.env` file, ensuring that sensitive data (like GitHub tokens) remains secure.\n- **Uvicorn**: An ASGI server to run the FastAPI application.\n- **Cachetools**: A caching library used to store frequently requested data to optimize performance and reduce load on the GitHub API.\n- **SlowAPI**: A FastAPI-compatible rate limiter used to prevent API abuse by restricting the number of requests per client.\n- **pydantic_settings**: A library for managing application configuration using Pydantic models.\n- **redis**: A caching solution used to store frequently accessed data externally, helping to improve performance and minimize load on the GitHub API.\n- **aiokafka**: An asynchronous client library for producing and consuming messages with Kafka.\n\n## Installation\n\n1. Check if Python is installed\n\n   You can verify by running:\n\n   ```bash\n   python --version\n   ```\n\n   \u003e If Python is not installed, download and install it from the official website: https://www.python.org/downloads/\n\n2. Clone the repository\n\n   ```bash\n   git clone https://github.com/yourusername/WrapperGithubApi.git\n   cd WrapperGithubApi\n   ```\n\n3. (Optional) Create a virtual environment\n\n   It’s recommended to use a virtual environment to isolate project dependencies:\n\n   ```bash\n   python -m venv venv\n   source venv/bin/activate   # On Windows: venv\\Scripts\\activate\n   ```\n\n4. Install the required dependencies\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n5. (Optional) If you have Docker installed, you can spin up the services using `docker-compose.yml`:\n   \n   \n   if docker compose version v2\n   ```bash\n   docker compose up -d\n   ```\n\n   or\n   ```bash\n   docker-compose up -d\n   ```\n\n6. Set up environment variables\n\n   Create a `.env` file in the project root directory based on the provided `.env.example`:\n\n   ```env\n   AUTH_TOKEN=your_github_token         # Optional\n   REDIS_URL=redis://localhost:6379     # Optional\n   KAFKA_SERVER=localhost:19092         # Optional\n   LOGGING_LEVEL=INFO                   # DEBUG for full logging\n   ```\n\n7. Run the application\n\n   Start the FastAPI app using Uvicorn:\n\n   ```bash\n   uvicorn app.main:app --reload\n   ```\n\n   \u003e The server will be available at: http://localhost:8000\n\n## Available Endpoints\n\n| Method | Endpoint          | Description                                     |\n| -------|------------------ | ----------------------------------------------- |\n| GET    | `/repos`          | List repositories                               |\n| GET    | `/user`           | Get user info                                   |\n| GET    | `/search`         | Search GitHub users or repository.              |\n| POST   | `/graphql`        | Submit GraphQL queries to GitHub's GraphQL API. |\n\n\u003cdetails\u003e\n\u003csummary\u003eClick to expand full list\u003c/summary\u003e\n\n### Repositories\n| Method | Endpoint                            | Description              |\n|--------|-------------------------------------|--------------------------|\n| GET    | `/repositories`                     | List public repositories |\n| GET    | `/repos/{user}/{repo}`              | Repo detail              |\n| GET    | `/repos/{user}/{repo}/stargazers`   | List repo stragazers     |\n| GET    | `/repos/{user}/{repo}/subscribers`  | List repo subscribers    |\n| GET    | `/repos/{user}/{repo}/contributors` | List repo contributors   |\n| GET    | `/repos/{user}/{repo}/branches`     | List repo branches       |\n| GET    | `/repos/{user}/{repo}/activity`     | List repo activity       |\n| GET    | `/repos/{user}/{repo}/pulls`        | List repo pulls          |\n| GET    | `/repos/{user}/{repo}/issues`       | List repo issues         |\n| GET    | `/repos/{user}/{repo}/languages`    | List repo languages      |\n| GET    | `/repos/{user}/{repo}/topics`       | List repo topics         |\n| GET    | `/repos/{user}/{repo}/readme`       | Repo readme detail       |\n\n### Users\n| Method | Endpoint                     | Description             |\n|--------|------------------------------|-------------------------|\n| GET    | `/users/{user}`              | Get user info           |\n| GET    | `/user/{user}/repos`         | List user repos         |\n| GET    | `/user/{user}/followers`     | List user followers     |\n| GET    | `/user/{user}/starred`       | List user starred repos |\n| GET    | `/user/{user}/events/public` | List user activity      |\n\n### Search\n| Method | Endpoint               | Description        |\n|--------|------------------------|--------------------|\n| GET    | `/search/users`        | Search Github user |\n| GET    | `/search/repositories` | Search repository  |\n\n### GraphQL\n| Method | Endpoint              | Description                            |\n|--------|-----------------------|----------------------------------------|\n| POST   | `/graphql/query`      | Request GitHub's GraphQL API           |\n| POST   | `/graphql/searchUser` | Search Github user with custom content |\n\n\u003c/details\u003e\n\n\u003e Interactive API documentation available at:\n\u003e - Swagger UI: [`/docs`](http://localhost:8000/docs)\n\u003e - ReDoc: [`/redoc`](http://localhost:8000/redoc)\n\u003e - Redpanda console: [localhost:8080](localhost:8080)\n\u003e - Prometheus: [localhost:9090](localhost:9090)\n\u003e - Grafana: [localhost:3000](localhost:3000)\n\n## Usage Example\n\nOnce the server is up and running, you can access the available endpoints:\n\n- Get repository info:\n  ```http\n  GET /repos/octocat/Hello-World\n  ```\n- Get user data:\n  ```http\n  GET /user/octocat\n  ```\n- Query GraphQL:\n\n  ```http\n  POST /graphql/query\n  Content-Type: application/json\n\n  {\n    \"query\": \"{ viewer { login } }\"\n  }\n  ```\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any improvements or fixes.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgements\n\nThis project is part of **RepEx - GitHub Repositories Explorer**. Check out the main repository for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flordzerato%2Fwrappergithubapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flordzerato%2Fwrappergithubapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flordzerato%2Fwrappergithubapi/lists"}