CodeGraph is an AI-powered developer tool that helps developers understand, explore, modify, validate, and ship codebases.
Instead of treating a repository as a collection of files, CodeGraph builds an understanding of the codebase using:
- Semantic search
- Vector embeddings
- RAG
- AST-based code analysis
- Code relationships
- Architecture visualization
- AI-powered feature planning
- AI-generated code changes
- Diff-based review
- Automated validation
- GitHub integration
The goal is simple:
Understand the codebase before changing it, review changes before applying them, and never silently destroy existing work.
CodeGraph provides an end-to-end workflow for working with unfamiliar or complex repositories.
Repository
↓
Repository Analysis
↓
Semantic Search + Code Graph
↓
Architecture Understanding
↓
AI Feature Planning
↓
AI Code Generation
↓
Diff Review
↓
Validation
↓
Human Approval
↓
GitHub Feature Branch
↓
Commit & Push
↓
Pull Request
This allows developers to move from understanding a repository to safely implementing a feature without losing control of the changes.
CodeGraph can ingest repositories from:
- Uploaded repository files
- GitHub repository URLs
- Connected GitHub accounts
During ingestion, the repository is analyzed and its contents are stored for further processing.
CodeGraph converts repository content into semantic chunks and generates vector embeddings.
This enables meaning-based search instead of relying only on exact keyword matching.
For example, instead of searching for:
authentication
CodeGraph can retrieve code related to:
- Login
- Sessions
- OAuth
- JWT handling
- User authentication middleware
even when the exact search term does not appear in the source code.
CodeGraph provides an AI chat interface that uses repository context to answer questions about the codebase.
The system uses Retrieval-Augmented Generation (RAG) to retrieve relevant code before generating a response.
Responses can include citations pointing back to relevant repository files.
Example questions:
How does authentication work in this project?
Where is the database connection initialized?
Which files are responsible for user registration?
How does the application handle API errors?
What would I need to change to add email verification?
CodeGraph uses AST analysis to understand the structure of the source code.
The system extracts symbols such as:
- Classes
- Functions
- Interfaces
- Methods
- Variables
- Imports
It also builds relationships between symbols.
Supported relationship types include:
IMPORTS
EXTENDS
IMPLEMENTS
USES
INJECTS
CALLS
This creates a graph representation of how different parts of the repository interact.
The extracted code relationships are used to generate an interactive architecture view.
Instead of manually searching through hundreds of files, developers can visually explore relationships between different parts of the codebase.
The architecture graph can help answer questions such as:
Which components depend on this class?
Where is this service used?
Which files import this module?
What extends this base class?
What parts of the system are connected to this component?
CodeGraph includes a repository file explorer for navigating analyzed repositories.
Developers can:
- Browse repository files
- Navigate directories
- Open source files
- Inspect file contents
- Move between architecture nodes and their corresponding files
This connects the abstract architecture graph back to the actual source code.
CodeGraph supports authentication through Supabase Auth.
Supported authentication methods include:
- Email / Password
- Google OAuth
- GitHub OAuth
GitHub authentication also enables authenticated GitHub operations after the user connects their account.
Sensitive GitHub provider tokens remain server-side and are not exposed to the frontend.
CodeGraph can turn a natural-language feature request into an implementation plan.
For example:
Add email verification to the registration flow.
The AI analyzes the repository and produces a structured feature plan identifying the files and areas that need to change.
The planning stage is designed to happen before code generation.
After approving a feature plan, CodeGraph can generate the required code changes.
Instead of immediately modifying the repository, the generated changes are represented as a versioned changeset.
This provides a controlled workflow:
Feature Request
↓
AI Analysis
↓
Feature Plan
↓
Human Approval
↓
Code Generation
↓
Versioned Changeset
Generated changes are stored as immutable/versioned changesets.
This makes it possible to:
- Review generated changes
- Compare different versions
- Approve changes
- Reject changes
- Regenerate changes
- Track the state of proposed modifications
The original repository is not immediately overwritten.
CodeGraph provides a Git-style diff viewer for generated changes.
Developers can inspect:
- Added files
- Modified files
- Deleted files
- Added lines
- Removed lines
- Original content
- Proposed content
The diff can be viewed in a unified or side-by-side format.
The workflow is intentionally:
Generate
↓
Review Diff
↓
Validate
↓
Approve
rather than blindly applying AI-generated code.
Before changes are shipped, CodeGraph can validate the proposed changes inside a temporary workspace.
Validation can detect and use repository tooling where applicable.
For example:
TypeScript
Build
Tests
Validation is repository-aware.
If a particular validation method is not applicable, it is skipped instead of being incorrectly reported as a failure.
For example, a repository without a tsconfig.json should not be treated as a TypeScript validation failure.
Validation states distinguish between:
PASSED
FAILED
SKIPPED
ERROR
This prevents missing tooling from being confused with broken code.
CodeGraph integrates with GitHub to provide a controlled path from generated code to an actual repository change.
The GitHub workflow is designed around feature branches rather than directly modifying the default branch.
Approved Changeset
↓
GitHub Feature Branch
↓
Commit
↓
Push
↓
Pull Request
CodeGraph never directly modifies the repository's default branch during the feature workflow.
Feature branches are created using a deterministic naming pattern:
codegraph/feature-plan-{planId}-v{version}
The system dynamically detects the repository's default branch before creating the feature branch.
One of the most important safety mechanisms in CodeGraph is repository drift detection.
Suppose CodeGraph generated a change based on:
Version A
but the repository has since changed to:
Version B
Applying the old changes blindly could overwrite newer developer work.
CodeGraph therefore checks whether the repository still matches the state against which the changeset was generated.
If the repository has drifted:
STOP
rather than silently overwriting newer code.
This is particularly important for AI-generated code changes.
Approved changes can be committed to the generated GitHub feature branch.
The workflow is designed to:
- Avoid modifying the default branch
- Create one logical commit per changeset
- Prevent duplicate commits
- Protect against branch SHA conflicts
- Re-check repository state
- Persist GitHub commit metadata
After changes are committed and pushed, CodeGraph can create a GitHub Pull Request.
The Pull Request workflow includes:
- Correct feature branch
- Correct base branch
- Deterministic title
- Generated description
- Validation summary
- Changeset information
CodeGraph does not automatically merge the Pull Request.
The final merge decision remains with the developer.
┌───────────────────────────────────────────────┐
│ Next.js App │
│ │
│ Repository UI │
│ File Explorer │
│ Architecture Graph │
│ AI Chat │
│ Feature Planning │
│ Diff Viewer │
│ Validation │
│ GitHub Workflow │
└───────────────────────┬───────────────────────┘
│
▼
┌───────────────────────────────────────────────┐
│ Next.js API Routes │
│ │
│ Repository APIs │
│ RAG APIs │
│ Architecture APIs │
│ Changeset APIs │
│ Validation APIs │
│ GitHub APIs │
└───────────────────────┬───────────────────────┘
│
┌───────────┴───────────┐
▼ ▼
┌──────────────────────┐ ┌──────────────────────┐
│ Supabase │ │ GitHub │
│ │ │ │
│ PostgreSQL │ │ Repository │
│ pgvector │ │ Branches │
│ Authentication │ │ Commits │
│ Repository Data │ │ Pull Requests │
│ Code Graph │ │ Git Data API │
└──────────────────────┘ └──────────────────────┘
- Next.js
- React
- TypeScript
- Tailwind CSS
- Next.js API Routes
- TypeScript
- Node.js
- Supabase
- PostgreSQL
- pgvector
- Supabase Auth
- Google OAuth
- GitHub OAuth
- Large Language Models
- Embeddings
- Vector similarity search
- Retrieval-Augmented Generation
- TypeScript AST
ts-morph- Symbol extraction
- Relationship analysis
- GitHub REST API
- Git Data API
- Branch creation
- Commits
- Pull Requests
- TypeScript type checking
- Automated test suite
- Repository-aware validation
CodeGraph/
│
├── src/
│ ├── app/
│ │ ├── api/
│ │ │ ├── repositories/
│ │ │ ├── changesets/
│ │ │ ├── github/
│ │ │ ├── architecture/
│ │ │ └── ...
│ │ │
│ │ ├── login/
│ │ ├── signup/
│ │ └── ...
│ │
│ ├── components/
│ │ ├── repository/
│ │ ├── architecture/
│ │ ├── chat/
│ │ ├── changesets/
│ │ ├── github/
│ │ └── ...
│ │
│ ├── lib/
│ │ ├── ai/
│ │ ├── github/
│ │ ├── rag/
│ │ ├── repository/
│ │ ├── validation/
│ │ └── ...
│ │
│ └── ...
│
├── supabase/
│ └── migrations/
│
├── tests/
│
├── public/
│
├── package.json
├── tsconfig.json
└── README.md
CodeGraph stores information about repositories, files, semantic chunks, code symbols, relationships, plans, changesets, and GitHub operations.
The main concepts include:
Users
│
└── Repositories
│
├── Repository Files
│ └── Semantic Chunks
│
├── Code Symbols
│ └── Code Relationships
│
├── Feature Plans
│ └── Changesets
│ ├── Validation
│ └── GitHub Branch
│ ├── Commit
│ └── Pull Request
│
└── Chat / RAG Context
A developer uploads a repository or provides a GitHub repository.
Repository
↓
Ingestion
↓
File Storage
CodeGraph processes the repository and creates:
Source Files
↓
Semantic Chunks
↓
Embeddings
Source Files
↓
AST Analysis
↓
Symbols
↓
Relationships
The generated symbols and relationships are used to build an architecture graph.
Developers can navigate from graph nodes back to their source files.
The developer can use repository-aware AI chat.
Question
↓
Semantic Retrieval
↓
Relevant Repository Context
↓
AI Response
↓
File Citations
The developer describes a desired change.
"Add password reset functionality."
CodeGraph analyzes the repository and generates a feature plan.
The developer reviews the proposed implementation before code generation.
After approval, CodeGraph generates a versioned changeset.
Feature Plan
↓
AI Code Generation
↓
Changeset
The developer inspects the generated changes using the diff viewer.
CodeGraph creates a temporary workspace and validates the proposed changes using applicable repository tooling.
Changeset
↓
Temporary Workspace
↓
Apply Changes
↓
Validation
Only after the developer reviews and approves the changes can they proceed to the GitHub workflow.
CodeGraph creates a dedicated feature branch.
main
│
└── codegraph/feature-plan-...
The default branch is not directly modified.
The approved changes are committed and pushed to the feature branch.
CodeGraph creates a Pull Request targeting the repository's default branch.
The developer retains control over the final merge.
CodeGraph follows several principles when handling repositories and GitHub operations.
Generated changes are pushed to feature branches rather than directly modifying the default branch.
AI-generated code is reviewed before being shipped.
Changes are not blindly applied when the repository has changed since the changeset was generated.
GitHub provider tokens are kept server-side and are not exposed to the client.
Proposed changes are validated in temporary workspaces rather than directly modifying the original repository.
Generated changes are represented as versioned changesets, allowing developers to review different generated versions.
Make sure you have:
- Node.js
- npm
- A Supabase project
- Required AI API credentials
- GitHub OAuth configuration if GitHub features are enabled
git clone <your-repository-url>
cd CodeGraphnpm installCreate a .env.local file:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
# AI provider configuration
AI_API_KEY=your_ai_api_key
# GitHub OAuth / API configuration
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secretUse the exact environment variable names required by your current implementation.
Do not commit .env.local or any secret credentials to Git.
CodeGraph uses Supabase PostgreSQL with pgvector.
Apply the database migrations located in:
supabase/migrations/
The database contains structures for concepts such as:
Repositories
Repository Files
Semantic Chunks
Code Symbols
Code Relationships
Feature Plans
Changesets
Changeset Branches
Pull Requests
Start the development server:
npm run devThen open:
http://localhost:3000
Run the TypeScript type check:
npx tsc --noEmitRun the complete test suite:
npm testRun a specific test:
node --import tsx --test <test-file>| Feature | Status |
|---|---|
| Repository ingestion | ✅ Complete |
| GitHub repository ingestion | ✅ Complete |
| Semantic chunking | ✅ Complete |
| Embeddings / vector search | ✅ Complete |
| RAG chat | ✅ Complete |
| Repository summaries | ✅ Complete |
| AST symbol extraction | ✅ Complete |
| Code relationships | ✅ Complete |
| Architecture visualization | ✅ Complete |
| File Explorer | ✅ Complete |
| Authentication | ✅ Complete |
| Google OAuth | ✅ Complete |
| GitHub OAuth | ✅ Complete |
| AI feature planning | ✅ Complete |
| AI code generation | ✅ Complete |
| Versioned changesets | ✅ Complete |
| Diff viewer | ✅ Complete |
| Code validation | ✅ Complete |
| GitHub branch creation | ✅ Complete |
| Repository drift protection | ✅ Complete |
| GitHub commit / push | ✅ Complete |
| Pull Request creation | ✅ Complete |
| Navigation / data-fetch optimization | 🚧 In Progress |
| AI code review | 🎯 Planned |
CodeGraph is built around three principles.
The system should understand the repository before proposing changes.
Repository
↓
AST + Semantic Analysis
↓
Code Graph
↓
Repository Context
↓
AI Planning
The AI should not treat a repository as a pile of unrelated files.
AI-generated code should not immediately modify the user's repository.
Generate
↓
Diff
↓
Validate
↓
Human Approval
↓
Apply
The developer remains in control of the final change.
Before applying changes, CodeGraph verifies that the repository still matches the state against which the changeset was generated.
If it does not:
STOP
rather than silently overwriting newer code.
Potential future improvements include:
- AI-powered code review
- More advanced repository dependency analysis
- Improved architecture detection
- Better language support
- More validation strategies
- Improved navigation performance
- Smarter client-side data caching
- Background repository analysis
- More GitHub workflow automation
- Improved large-repository support
- Advanced code impact analysis
Contributions are welcome.
A typical development workflow is:
Fork
↓
Create Feature Branch
↓
Make Changes
↓
Run Type Check
↓
Run Tests
↓
Submit Pull Request
Please keep changes focused and maintain the existing project architecture.
Gaurang Kishore
Built as an exploration of AI-assisted software engineering, repository intelligence, code analysis, RAG, and safe automated development workflows.
CodeGraph is designed to bridge the gap between AI-generated code and responsible software engineering.
It combines:
Semantic Understanding
+
AST Analysis
+
Code Graph
+
RAG
+
AI Planning
+
AI Code Generation
+
Human Review
+
Validation
+
GitHub Automation
into a single developer workflow.
The core idea is:
Understand the code. Plan the change. Generate the code. Review the diff. Validate it. Then ship it safely.