A Flask-based backend API that fetches GitHub repository data and uses Google's Gemini AI to generate insightful summaries.
- Search GitHub repositories by keywords
- Retrieve repository details (README, open issues, PRs, discussions, dependencies)
- Generate AI-powered summaries of repositories
- Summarize individual issues and pull requests
- Analyze error messages in the context of a repository
- Python 3.x
- Flask web framework
- PyGithub for GitHub API integration
- Google's Gemini AI for summaries
- GitHub GraphQL API for certain data points
- Clone the repository
- Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate - Install dependencies:
pip install -r requirements.txt - Copy the
.env_examplefile to.envand fill in the required API keys:cp env_example .env
Required environment variables in your .env file:
GITHUB_TOKEN: Your GitHub Personal Access TokenGEMINI_API_KEY: Your Google Gemini API keySECRET_KEY: A secret key for FlaskDATABASE_URL: (Optional) For future database implementation
GET /api/search?q=<query>
- Searches GitHub for repositories matching the query
- Returns repository basic information ordered by stars
GET /api/analyze/<owner>/<repo_name>
- Fetches detailed repository information including README, open issues, PRs and discussions
POST /api/summarize/overall/<owner>/<repo_name>
- Generates an AI-powered overview of the repository
- Requires repository data in the request body
POST /api/summarize/item/<owner>/<repo_name>/<item_type>/<item_number>
- Generates a concise summary of an issue or pull request
- Item type can be "issue" or "pr"
POST /api/analyze/error/<owner>/<repo_name>
- Analyzes user-reported error messages in the context of the repository
app.py: Main Flask application with API endpointsconfig.py: Configuration management and environment variablesdatabase.py: Database setup (for future implementations)core/: Core functionality modulesgithub_api.py: GitHub API integrationgemini_api.py: Google Gemini AI integrationutils.py: Utility functions
The API implements comprehensive error handling for:
- GitHub API rate limits
- Authentication issues
- Missing resources
- AI response errors
- General server exceptions
- Database integration for caching and history
- User authentication
- Additional AI-powered insights
- Support for more GitHub data sources