⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Gitra is a self-hosted web app to explore, analyze, and "chat" with any public GitHub repository. It bundles codebases into LLM-optimized context for instant AI analysis using Google Gemini.

License

Notifications You must be signed in to change notification settings

ashfromsky/gitra

Repository files navigation

Gitra

Clone any GitHub repo and ask AI questions about the code.

Import a repository, browse files like in an IDE, and get instant explanations from AI. No more context switching between browser and editor.

Python 3.11+ FastAPI License: MIT

Gitra Banner


Quick Start

Desktop App (Easiest)

git clone https://github.com/ashfromsky/gitra.git
cd gitra
pip install -r requirements.txt
python desktop.py

The app will open automatically at http://127.0.0.1:46789

Web Version

git clone https://github.com/ashfromsky/gitra.git
cd gitra
pip install -r requirements.txt

# Copy example env file
cp .env.example .env

# Add your Gemini API key to .env
# Get it free at https://aistudio.google.com/app/apikey

# Start server
uvicorn app.gitra:app --reload --port 8000

Visit http://localhost:8000

Docker

git clone https://github.com/ashfromsky/gitra.git
cd gitra
docker-compose up

Visit http://localhost:8000


What It Does

Gitra is a code exploration tool. You paste a GitHub URL, and it clones the repo locally. Then you can:

  • Browse files in a clean IDE-style interface
  • Select any piece of code and ask AI about it
  • Get bug reports and improvement suggestions
  • View repository statistics (stars, forks, languages)

Think of it as "GitHub meets AI assistant" but running locally.

Gitra UI


Features

Code Browser

  • Syntax highlighting for 20+ languages
  • File tree with icons
  • Markdown preview
  • Image viewer
  • Multi-tab editor

AI Assistant

  • Analyze entire files or selected code
  • Ask specific questions about logic
  • Get bug detection and refactoring tips
  • Works with Google Gemini API

Repository Stats

  • GitHub metadata (stars, forks, watchers)
  • Language breakdown
  • Commit activity
  • Topic tags

UI

  • Dark/light themes (Gruvbox palette)
  • Vim-inspired status line
  • Keyboard shortcuts
  • Tab management like VSCode

How It Works

  1. Import - Paste any public GitHub URL
  2. Browse - Files are cloned to downloaded_repos/
  3. Analyze - AI reads your code and system prompt from app/routes/ai/genai_gemini/
  4. Ask - Select code, click "Ask AI", get explanations

The AI panel uses an iframe with local message passing. No code leaves your machine except API calls to Gemini.


Configuration

API Keys

⚠️ Security Note: API keys are stored in plaintext in user_config.json. Do not commit this file. For production use, consider encryption.

You need a free Google Gemini API key. Get one at aistudio.google.com/app/apikey

Option 1: Settings UI

  1. Open Gitra
  2. Click the gear icon (top right)
  3. Paste your API key
  4. Click "Save Key"

Option 2: Environment Variable

# Add to .env file
GEMINI_API_KEY=AIzaSyD...your-key-here

Option 3: Config File Keys are stored in user_config.json (auto-created, gitignored)

GitHub Token (Optional)

For repository stats, add a GitHub token:

# Add to .env
GITHUB_TOKEN=ghp_your-token-here

Without this, stats will show limited data due to API rate limits.


Project Structure

gitra/
├── app/
│   ├── gitra.py                    # FastAPI app
│   ├── config_manager.py           # Settings handler
│   ├── routes/
│   │   ├── basic/combined/repo.py  # File browsing
│   │   ├── ai/base_response.py     # AI endpoint
│   │   └── stats/repo_stats.py     # GitHub stats
│   └── utils/exporter.py           # Repo to markdown
├── templates/
│   ├── index.html                  # Landing page
│   ├── view_repo.html              # IDE interface
│   └── repo_stats.html             # Stats dashboard
├── static/
│   ├── ai_chat.html                # AI panel iframe
│   └── *.svg                       # Logos
├── desktop.py                      # Desktop app launcher
└── downloaded_repos/               # Cloned repos (gitignored)

Keyboard Shortcuts

Key Action
Cmd/Ctrl + K Open AI assistant
Alt + W Toggle word wrap
Esc Close active tab

Limitations

Current version supports:

  • Public repositories only (private repos planned)
  • Single AI provider (Gemini)
  • Basic git operations (clone only, no pull/push)

Not supported yet:

  • Multiple repositories open at once
  • Search across files
  • Git history browsing
  • Code editing (read-only for now)

Why I Built This

I got tired of switching between GitHub, my editor, and ChatGPT just to understand a new codebase. Wanted something that does all three in one window.


Roadmap

v1.1 - Core improvements

  • Private repository support (OAuth)
  • Search in files
  • Multiple AI providers (Claude, local LLMs)
  • Git operations (pull, checkout branches)

v1.2 - Advanced features

  • Code editing with syntax checking
  • Diff viewer
  • Multi-repo workspace

Development

Running Tests

# Install dev dependencies
pip install pytest pytest-asyncio

# Run tests
pytest tests/ -v

Building Desktop App

# Install PyInstaller
pip install pyinstaller

# Build executable
pyinstaller desktop.py --onefile --windowed

# Output in dist/

Contributing

Pull requests are welcome. For major changes, open an issue first.

Areas that need help:

  • Private repo authentication
  • Alternative AI providers (Ollama, Claude)
  • Search implementation
  • Mobile UI improvements

Tech Stack

  • Backend: FastAPI, Uvicorn
  • AI: Google Gemini 2.5 Flash
  • Frontend: Vanilla JS (no frameworks)
  • Styling: CSS variables (Gruvbox theme)
  • Desktop: pywebview
  • Syntax: highlight.js
  • Icons: Inline SVG

License

MIT License - use it however you want.

See LICENSE for details.


Links


Built in Kyiv. Made for developers who read more code than they write.

About

Gitra is a self-hosted web app to explore, analyze, and "chat" with any public GitHub repository. It bundles codebases into LLM-optimized context for instant AI analysis using Google Gemini.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published