AI-powered documentation generator for any public GitHub repository, backed by Jac + FastAPI + Gemini 2.5 Flash + Streamlit.
Codebase Genius automatically generates high-level, Markdown documentation for any public GitHub repository. It blends Jac (for workflow orchestration), FastAPI (for backend logic), Gemini 2.5 Flash (for AI-powered summarization), and Streamlit (for the web UI).
The result is an interactive app that can:
Generate structured documentation (overview, structure, key files, etc.)
Store and view the docs locally
Provide a chat interface for quick Q&A about the generated documentation
codebase_genius/ │ ├── BE/ # Backend (Jac + FastAPI) │ ├── main.jac # Entry module for Jac API server │ ├── walker_codebase_genius.jac # Jac walker stub (registered endpoint) │ ├── supervisor.jac # Basic node definition │ ├── api.py # FastAPI backend (Gemini 2.5 Flash logic) │ ├── outputs/ # Generated Markdown docs │ └── .env # Environment variables │ ├── FE/ # Frontend (Streamlit) │ ├── app.py # Main Streamlit app │ └── components/ │ ├── chat.py # Simple chat interface │ └── docs_viewer.py # Markdown viewer │ └── README.md # Project documentation (this file)
git clone https://github.com/yourusername/codebase_genius.git cd codebase_genius
python -m venv .venv source .venv/bin/activate # Linux / macOS
.venv\Scripts\activate # Windows
pip install -r requirements.txt
If you don’t have a requirements.txt yet, use:
pip install jaclang byllm fastapi uvicorn[standard] streamlit python-dotenv requests
Create a file named .env inside the BE/ directory:
GEMINI_API_KEY=your_real_gemini_api_key_here JAC_SERVER_URL=http://localhost:8000 FASTAPI_PORT=8080 JAC_VERBOSE=false
Obtain one from Google AI Studio .
You’ll run three terminals (or processes):
cd BE jac serve main.jac --port 8000
Expected output:
Jac API Server running on http://0.0.0.0:8000 Available endpoints: POST /walker/codebase_genius
cd BE python api.py
Expected output:
INFO: Uvicorn running on http://0.0.0.0:8080
cd FE streamlit run app.py
Then open http://localhost:8501 in your browser.
User inputs a GitHub URL in Streamlit.
Frontend sends the URL to the FastAPI /generate endpoint.
Backend constructs a detailed prompt and calls Gemini 2.5 Flash.
Gemini returns structured Markdown documentation.
The docs are saved under BE/outputs/ and displayed in Streamlit.
Users can read or download the docs, and use a lightweight chat panel for guidance.
Jac server: /health verifies that jac serve main.jac is reachable.
Gemini API key: /health reports if the key is configured (but doesn’t block the app).
Example:
curl http://localhost:8080/health
https://github.com/psf/requests
Generated Output (excerpt):
The requests library provides an elegant and Pythonic interface for making HTTP requests.
- requests/
- api.py
- models.py
- sessions.py
- utils.py
sessions.pyhandles HTTP session persistence.models.pydefines request and response objects.
Install dependencies and import requests into any Python 3.7+ project.
- Add type annotations to internal modules.
- Improve connection-pool diagnostics.
Method Endpoint Description GET /health Check backend + Jac connectivity POST /generate Generate documentation from a GitHub URL
Sample Request:
curl -X POST http://localhost:8080/generate
-H "Content-Type: application/json"
-d '{"repo_url": "https://github.com/psf/requests"}'
Issue Likely Cause Fix Backend response not OK Missing .env or GEMINI_API_KEY Run load_dotenv() verified, check .env syntax Jac server not reachable Forgot to run jac serve main.jac Start Jac before FastAPI Empty docs Invalid Gemini key or model name Check your Gemini 2.5 Flash key Streamlit UI not updating Cached state Press R or rerun app