Skip to content

A backend service designed to fetch, cache, and analyze GitHub repository issues using Python, FastAPI, SQLite, and Google Gemini LLM.

Notifications You must be signed in to change notification settings

JoeBrar/github-issue-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Issue Analyzer

A backend service designed to fetch, cache, and analyze GitHub repository issues using Python, FastAPI, SQLite, and Google Gemini LLM.

How to Run

1. Installation

Clone the repository and install the dependencies:

pip install -r requirements.txt

2. Configuration

Create a .env file in the root directory. You can copy the .env.example:

Edit .env and add your keys:

GITHUB_TOKEN = your github personal access token
GEMINI_API_KEY = your google gemini api key

3. Running the Server

Start the application using Uvicorn:

uvicorn main:app --reload

By default, the server will be available at: http://127.0.0.1:8000
Swagger UI to test the app: http://127.0.0.1:8000/docs


Design Choice: Why I used SQLite?

I chose SQLite because it's perfect for local caching.

  • Persistence: Data remains persistent even after restarts (unlike in-memory).
  • Zero-Config: No extra server to manage (unlike Postgres/Redis).
  • SQL Integration: Easy to query and filter data efficiently.
  • Type Safety: Works great with SQLModel + Pydantic.

Prompts Used

"Scaffold a modular FastAPI project with services, models, and database directories. Use SQLModel for SQLite and httpx for async requests. Include a lifespan context manager in main.py for DB initialization."

"Create a GitHubService to fetch issues from a owner/repo string. Extract id, title, body, html_url, and created_at. Handle API errors and 404s gracefully."

"Implement the /scan endpoint to fetch issues via GitHubService and upsert them into SQLite using SQLModel. Return a summary with the count of new/updated issues."

"Build an analyze_issues service using Google Gemini. It should accept a list of issues and a user prompt, truncating issue bodies to 2000 chars to fit context. Support both text and markdown output formats."

"Expose /analyze (text) and /analyze-md (markdown) endpoints. Retrieve cached issues from SQLite, format them for the LLM service, and return the generated analysis."

I reviewed all the code generated by AI to make sure it is correct and robust and works as expected. Also corrected and re-directed the AI to make sure it is working in the right direction.

About

A backend service designed to fetch, cache, and analyze GitHub repository issues using Python, FastAPI, SQLite, and Google Gemini LLM.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages