Accelerate codebase understanding with AI-powered analysis, interactive visualizations, and intelligent documentation
Grasp is a powerful tool that helps developers quickly understand unfamiliar codebases through automated analysis, interactive dependency visualization, and AI-powered documentation generation.
- Fast Onboarding: Understand architecture in hours, not weeks
- Interactive Learning: Explore code relationships visually through dependency graphs
- AI Documentation: Get comprehensive, auto-generated documentation
- Audit Unfamiliar Repos: Quickly assess code quality and architecture
- Understand Dependencies: See how modules connect and interact
- Analyze Structure: Deep dive into code organization and patterns
- Living Documentation: Auto-generated docs that stay up-to-date
- Knowledge Sharing: Capture architectural decisions automatically
- Visual Analysis: Interactive graphs for better understanding
- Visual Mapping: Complete visualization of module relationships
- Interactive Exploration: Click nodes to see detailed information
- Multiple Layouts: Hierarchical and force-directed graph layouts
- Advanced Filtering: Filter by node type, search by name
- Custom Node Types: Distinct styling for files, classes, and functions
- Real-time Statistics: Node and edge counts, graph metrics
- AI Assistant: Generate code snippets and explanations
- Multi-Language Support: Python, JavaScript, and TypeScript
- AST Analysis: Deep code structure extraction
- Dependency Extraction: Automatic import and call relationship mapping
- Graph Building: Hierarchical graph structure with importance scoring
- Repository Parsing: Support for both local paths and GitHub URLs
- Watsonx.ai Integration: IBM Granite models for intelligent documentation
- Multiple Sections: Overview, Getting Started, Architecture, API docs
- Markdown Rendering: Beautiful, professional documentation viewer
- Section Regeneration: Update specific sections without regenerating all
- Context-Aware: Documentation based on actual code analysis
- Project Analysis: Analyze local and remote repositories
- Project Management: List, view, and delete analyzed projects
- Progress Tracking: Real-time analysis progress with Rich formatting
- Easy Integration: Simple commands for all operations
- Modern UI: React 18 with TypeScript and Tailwind CSS
- Responsive Design: Works seamlessly on all screen sizes
- Real-time Updates: Live data fetching and updates
- Professional Styling: Polished, production-ready interface
- Python 3.11+
- Node.js 18+
- Git
- IBM watsonx.ai account (for AI documentation features and node explanation features)
# Clone the repository
git clone https://github.com/yourusername/grasp.git
cd grasp
# Set up backend
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
pip install -e .
# Set up frontend
cd ../frontend
npm install
# Configure environment
cp .env.example .env
# Edit .env with your watsonx.ai credentialsCreate a .env file in the project root:
# Watsonx.ai Configuration
WATSONX_API_KEY=<Your-API-KEY>
WATSONX_PROJECT_ID=<Your-PROJECT-ID>
WATSONX_URL=https://us-south.ml.cloud.ibm.com
WATSONX_MODEL_ID=ibm/granite-4-h-small
WATSONX_EMBEDDING_MODEL_ID=ibm/granite-embedding-278m-multilingual
WATSONX_ANSWERING_MODEL_ID=meta-llama/llama-3-3-70b-instructVITE_API_URL=http://localhost:8000cd backend && source venv/bin/activate
python cli/main.py version # Show version
python cli/main.py list # List all projects
python cli/main.py init # Initialize DB
python cli/main.py analyze /path/to/repo --name "My Project"
python cli/main.py analyze https://github.com/user/repo
python cli/main.py delete <project_id>
python cli/main.py serve --port 8001
- Start the backend server:
cd backend
source venv/bin/activate
uvicorn app.main:app --reload- Start the frontend:
cd frontend
npm run dev- Open your browser to
http://localhost:5173
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER INTERFACES β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββ ββββββββββββββββββββββββββββ β
β β CLI Tool β β Web Dashboard β β
β β β β β β
β β β’ analyze β β ββββββββββ ββββββββββ β β
β β β’ list β β β Graph β β Docs β β β
β β β’ delete β β β Viewer β β Viewer β β β
β β β’ serve β β ββββββββββ ββββββββββ β β
β ββββββββββββββββ ββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FASTAPI BACKEND β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β API ENDPOINTS β β
β β /projects /graph /docs β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β CORE SERVICES β β
β β β β
β β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β β
β β β Repo Parser β β AST Analyzer β β Dependency β β β
β β β β β β β Analyzer β β β
β β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β β
β β β β
β β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β β
β β β Graph β β Graph β β Doc β β β
β β β Builder β β Serializer β β Generator β β β
β β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β β
β β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β Watsonx.ai Client (IBM Granite) β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SQLITE DATABASE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ Projects β’ Graph Nodes/Edges β’ Documentation β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Framework: FastAPI 0.104.1
- Database: SQLite with SQLAlchemy 2.0.23
- CLI: Typer 0.9.0 with Rich 13.7.0
- Code Analysis: Python AST, tree-sitter
- AI: IBM watsonx.ai (Granite models & Llama models)
- Testing: pytest
- Framework: React 18 with TypeScript 5.3
- Build Tool: Vite 5.0
- Graph Visualization: React Flow
- Styling: Tailwind CSS 3.3
- API Client: Axios
- Markdown: react-markdown
- β Python (.py)
- β JavaScript (.js, .jsx)
- β TypeScript (.ts, .tsx)
- Complete project structure
- Backend infrastructure (FastAPI + SQLite)
- Frontend infrastructure (React + TypeScript)
- CLI tool skeleton
- Configuration management
- Repository parser (local + GitHub)
- AST analyzers (Python, JavaScript, TypeScript)
- Dependency extraction
- Graph builder
- Database storage
- API endpoints
- CLI commands
- React Flow integration
- Interactive graph component
- Custom node types
- Multiple layout algorithms
- Search and filter functionality
- Node details panel
- Graph statistics
- Watsonx.ai client integration
- Documentation generator with prompt templates
- Documentation API endpoints
- Beautiful documentation viewer UI
- Markdown rendering
- Section-based regeneration
GET /api/projects- List all projectsGET /api/projects/{id}- Get project detailsPOST /api/projects/analyze- Analyze repositoryDELETE /api/projects/{id}- Delete project
GET /api/projects/{id}/graph- Get complete graphGET /api/projects/{id}/graph/reactflow- Get React Flow formatted graphGET /api/projects/{id}/graph/nodes- Get nodes with filteringGET /api/projects/{id}/graph/node/{node_id}- Get node detailsGET /api/projects/{id}/graph/edges- Get edges with filtering
GET /api/docs/test-connection- Test watsonx.ai connectionPOST /api/docs/projects/{id}/generate- Generate documentationGET /api/docs/projects/{id}- Get all documentationGET /api/docs/projects/{id}/sections/{section}- Get specific sectionPOST /api/docs/projects/{id}/regenerate/{section}- Regenerate sectionDELETE /api/docs/projects/{id}- Delete documentation
- Hierarchical Layout: Organized top-down view of dependencies
- Force-Directed Layout: Physics-based organic layout
- Node Types: Files (blue), Classes (green), Functions (purple)
- Edge Types: Imports, Contains, Calls relationships
- Zoom & Pan: Smooth navigation controls
- Mini-map: Overview of entire graph
- Search: Find nodes by name
- Filter: Show/hide specific node types
- Project Overview: High-level architecture and purpose
- Getting Started: Setup and usage instructions
- Architecture: System design and component relationships
- API Documentation: Endpoint descriptions and usage
- Context-Aware: Based on actual code analysis
- Regeneration: Update sections individually
- AST Parsing: Deep structural analysis
- Import Resolution: Track all dependencies
- Call Graph: Function call relationships
- Importance Scoring: Identify critical components
- Statistics: Lines of code, file counts, language distribution
- Local Execution: All analysis runs on your machine
- Secure Storage: API keys in environment variables
- No Data Upload: Code stays local (except AI API calls for docs)
- Database: Local SQLite file
- GitHub Tokens: Optional, only for private repos
Issue: ModuleNotFoundError: No module named 'app'
# Solution: Ensure you're in the backend directory and venv is activated
cd backend
source venv/bin/activate
pip install -e .Issue: watsonx.ai authentication failed
# Solution: Check your .env file has correct credentials
cat .env | grep WATSONXIssue: Graph not rendering in dashboard
# Solution: Check browser console, ensure API is running
curl http://localhost:8000/api/healthWe welcome contributions! Here's how you can help:
- Report Bugs: Open an issue with details
- Suggest Features: Share your ideas
- Submit PRs: Follow our coding standards
- Improve Docs: Help make documentation better
This project is licensed under the MIT License - see the LICENSE file for details.
- IBM watsonx.ai for Granite and Llama models
- FastAPI for the excellent web framework
- React Flow for graph visualization
- Tree-sitter for universal code parsing
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built with IBM BOB β€οΈ for developers who want to understand code faster
Current Version: 1.0.0 - Phases 0-3 Complete