Skip to content

KD2303/CBCT-Code-Base-Cartographic-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—ΊοΈ CBCT - CodeBase Cartographic Tool

Node.js React License Tests

Transform your codebase from a text forest into a navigable landscape.

Quick Start β€’ Features β€’ Documentation β€’ Deployment β€’ Contributing


πŸ“– Overview

CBCT (CodeBase Cartographic Tool) is a system that helps developers understand and explore large codebases by mapping them the way a cartographer maps terrain.

Instead of treating a codebase as a flat collection of files or a simple dependency graph, CBCT constructs a context-aware, layered map of the codebase. This map captures not just what is connected, but how and why those connections matter within the system.

What CBCT Enables

  • 🎯 Identify central and critical components - Find the core modules that your system depends on
  • πŸ”„ Understand impact paths before making changes - See what will be affected by modifications
  • 🧭 Navigate unfamiliar codebases with confidence - Explore new projects without getting lost
  • πŸ—ΊοΈ Visualize relationships at multiple levels - From high-level architecture to file-level details

By turning complex codebases into navigable maps, CBCT transforms code exploration from guesswork into guided understanding, helping teams maintain, extend, and reason about software systems more effectively.

🎯 Core Philosophy

Principle Description
Thinking-First Design Cognitive clarity over automation
Observational Describes what exists, never prescribes
Silent by Default No alerts, popups, or interruptions
Exploration-Driven Understanding is discovered
Adaptive Same UX regardless of repo size

πŸš€ Quick Start

Prerequisites

  • Node.js 18 or higher
  • npm 9+ or yarn 1.22+
  • Git (for GitHub repository analysis)

Installation

# Clone the repository
git clone https://github.com/KD2303/CBCT-Code-Base-Cartographic-Tool.git
cd CBCT-Code-Base-Cartographic-Tool

# Install all dependencies
npm install

# Start development servers (frontend + backend)
npm run dev

Access the Application

Service URL
Frontend http://localhost:3000
Backend API http://localhost:5000
Health Check http://localhost:5000/api/health

πŸ—ΊοΈ Features

πŸ” Semantic Layer Engine

CBCT features an adaptive visualization system that automatically adjusts to your repository's size:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Small Repos (<80 files)     β†’ File-based units                 β”‚
β”‚  Medium Repos (80-500 files) β†’ Folder-based units               β”‚
β”‚  Large Repos (500+ files)    β†’ Semantic cluster units           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

4 Progressive Layers:

Layer Name Purpose
1 Orientation High-level overview
2 Structural Connections and relationships
3 Impact & Risk Dependency chains, risk indicators
4 Detail Full file-level analysis

⚑ Developer Workflow Features

  • πŸ”— IDE Sync - Click to jump directly to source in VS Code
  • πŸ›€οΈ Pathfinding - Ctrl + Click to trace shortest dependency chain
  • πŸ”₯ Git Churn Hotspots - Visual heat auras for volatile files
  • 🚧 Architectural Guardrails - Define and visualize forbidden boundaries

🌐 GitHub Integration

Analyze any public GitHub repository by pasting the URL:

https://github.com/facebook/react
https://github.com/vuejs/vue/tree/main/src

πŸ“ Project Structure

cbct/
β”œβ”€β”€ πŸ“ client/                          # React frontend (Vite + TailwindCSS)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/                 # UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ GraphCanvas.jsx         # Main visualization
β”‚   β”‚   β”‚   β”œβ”€β”€ Sidebar.jsx             # Navigation panel
β”‚   β”‚   β”‚   └── ErrorBoundary.jsx
β”‚   β”‚   β”œβ”€β”€ services/                   # API client
β”‚   β”‚   β”œβ”€β”€ store/                      # Zustand state management
β”‚   β”‚   β”œβ”€β”€ public/                     # Public API exports
β”‚   β”‚   └── __tests__/                  # Unit tests (Vitest)
β”‚   └── package.json
β”‚
β”œβ”€β”€ πŸ“ server/                          # Node.js backend (Express)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ routes/                     # API endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ analysis.js             # Dependency analysis
β”‚   β”‚   β”‚   β”œβ”€β”€ repository.js           # Repo scanning & cloning
β”‚   β”‚   β”‚   └── graph.js                # Graph operations
β”‚   β”‚   β”œβ”€β”€ services/                   # Business logic
β”‚   β”‚   β”‚   β”œβ”€β”€ analysisService.js
β”‚   β”‚   β”‚   β”œβ”€β”€ repositoryService.js
β”‚   β”‚   β”‚   β”œβ”€β”€ semanticLayerEngine.js
β”‚   β”‚   β”‚   β”œβ”€β”€ cacheService.js         # Redis cache layer
β”‚   β”‚   β”‚   └── globalDependencyGraph.js
β”‚   β”‚   β”œβ”€β”€ utils/                      # Utilities
β”‚   β”‚   β”‚   └── redisClient.js          # Redis connection
β”‚   β”‚   └── __tests__/                  # Unit tests (Jest)
β”‚   └── package.json
β”‚
β”œβ”€β”€ πŸ“ docker/                          # Docker configuration
β”‚   β”œβ”€β”€ Dockerfile                      # Production container
β”‚   β”œβ”€β”€ Dockerfile.dev                  # Development container
β”‚   β”œβ”€β”€ docker-compose.yml              # Container orchestration
β”‚   └── README.md                       # Docker usage guide
β”‚
β”œβ”€β”€ πŸ“ Guides/                          # Documentation hub
β”‚   └── Navigations/                    # All documentation guides
β”‚       β”œβ”€β”€ INDEX.md                    # Documentation index
β”‚       β”œβ”€β”€ QUICK_START.md              # Getting started
β”‚       β”œβ”€β”€ ARCHITECTURE.md             # System architecture
β”‚       β”œβ”€β”€ TECHNICAL_ARCHITECTURE.md   # Technical deep dive
β”‚       β”œβ”€β”€ SEMANTIC_LAYER_GUIDE.md     # Semantic layer details
β”‚       β”œβ”€β”€ DEVELOPMENT.md              # Development setup
β”‚       β”œβ”€β”€ INTEGRATION_CONTRACT.md     # Public API contract
β”‚       β”œβ”€β”€ INTEGRATION_PATTERNS.md     # Integration examples
β”‚       β”œβ”€β”€ FORWARD_COMPATIBILITY_ASSESSMENT.md
β”‚       β”œβ”€β”€ REDIS_INTEGRATION.md        # Redis caching guide
β”‚       β”œβ”€β”€ DEPLOYMENT_GUIDE.md         # Deploy to Upstash+Render+Vercel
β”‚       β”œβ”€β”€ DEPLOYMENT_CHECKLIST.md     # Deployment verification
β”‚       β”œβ”€β”€ DEPLOYMENT_QUICK_REFERENCE.md
β”‚       └── DEPLOYMENT_FILES_SUMMARY.md
β”‚
β”œβ”€β”€ πŸ“„ README.md                        # This file
β”œβ”€β”€ πŸ“„ package.json                     # Workspace root
β”œβ”€β”€ πŸ“„ .env.example                     # Environment template
└── πŸ“„ verify-deployment.js             # Deployment verification script

