← back to the wall

Code2Context

APP

LLM-Ready Codebase Converter

APR 2025

Code2Context - LLM-Ready Codebase ConverterARCHIVED
built with
Next.js 15TypeScriptMongoDBNextAuthUpstash RedisVitest

Overview

Code2Context is a small, focused dev tool that converts a local codebase into a single structured context file optimized for LLMs that lack native folder access. It handles recursive directory scanning, smart filtering (node_modules, build artifacts, lock files, binaries), and generates an output format that maximizes signal-to-noise for the AI.

Built before agentic coding CLIs made folder access trivial — still useful for one-off analyses, code review prompts, and LLMs that only accept a single text input.

Features

  • Local file processing — pick a directory, browse it as an interactive tree, select what goes in
  • Token budgeting — every file and folder shows its estimated share of the context window, with per-extension chars-per-token ratios, so you can trim before you generate
  • Comment stripping — optional pass that drops comments from JS/TS/CSS and friends to buy back tokens
  • Intelligent parsing — recursive scan with exclusion patterns for node_modules, build artifacts, lock files and binaries
  • LLM-optimized output — single file, structured tree, de-duplicated content
  • Tiered rate limiting — free/premium/beta enforced in middleware from the auth token (10 scans and 5 generations per hour on free)

Tech Stack

  • Next.js 15 App Router, React 19, TypeScript
  • NextAuth with Google sign-in, MongoDB for accounts and tiers
  • Upstash Redis rate limiting, enforced entirely in middleware
  • Vitest suite over the middleware, tree walker, formatter, comment stripper and token estimator
  • Vercel for serverless deployment

Why I Built This

The first time I wanted to ask an LLM to review an entire small codebase, I hit the wall that most of us did: the chat interface accepts text, not folders. Code2Context is the wizard (🧙‍♂️) that bridges the gap. Now superseded for me by Claude Code and Cursor, but still handy when you want a single text artifact for sharing or archiving.