Code Lantern 🏮

Illuminate Your Code

Inspiration 💡

As developers, we've all faced the daunting task of understanding unfamiliar codebases. Whether joining a new team, reviewing a pull request, or exploring open-source projects, the initial learning curve can be steep. Traditional documentation often becomes outdated, and manually tracing function calls through dozens of files is time-consuming and error-prone.

Code Lantern was born from this frustration. We envisioned a tool that could instantly analyze any codebase and provide:

  • Visual architecture maps showing how functions connect
  • AI-powered insights about code quality and structure
  • Interactive exploration of dependencies and relationships

The name "Lantern" embodies our mission: to shine light into the darkest corners of complex codebases, making the invisible visible.

What It Does ✨

Code Lantern is an automated code analysis platform that transforms raw code into actionable insights:

  1. Upload & Analyze: Simply upload a .zip file of your repository
  2. AI Summary: Receive instant feedback on:
    • Architecture strengths and weaknesses
    • Technology stack assessment
    • Actionable recommendations for improvement
  3. Interactive Graph: Explore a visual network where:
    • Functions are nodes (color-coded by file)
    • Function calls are edges (showing dependencies)
    • Click any node to trace its execution path with DFS highlighting
  4. Deep Dive: Browse files and functions with AI-generated descriptions of:
    • Input/output parameters
    • Purpose and behavior
    • Dependencies and call relationships

Key Metrics Dashboard 📊

Code Lantern calculates honest, actionable metrics:

  • Health Score: Strict evaluation (0-100) based on complexity and organization
  • Complexity Analysis: Average and maximum function complexity
  • Language Distribution: Technology stack breakdown
  • Project Size Classification: From "Small" to "Enterprise"

How We Built It 🛠️

Tech Stack

Frontend (React + Vite)

  • React Router for navigation between Overview, Architecture, and Deep Dive tabs
  • Cytoscape.js for interactive graph visualization with compound nodes
  • Tailwind CSS for modern, gradient-heavy UI design
  • Custom hooks for state management and API integration

Backend (FastAPI + Python)

  • FastAPI for high-performance async API endpoints
  • Google Gemini 2.0 Flash for AI-powered code analysis
  • AST parsing using regex for Python/JavaScript/TypeScript function extraction
  • File system management for uploaded repositories

Architecture Highlights

1. Smart Function Extraction

We built custom parsers that handle multiple languages:

# Python function detection
function_pattern = r'^def\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*\('

# JavaScript/TypeScript detection (arrow functions, declarations, etc.)
patterns = [
    r'function\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*\(',
    r'const\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*\(',
    r'([a-zA-Z_][a-zA-Z0-9_]*)\s*\([^)]*\)\s*=>'
]
Share this project:

Updates