# Project export: CodeInsight - Google Maps for Software Systems

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: OpenAI Build Week
- Tagline: It is a dark-first code intelligence platform that maps software systems, analyses repositories, visualises code graphs, answers repo questions, predicts bug impact, reviews code, and creates docs.
- Devpost: https://devpost.com/software/codeinsight-google-maps-for-software-systems
- GitHub: https://github.com/hemv-857/Codeinsight
- Demo: https://codeinsight-iota.vercel.app/
- Video: https://www.youtube.com/embed/nFeFmnWsQbw?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Team: 1 GitHub contributor(s) — Hemang Varshney (59 commits)

## Devpost submission (written by the team)

### Inspiration

Every engineer has experienced the dread of joining a new codebase. You clone a repository, open your editor, and stare at hundreds of files with no idea where to begin. The documentation is outdated, the architecture is implicit, and the only way to understand the system is to read every file one by one. We asked ourselves: what if you could navigate a codebase the way you navigate a city — with a map? Traditional AI coding assistants like Copilot understand your current file. They answer "what does this function do?" but not "how does authentication work across the entire application?" That gap — between local context and system understanding — is where most engineering time disappears. CodeInsight was born from this frustration. We wanted to build a tool that lets you zoom out and see the architecture, zoom in and see the symbols, and ask questions that span the entire codebase.

### What it does

CodeInsight is a full-stack codebase intelligence platform that imports any repository, parses source code across 8 languages, builds architectural knowledge graphs, and provides AI-powered analysis — all grounded in real repository evidence. Core capabilities: Repository Import — GitHub URLs, local paths, and ZIP uploads Multi-language Parsing — Python, JavaScript, TypeScript, C, C++, Java, Go, and Rust via Tree-sitter with regex fallback Graph Engine — Dependency graph, call graph, and knowledge graph with Neo4j, NetworkX, and SQLite persistence Hybrid Retrieval — Semantic search + keyword matching + graph traversal for grounded answers Repository Q&A — Ask questions about your codebase and get evidence-cited answers with streaming responses Technical Debt Detection — Cyclomatic complexity, god objects, dead code, circular dependencies, architecture violations Bug Impact Prediction — Paste a stack trace, get affected modules, root cause analysis, and confidence scores Documentation Generation — README, architecture docs, Mermaid diagrams, and developer onboarding guides Code Review — PR review, architecture review, and security review engines Dark-first Dashboard — 23+ interactive panels with React Flow graph visualization

### How we built it

CodeInsight is a monorepo with six modules: The processing pipeline: Key architectural decisions: Triple persistence — Neo4j (optional) → NetworkX (in-memory) → SQLite (primary). The app works with zero configuration. Hybrid retrieval — Combines semantic embeddings, keyword matching, and graph traversal for grounded answers instead of hallucinated responses. Tree-sitter + regex fallback — Native grammars when available, portable regex patterns when not. OpenAI + Ollama — Works with or without an API key. Local demos use Ollama for embeddings. Quality gate: make verify runs formatting, linting, mypy strict, 90%+ coverage-gated tests, Next.js production build, and Docker Compose validation.

### Challenges we ran into

1. Python 3.14 Segfaults Python 3.14.6 segfaults in worker threads while scanning repositories on macOS. This was a showstopper for live demos. Fixed by pinning Docker images to Python 3.13 and defaulting to the safe regex parser for demos. 2. Vector Store Crash Inserting all embeddings in a single transaction caused SQLite to run out of memory on large repositories. Solved with batched inserts — chunking the embedding vector table into manageable batches. 3. Non-Atomic Graph Operations Replacing an entire graph in one transaction caused data corruption on concurrent access. Implemented batched inserts with WAL (Write-Ahead Logging) mode for concurrent reads during writes. 4. CORS Hardcoded to Localhost CORS was hardcoded to localhost:3000 during early development, breaking Docker deployments. Made CORS origins configurable via environment variables. 5. Parser Accuracy The safe regex parser initially missed multi-import statements, included comments in symbol extraction, and counted function declarations as calls. Required careful iteration on scope tracking, declaration separation, and import chain detection. 6. Graph Visualization at Scale Rendering hundreds of nodes in React Flow required lazy loading, virtualized rendering, and interactive zoom/pan controls to maintain 60 FPS performance.

### Accomplishments we're proud of