πŸ§ͺ Testing

Run All Tests

# Run all tests
npm test

# Run with coverage
npm run test:coverage

Run Tests Separately

# Server tests only (Jest)
npm run test:server

# Client tests only (Vitest)
npm run test:client

# Watch mode
cd server && npm run test:watch
cd client && npm run test:watch

Test Coverage

Tests cover:

  • βœ… Service layer (analysis, repository, semantic engine)
  • βœ… API routes (dependencies, complexity, centrality)
  • βœ… React components and hooks
  • βœ… State management (Zustand store)
  • βœ… Edge cases and error handling

🐳 Deployment

Option 1: Docker (Recommended)

# Run production container
docker-compose -f docker/docker-compose.yml up

# Run development container with hot reload
docker-compose -f docker/docker-compose.yml --profile dev up

πŸ“– See docker/README.md for detailed Docker instructions.

Option 2: Manual Deployment

# Build the client
npm run build:client

# Start production server
NODE_ENV=production npm start

Option 3: Cloud Deployment (Upstash + Render + Vercel)

Deploy with Redis caching on production platforms:

# Run verification script
node verify-deployment.js

πŸ“– See Guides/Navigations/DEPLOYMENT_GUIDE.md for complete setup instructions.

Environment Variables

Copy .env.example to .env and configure:

# Server
NODE_ENV=production
PORT=5000

# Analysis
MAX_FILE_SIZE_KB=500
LARGE_REPO_THRESHOLD=1000

# Timeouts
SERVER_TIMEOUT=300000
CLONE_TIMEOUT_MS=600000

πŸ“‘ API Reference

Repository Endpoints

Method Endpoint Description
POST /api/repository/scan Scan local path or GitHub URL
GET /api/repository/tree Get file tree structure

Analysis Endpoints

Method Endpoint Description
POST /api/analysis/dependencies Analyze file dependencies
POST /api/analysis/complexity Analyze code complexity
POST /api/analysis/centrality Calculate module centrality
POST /api/analysis/expand Expand a unit (Layer 2+)
POST /api/analysis/churn Get git modification heat
GET /api/analysis/insights/:nodeId Get node-specific insights

Graph Endpoints

Method Endpoint Description
POST /api/graph/build Build global dependency graph
POST /api/graph/get Retrieve cached graph
GET /api/graph/analysis/cycles Find circular dependencies
GET /api/graph/analysis/most-used Get most imported modules

πŸ› οΈ Development

Available Scripts

Command Description
npm run dev Start both servers with hot reload
npm run dev:client Start frontend only (port 5173)
npm run dev:server Start backend only (port 5000)
npm run build Build for production
npm test Run all tests
npm run test:coverage Generate coverage report

πŸ“– See Guides/Navigations/DEVELOPMENT.md for full development setup.

Tech Stack

Frontend:

  • React 18 + Vite
  • TailwindCSS + Framer Motion
  • React Force Graph 2D / Sigma.js
  • Zustand (state management)
  • Vitest + Testing Library

Backend:

  • Node.js + Express
  • simple-git (Git operations)
  • glob (file scanning)
  • Jest + Supertest

πŸ“š Documentation

All documentation is organized in Guides/Navigations/ folder. Start with the INDEX.md for complete navigation.

Key Guides

Document Description
QUICK_START.md Get up and running quickly
ARCHITECTURE.md System architecture overview
TECHNICAL_ARCHITECTURE.md Deep technical dive
SEMANTIC_LAYER_GUIDE.md Semantic layer details
DEVELOPMENT.md Development environment setup
INTEGRATION_CONTRACT.md Public API contract
DEPLOYMENT_GUIDE.md Deploy to Upstash + Render + Vercel
REDIS_INTEGRATION.md Redis caching setup

πŸ‘‰ View all guides β†’


🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Write tests for your changes
  4. Ensure all tests pass (npm test)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments


Made with ❀️ for developers who think in graphs

Releases

No releases published

Packages

 
 
 

Contributors