177 tests with 90%+ coverage gate — Every PR must pass make verify before merge Zero-config local demo — Works without Neo4j, without an OpenAI key, just Python and Node.js Real answers grounded in code — Every Q&A response cites specific files, functions, and lines 8 languages parsed — Python, JavaScript, TypeScript, C, C++, Java, Go, Rust with one unified API 25+ backend services — From repository import to bug impact prediction to documentation generation 23+ frontend panels — Dark-themed dashboard with interactive graph visualization Production-ready architecture — Docker Compose, health checks, structured logging, CORS, error recovery Streaming Q&A — Users see answers as they generate, not after a long wait

### What we learned

Graph structure is non-negotiable. Source code is not just text — it is a graph. Every import creates an edge. Every function call creates a relationship. Traditional grep-based search and file-tree navigation fundamentally cannot answer questions about system behavior. Hybrid retrieval beats pure vector search. Pure embedding search produces hallucinated answers. Pure keyword search misses semantic connections. Grounded answers require combining semantic, keyword, and graph signals. $$ \text{score}(q, d) = \alpha \cdot \text{semantic}(q, d) + \beta \cdot \text{keyword}(q, d) + \gamma \cdot \text{graph}(q, d) $$ Graceful degradation is a core principle. Neo4j → NetworkX → SQLite. Tree-sitter → regex. OpenAI → Ollama. Every dependency has a fallback so the app always works. Documentation is a feature, not an afterthought. Generating README, architecture docs, and onboarding guides from real repository evidence produces better documentation than manual writing.

### What's next

Incremental indexing — Re-index only changed files instead of full repository scans Live repository monitoring — Watch for changes and update graphs in real-time CI/CD integration — GitHub Actions bot that comments on PRs with impact analysis Team collaboration — Shared repositories with conversation history Plugin marketplace — Community-contributed language parsers and analysis engines Cloud hosting — Managed version with persistent storage and team features Architecture decision records — Auto-generate ADRs from code changes Cross-repository analysis — Understand dependencies across multiple repositories in a monorepo or organization Built for the OpenAI Hackathon · Developer Tools Track Codex Session: 019f69f5-05dd-7bc2-9303-f1ba8c7486cf

## README (from the GitHub repository)

# CodeInsight

> **OpenAI Hackathon Submission — Developer Tools Track**

CodeInsight is "Google Maps for Software Systems": a dark-first codebase
intelligence app that imports repositories, parses source code, builds graph
views, answers repository questions, predicts bug impact, reviews changes, and
generates documentation from real repository evidence.

**Live Demo:** [codeinsight-iota.vercel.app](https://codeinsight-iota.vercel.app/)

## Built with Codex

**Codex Session ID:** `019f69f5-05dd-7bc2-9303-f1ba8c7486cf`

Codex with GPT-5.6 was the primary development accelerator for CodeInsight. Here's how it was used:

### Architecture & Scaffolding

- Codex designed the full monorepo structure (`frontend/`, `backend/`, `parser/`, `graph/`, `shared/`, `workers/`) and generated the initial scaffolding for all modules
- Generated the FastAPI application factory, dependency injection container, and Pydantic schema layer from a high-level feature spec
- Created the Docker Compose orchestration with 5 services, health checks, and persistent volumes

### Core Intelligence Pipeline

- **Parser** (`parser/tree_sitter_parser.py`): Codex implemented the Tree-sitter multi-language parser with safe regex fallback for 8 languages (Python, JS, TS, C, C++, Java, Go, Rust)
- **Graph Engine** (`graph/`): Generated the knowledge graph, dependency graph, and call graph builders with Neo4j primary, NetworkX in-memory, and SQLite persistence layers
- **Embedding & Retrieval** (`backend/app/services/embedding.py`, `retrieval.py`, `vector_store.py`): Built the hybrid retrieval system combining semantic search, keyword matching, and graph traversal

### 25+ Backend Services

Codex generated the implementation for every service module:

- `repository_import.py` — GitHub, local path, and ZIP upload ingestion
- `repository_qa.py` — grounded Q&A with streaming responses and conversation memory
- `technical_debt.py`, `bug_impact.py`, `risk_scoring.py` — codebase analysis engines
- `security_review.py`, `pull_request_review.py`, `architecture_explanation.py`
- `readme_generator.py`, `architecture_docs.py`, `mermaid_diagrams.py`, `developer_onboarding.py`

### Frontend (23+ Panels)

- Codex built the dark-themed dashboard with React Flow graph visualization, TanStack Query data fetching, and Framer Motion animations
- Generated all interactive panels: repository explorer, dependency graph, knowledge graph, bug impact, technical debt, security review, architecture docs, README generator, and more
- Implemented the streaming Q&A interface and conversation history UI

### Quality & DevOps

- Codex set up the `make verify` release gate: formatting, linting, mypy strict, 90%+ coverage-gated tests, Next.js production build, Docker Compose validation
- Generated 45+ pytest test files covering parser, graph, service, and API layers
- Created the CI scripts, coverage enforcement, and Dockerfiles

### Key Decisions Made with Codex

1. **Neo4j + NetworkX + SQLite triple persistence**: Codex evaluated tradeoffs and implemented graceful fallback (Neo4j → NetworkX → SQLite) for zero-config local demos
2. **Hybrid retrieval over pure vector search**: Codex recommended combining semantic embeddings with keyword matching and graph traversal for grounded answers
3. **Tree-sitter + regex fallback**: Codex designed the parser to use native Tree-sitter when available but fall back to regex patterns for portability
4. **OpenAI + Ollama embedding support**: Codex implemented provider abstraction so the app works with or without an OpenAI API key

## What Works

- Repository import from local paths, GitHub URLs, and zip uploads
- Recursive repository scanning with language, file, directory, and extension metadata
- Tree-sitter parsing for Python, JavaScript, TypeScript, C, C++, Java, Go, and Rust
- Symbol extraction for functions, classes, methods, variables, imports, exports, inheritance, and interfaces
- Dependency graph, call graph, knowledge graph, Neo4j integration, NetworkX fallback, and SQLite graph persistence
- Repository chunking, OpenAI or Ollama embeddings, SQLite vector storage, and hybrid retrieval
- Repository summaries, architecture explanations, grounded Q&A, streaming responses, and conversation memory
- Repository explorer, search, dependency graph UI, knowledge graph UI, and interactive graph controls
- Technical debt, complexity, circular dependency, dead code, architecture violation, bug impact, risk scoring, PR review, architecture review, and security review
- README, architecture docs, Mermaid diagrams, and developer onboarding generation
- Structured API errors, accessibility affordances, production logging, Docker Compose, and coverage-gated verification

## Stack

- Frontend: Next.js, React, TypeScript, Tailwind CSS, TanStack Query, React Flow, Framer Motion
- Backend: FastAPI, Pydantic, SQLite, Tree-sitter, NetworkX, Neo4j driver, OpenAI-compatible embeddings
- Worker: Python health service scaffold for background processing
- Infrastructure: Docker Compose with frontend, backend, worker, Neo4j, Redis, and durable volumes

## Quick Start

Install dependencies:

```bash
npm install
python3.13 -m venv .venv313
.venv313/bin/pip install -r requirements-dev.txt
```

Run the backend:

```bash
.venv313/bin/uvicorn backend.app.main:app --host 127.0.0.1 --port 8002
```

Run the dashboard:

```bash
npm run dev --workspace @codeinsight/frontend
```

For local demos, point the frontend at the backend:

```bash
NEXT_PUBLIC_API_BASE_URL=http://127.0.0.1:8002 npm run dev --workspace @codeinsight/frontend -- --port 3002
```

Open the dashboard at `http://localhost:3002`.

Run the full release verifier:

```bash
make verify
```

## Docker

Validate the stack:

```bash
docker-compose config
```

Build runtime images:

```bash
make docker-build
```

Start the stack:

```bash
docker-compose up --build
```

## Embeddings

OpenAI embeddings require `CODEINSIGHT_OPENAI_API_KEY`.

For local demos without an OpenAI key:

```bash
export CODEINSIGHT_EMBEDDING_PROVIDER=ollama
export CODEINSIGHT_OLLAMA_EMBEDDING_MODEL=nomic-embed-text
```

Then run Ollama locally before vector indexing.

## Demo

**Live App:** [codeinsight-iota.vercel.app](https://codeinsight-iota.vercel.app/)

Use the official flow in [DEMO.md](DEMO.md). The recommended real demo
repository is FastAPI because it is large enough to exercise parsing, graphs,
search, documentation, Q&A, debt, and bug analysis without being too large for
a short recording.

Release assets:

- [Architecture diagrams](docs/architecture-diagrams.md)
- [Demo repository setup](docs/demo-repository.md)
- [Production release checklist](docs/production-release.md)
- [Dashboard screenshot](docs/screenshots/dashboard.png)

## Documentation

| Document                                   | Description                                         |
| ------------------------------------------ | --------------------------------------------------- |
| [ARCHITECTURE.md](ARCHITECTURE.md)         | System architecture, modules, and design principles |
| [PRODUCT_SPEC.md](PRODUCT_SPEC.md)         | Product specification and requirements              |
| [CODING_STANDARDS.md](CODING_STANDARDS.md) | Code style, testing, and quality standards          |
| [CONTRIBUTING.md](CONTRIBUTING.md)         | How to contribute to the project                    |
| [SECURITY.md](SECURITY.md)                 | Security policy and vulnerability reporting         |
| [CHANGELOG.md](CHANGELOG.md)               | Version history and changes                         |
| [DEMO.md](DEMO.md)                         | Demo script and recording guide                     |
| [TASKS.md](TASKS.md)                       | Development roadmap and milestones                  |
| [LICENSE](LICENSE)                         | MIT License                                         |

## Verification Status

The release gate is `make verify`, which runs formatting checks, linting, type
checking, coverage-gated Python t

[README truncated for size]

## Detected evidence (automated analysis)

Indexed codebase: 207 recognized source files, 1048 KB.
- CSS (language) — detected in the code
- FastAPI (technology) — detected in the code
- Next.js (technology) — detected in the code
- OpenAI (technology) — detected in the code
- Python (language) — detected in the code
- React (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TypeScript (language) — detected in the code
- Docker (technology) — claimed on Devpost, not found in the code
- Vercel (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (120 of 231)

```
.dockerignore
.editorconfig
.env.example
.gitignore
.prettierignore
.prettierrc.json
.vercelignore
ABOUT.md
ARCHITECTURE.md
backend/__init__.py
backend/app/__init__.py
backend/app/api/__init__.py
backend/app/api/routes/__init__.py
backend/app/api/routes/health.py
backend/app/api/routes/repositories.py
backend/app/core/__init__.py
backend/app/core/config.py
backend/app/core/dependencies.py
backend/app/core/errors.py
backend/app/core/logging.py
backend/app/database/__init__.py
backend/app/database/connection.py
backend/app/main.py
backend/app/repositories/__init__.py
backend/app/repositories/conversation_memory.py
backend/app/repositories/metadata.py
backend/app/repositories/vector_store.py
backend/app/schemas/__init__.py
backend/app/schemas/architecture_docs.py
backend/app/schemas/architecture_explanation.py
backend/app/schemas/architecture_review.py
backend/app/schemas/architecture_violations.py
backend/app/schemas/bug_impact.py
backend/app/schemas/call_graph.py
backend/app/schemas/circular_dependencies.py
backend/app/schemas/conversation_memory.py
backend/app/schemas/dead_code.py
backend/app/schemas/dependency_graph.py
backend/app/schemas/developer_onboarding.py
backend/app/schemas/embedding.py
backend/app/schemas/health.py
backend/app/schemas/knowledge_graph.py
backend/app/schemas/mermaid_diagrams.py
backend/app/schemas/metadata.py
backend/app/schemas/open_source_contributor.py
backend/app/schemas/parse.py
backend/app/schemas/pull_request_review.py
backend/app/schemas/readme_generator.py
backend/app/schemas/repository_chunk.py
backend/app/schemas/repository_import.py
backend/app/schemas/repository_qa.py
backend/app/schemas/repository_scan.py
backend/app/schemas/repository_summary.py
backend/app/schemas/retrieval.py
backend/app/schemas/risk_scoring.py
backend/app/schemas/security_review.py
backend/app/schemas/stack_trace.py
backend/app/schemas/system_understanding.py
backend/app/schemas/technical_debt.py
backend/app/schemas/vector_store.py
backend/app/services/__init__.py
backend/app/services/architecture_docs.py
backend/app/services/architecture_explanation.py
backend/app/services/architecture_review.py
backend/app/services/architecture_violations.py
backend/app/services/bug_impact.py
backend/app/services/circular_dependencies.py
backend/app/services/conversation_memory.py
backend/app/services/dead_code.py
backend/app/services/developer_onboarding.py
backend/app/services/embedding.py
backend/app/services/llm_provider.py
backend/app/services/mermaid_diagrams.py
backend/app/services/metadata.py
backend/app/services/open_source_contributor.py
backend/app/services/pull_request_review.py
backend/app/services/readme_generator.py
backend/app/services/repository_chunker.py
backend/app/services/repository_import.py
backend/app/services/repository_qa.py
backend/app/services/repository_scanner.py
backend/app/services/repository_summary.py
backend/app/services/retrieval.py
backend/app/services/risk_scoring.py
backend/app/services/security_review.py
backend/app/services/stack_trace.py
backend/app/services/system_understanding.py
backend/app/services/technical_debt.py
backend/app/services/vector_store.py
backend/README.md
CHANGELOG.md
CODING_STANDARDS.md
CONTRIBUTING.md
DEMO.md
docker-compose.yml
docker/backend.Dockerfile
docker/frontend.Dockerfile
docker/README.md
docker/worker.Dockerfile
docs/architecture-diagrams.md
docs/demo-repository.md
docs/production-release.md
docs/README.md
eslint.config.mjs
frontend/app/globals.css
frontend/app/layout.tsx
frontend/app/page.tsx
frontend/components.json
frontend/components/architecture-docs-panel.tsx
frontend/components/architecture-review-panel.tsx
frontend/components/architecture-violations-panel.tsx
frontend/components/bug-impact-panel.tsx
frontend/components/circular-dependencies-panel.tsx
frontend/components/codeinsight-logo.tsx
frontend/components/conversation-history.tsx
frontend/components/dashboard.tsx
frontend/components/dead-code-panel.tsx
frontend/components/dependency-graph-panel.tsx
frontend/components/developer-onboarding-panel.tsx
frontend/components/empty-state.tsx
[111 more files omitted for size]
```

### Dependencies

- frontend/package.json: @tanstack/react-query@^5.83.0, @types/node@^24.0.14, @types/react@^19.1.8, @types/react-dom@^19.1.6, @xyflow/react@^12.8.2, autoprefixer@^10.4.21, class-variance-authority@^0.7.1, clsx@^2.1.1, framer-motion@^12.23.6, lucide-react@^0.525.0, mermaid@^11.16.0, next@^16.3.0-canary.87, postcss@^8.5.10, react@^19.1.0, react-dom@^19.1.0, tailwind-merge@^3.3.1, tailwindcss@^3.4.17
- package.json: @eslint/js@^9.31.0, eslint@^9.31.0, prettier@^3.6.2, typescript@^5.8.3, typescript-eslint@^8.37.0
- requirements.txt: fastapi@==0.116.1, neo4j@==6.2.0, networkx@==3.5, openai@==2.45.0, pydantic-settings@==2.10.1, python-multipart@==0.0.20, SQLAlchemy@==2.0.41, tree-sitter@==0.26.0, tree-sitter-c@==0.24.1, tree-sitter-cpp@==0.23.4, tree-sitter-go@==0.23.4, tree-sitter-java@==0.23.5, tree-sitter-javascript@==0.25.0, tree-sitter-python@==0.25.0, tree-sitter-rust@==0.24.0, tree-sitter-typescript@==0.23.2, uvicorn@==0.35.0

### Recent commits (newest first)

- Add demo link and project story (ABOUT.md)
- OPEN AI BUILD WEEK SUBMISSION
- OPEN AI BUILD WEEK SUBMISSION
- Install git in backend image
- Fix production deployment config
- Polish CodeInsight release
- Stabilize parser endpoints for local demos
- Document stable Python runtime for demos
- Fix local dashboard scan fetches
- Package production release artifacts
- Polish dashboard readiness UI
- Add API error handling envelope
- Improve dashboard accessibility
- Cache parsed source summaries
- Add testing coverage gate
- Add security review engine
- Add architecture review engine
- Add pull request review engine
- Add developer onboarding docs
- Add Mermaid diagram generator

## Key source files (fetched from GitHub, selected and truncated for size)

### CONTRIBUTING.md

```markdown
# Contributing to CodeInsight

Thank you for your interest in contributing to CodeInsight! This document provides guidelines for contributing.

## Development Setup

### Prerequisites

- Python 3.13+ (avoid 3.14 — known segfault)
- Node.js 22+
- Docker and Docker Compose (optional, for containerized development)

### Local Setup

```bash
# Clone the repository
git clone https://github.com/hemang/codeinsight.git
cd codeinsight

# Create Python virtual environment
python3.13 -m venv .venv313
source .venv313/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt

# Install frontend dependencies
cd frontend && npm install && cd ..

# Copy environment config
cp .env.example .env

# Run verification
make verify
```

### Running the App

```bash
# Terminal 1: Backend (port 8002)
.venv313/bin/uvicorn backend.app.main:app --host 0.0.0.0 --port 8002 --reload

# Terminal 2: Frontend (port 3002)
cd frontend && npm run dev -- --port 3002
```

## Code Standards

- **Python**: Follow `CODING_STANDARDS.md`. All code must pass `ruff`, `mypy`, and `pytest`.
- **TypeScript**: Follow existing patterns. All code must pass `tsc --noEmit` and `next build`.
- **No TODOs**: Never leave TODO comments in code.
- **No eval/exec**: Never use `eval()` or `exec()` in production code.
- **Type safety**: Use strict typing in both Python and TypeScript.

## Testing

```bash
# Run all tests
make test

# Run Python tests only
.venv313/bin/pytest tests/ -x -q

# Run type checks
make typecheck
```

- All new features must include tests
- Target 90%+ code coverage
- Tests run in CI on every push

## Pull Request Process

1. **Fork** the repository and create a feature branch
2. **Make your changes** following the code standards
3. **Add tests** for new functionality
4. **Run verification**: `make verify`
5. **Write a clear PR description** explaining:
   - What changed and why
   - How to test the changes
   - Any breaking changes
6. **Submit the PR** and wait for review

### PR Title Format

```
type(scope): description

Examples:
feat(parser): add Rust language support
fix(graph): resolve circular dependency detection
docs(readme): update setup instructions
```

## Reporting Issues

- Use GitHub Issues for bug reports and feature requests
- Include reproduction steps for bugs
- Specify your environment (OS, Python version, Node version)

## Architecture Decisions

Major architectural changes should be discussed in a GitHub Issue before implementation. Reference existing decisions in `ARCHITECTURE.md`.

## License

By contributing, you agree that your contributions will be licensed under the MIT License.

```

### CHANGELOG.md

```markdown
# Changelog

All notable changes to CodeInsight will be documented in this file.

Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [0.1.0] - 2026-07-16

### Added

#### Core Platform

- Repository import from GitHub, local paths, and ZIP uploads
- Recursive file scanning with language detection (8 languages)
- Tree-sitter parser with regex-based safe fallback
- SQLite primary storage with optional Neo4j graph persistence

#### Graph Engine

- Dependency graph construction from imports
- Call graph construction from function calls
- Knowledge graph with unified architecture model
- NetworkX in-memory fallback when Neo4j unavailable
- SQLite graph persistence with WAL mode

#### Analysis Services

- Technical debt detection with severity scoring
- Dead code detection (unused files and functions)
- Circular dependency detection
- Architecture violation detection
- Bug impact prediction from stack traces
- Security review with pattern-based scanning
- Stack trace parser (Python, JavaScript, Java, Go)

#### Documentation Generation

- README generator from repository facts
- Architecture documentation generator
- Mermaid diagram generation (architecture, dependency, call flow)
- Developer onboarding guide generator

#### AI Features

- Repository Q&A with evidence-grounded answers
- Hybrid retrieval (semantic + keyword + graph search)
- System understanding report generation
- Open source contribution analysis (bug detection, code smells, security issues)

#### Frontend

- 23+ panel components with dark theme
- 6-tab dashboard (Explorer, Analysis, Graphs, Docs, Review, AI Tools)
- React Flow graph visualization
- Mermaid diagram rendering with SVG export
- Error boundary with retry UI
- Clipboard copy feedback

#### DevOps

- Docker Compose stack (backend, frontend, Neo4j, worker)
- Python 3.13 Docker images (fixed 3.14 segfault)
- SQLite WAL mode for concurrent access
- CORS configuration via environment variables

#### Quality

- 177 pytest tests with 90%+ coverage gate
- mypy strict type checking
- ruff linting
- Next.js production build verification

### Fixed

- Vector store unbounded INSERT crash (batched inserts)
- CORS hardcoded to localhost (configurable origins)
- Non-atomic SQLite graph replace (batched inserts)
- Dependency graph refresh button (hardcoded path)
- Knowledge graph refresh button (hardcoded path)
- Embedding error message for non-OpenAI providers
- Safe parser multi-import dropping, comment filtering, scope tracking
- Function declarations counted as calls in parser
- Docker Python 3.14 → 3.13 (segfault fix)
- Docker missing graph/ and parser/ modules

### Removed

- Redis from Docker Compose (unused)
- Architecture preview component (dead code)

```

### requirements.txt

```
fastapi==0.116.1
neo4j==6.2.0
networkx==3.5
openai==2.45.0
pydantic-settings==2.10.1
python-multipart==0.0.20
SQLAlchemy==2.0.41
tree-sitter==0.26.0
tree-sitter-c==0.24.1
tree-sitter-cpp==0.23.4
tree-sitter-go==0.23.4
tree-sitter-java==0.23.5
tree-sitter-javascript==0.25.0
tree-sitter-python==0.25.0
tree-sitter-rust==0.24.0
tree-sitter-typescript==0.23.2
uvicorn==0.35.0

```

### pyproject.toml

```
[project]
name = "codeinsight"
version = "0.1.0"
description = "Google Maps for Software Systems."
requires-python = ">=3.12"

[tool.black]
line-length = 100
target-version = ["py312"]

[tool.ruff]
line-length = 100
target-version = "py312"
src = ["backend", "workers", "graph", "parser", "shared", "tests"]

[tool.ruff.lint]
select = [
  "B",
  "C4",
  "E",
  "F",
  "I",
  "N",
  "RUF",
  "UP",
  "W"
]

[tool.ruff.format]
quote-style = "double"

[tool.mypy]
python_version = "3.12"
strict = true
warn_unreachable = true
warn_unused_ignores = true
exclude = ["\\.venv", "venv"]

[tool.pytest.ini_options]
testpaths = ["tests"]

```

### package.json

```
{
  "name": "codeinsight",
  "version": "0.1.0",
  "private": true,
  "description": "Google Maps for Software Systems.",
  "type": "module",
  "workspaces": [
    "frontend"
  ],
  "scripts": {
    "build": "npm run build --workspace @codeinsight/frontend",
    "format": "prettier --write .",
    "format:check": "prettier --check .",
    "lint": "eslint .",
    "typecheck": "tsc --noEmit --project tsconfig.base.json && npm run typecheck --workspace @codeinsight/frontend"
  },
  "devDependencies": {
    "@eslint/js": "^9.31.0",
    "eslint": "^9.31.0",
    "prettier": "^3.6.2",
    "typescript": "^5.8.3",
    "typescript-eslint": "^8.37.0"
  },
  "overrides": {
    "postcss": "^8.5.10"
  },
  "engines": {
    "node": ">=22.0.0",
    "npm": ">=10.0.0"
  }
}

```

### docker-compose.yml

```yaml
name: codeinsight

services:
  backend:
    build:
      context: .
      dockerfile: docker/backend.Dockerfile
    environment:
      CODEINSIGHT_ENVIRONMENT: production
      CODEINSIGHT_CONVERSATION_DATABASE_PATH: /app/data/conversations/codeinsight-conversations.sqlite3
      CODEINSIGHT_GRAPH_DATABASE_PATH: /app/data/graphs/codeinsight-graph.sqlite3
      CODEINSIGHT_LOG_LEVEL: INFO
      CODEINSIGHT_NEO4J_DATABASE: neo4j
      CODEINSIGHT_NEO4J_PASSWORD: codeinsight-dev
      CODEINSIGHT_NEO4J_URI: bolt://neo4j:7687
      CODEINSIGHT_NEO4J_USERNAME: neo4j
      CODEINSIGHT_OPENAI_API_KEY: ${OPENAI_API_KEY:-}
      CODEINSIGHT_VECTOR_DATABASE_PATH: /app/data/vectors/codeinsight-vectors.sqlite3
    ports:
      - '8000:8000'
    volumes:
      - conversation-data:/app/data/conversations
      - graph-data:/app/data/graphs
      - repository-data:/app/data/repositories
      - vector-data:/app/data/vectors
    healthcheck:
      test:
        [
          'CMD',
          'python',
          '-c',
          "from urllib.request import urlopen; urlopen('http://127.0.0.1:8000/api/health', timeout=2).read()",
        ]
      interval: 10s
      timeout: 5s
      retries: 6

  frontend:
    build:
      context: .
      dockerfile: docker/frontend.Dockerfile
      args:
        NEXT_PUBLIC_API_BASE_URL: http://localhost:8000
    environment:
      NEXT_TELEMETRY_DISABLED: '1'
    ports:
      - '3000:3000'
    depends_on:
      backend:
        condition: service_healthy
    healthcheck:
      test:
        [
          'CMD',
          'node',
          '-e',
          "fetch('http://127.0.0.1:3000').then((r)=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))",
        ]
      interval: 10s
      timeout: 5s
      retries: 6

  neo4j:
    image: neo4j:5-community
    environment:
      NEO4J_AUTH: neo4j/codeinsight-dev
    ports:
      - '7474:7474'
      - '7687:7687'
    volumes:
      - neo4j-data:/data
    healthcheck:
      test: ['CMD-SHELL', 'cypher-shell -u neo4j -p codeinsight-dev "RETURN 1" >/dev/null']
      interval: 10s
      timeout: 5s
      retries: 6

  worker:
    build:
      context: .
      dockerfile: docker/worker.Dockerfile
    environment:
      CODEINSIGHT_ENVIRONMENT: production
      CODEINSIGHT_LOG_LEVEL: INFO
      CODEINSIGHT_WORKER_PORT: '8001'
    ports:
      - '8001:8001'
    volumes:
      - repository-data:/app/data/repositories
    depends_on:
      neo4j:
        condition: service_healthy
    healthcheck:
      test:
        [
          'CMD',
          'python',
          '-c',
          "from urllib.request import urlopen; urlopen('http://127.0.0.1:8001/health', timeout=2).read()",
        ]
      interval: 10s
      timeout: 5s
      retries: 6

volumes:
  neo4j-data:
  conversation-data:
  repository-data:
  graph-data:
  vector-data:

```

### frontend/package.json

```
{
  "name": "@codeinsight/frontend",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "build": "next build --webpack",
    "dev": "next dev",
    "lint": "eslint .",
    "start": "next start",
    "typecheck": "tsc --noEmit"
  },
  "dependencies": {
    "@tanstack/react-query": "^5.83.0",
    "@xyflow/react": "^12.8.2",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "framer-motion": "^12.23.6",
    "lucide-react": "^0.525.0",
    "mermaid": "^11.16.0",
    "next": "^16.3.0-canary.87",
    "react": "^19.1.0",
    "react-dom": "^19.1.0",
    "tailwind-merge": "^3.3.1"
  },
  "devDependencies": {
    "@types/node": "^24.0.14",
    "@types/react": "^19.1.8",
    "@types/react-dom": "^19.1.6",
    "autoprefixer": "^10.4.21",
    "postcss": "^8.5.10",
    "tailwindcss": "^3.4.17"
  }
}

```

### workers/main.py

```python
import json
import logging
import os
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from typing import Final

HOST: Final = "0.0.0.0"
DEFAULT_PORT: Final = 8001

logger = logging.getLogger(__name__)


def get_health_payload() -> bytes:
    """Return the worker health response body."""
    return json.dumps({"status": "ok", "service": "CodeInsight Worker"}).encode()


class WorkerHealthHandler(BaseHTTPRequestHandler):
    """HTTP handler exposing worker liveness for Docker health checks."""

    server_version = "CodeInsightWorker/0.1.0"

    def do_GET(self) -> None:
        if self.path != "/health":
            self.send_error(404, "Not Found")
            return

        payload = get_health_payload()
        self.send_response(200)
        self.send_header("Content-Type", "application/json")
        self.send_header("Content-Length", str(len(payload)))
        self.end_headers()
        self.wfile.write(payload)

    def log_message(self, format: str, *args: object) -> None:
        logger.info(format, *args)


def get_port() -> int:
    """Return the configured worker health port."""
    raw_port = os.getenv("CODEINSIGHT_WORKER_PORT", str(DEFAULT_PORT))
    return int(raw_port)


def run() -> None:
    """Start the worker health server."""
    logging.basicConfig(
        format="%(asctime)s %(levelname)s [%(name)s] %(message)s",
        level=os.getenv("CODEINSIGHT_LOG_LEVEL", "INFO"),
    )
    port = get_port()
    logger.info("CodeInsight worker started", extra={"port": port})

    with ThreadingHTTPServer((HOST, port), WorkerHealthHandler) as server:
        server.serve_forever()


if __name__ == "__main__":
    run()

```

### shared/src/index.ts

```typescript
export {};

```

### frontend/app/page.tsx

```typescript
import { Dashboard } from '@/components/dashboard';

export default function Home() {
  return <Dashboard />;
}

```

[190 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]