$ show TabbyML/tabby
Tabby is a self-hosted AI coding assistant that provides code completion, chat, and code search capabilities through multiple interfaces: a web dashboard (Next.js/React), IDE plugins (VS Code, IntelliJ, Eclipse, Vim), and a Language Server Protocol (LSP) agent. The backend is primarily written in Rust, using Axum for HTTP services, Tantivy for indexing, and llama.cpp for local model inference. It supports enterprise features like SSO (OAuth, LDAP), team management, access policies, and background job scheduling for repository indexing, web crawling, and third-party integration (GitHub/GitLab). The system is designed to be self-contained, running without external cloud dependencies, and can operate on consumer-grade GPUs. The architecture follows a monorepo pattern with Rust crates for core services (inference, indexing, git operations, download) and TypeScript/JavaScript for the agent and UI. The web dashboard uses GraphQL (Juniper) for API communication, while IDE plugins communicate via LSP. Data flows include: code completion requests from editors → agent → backend model server → response with postprocessing; chat queries → retrieval-augmented generation (RAG) pipeline using indexed code and documentation; and background jobs for syncing repositories, crawling web docs, and indexing commits/issues/PRs. External dependencies include SQLite (via SQLx), llama.cpp, tree-sitter, and various cloud provider APIs for OAuth. The codebase demonstrates strong engineering practices with modular design, extensive testing (unit tests, golden tests), and reusable patterns such as a background job abstraction, config merging system, and a postprocessing pipeline for code completions. However, the polyglot nature (Rust, TypeScript, Java, Kotlin) and multiple client implementations introduce maintenance complexity and potential drift. The repository is actively maintained with frequent releases and a large community (33k+ stars).
The LLM identified 4 files worth highlighting for reuse:
A modular postprocessing pipeline for code completion results, consisting of independent filters (dropDuplicated, formatIndentation, limitScope, removeRepetitiveBlocks, etc.) that can be composed and tested in isolation. Each filter is a pure function operating on completion items, making the pipeline easily extensible and reusable in other code completion systems. The directory includes comprehensive unit tests and golden test data, demonstrating a well-engineered approach to refining LLM-generated code completions.
A standalone Rust crate that validates SQLx database migrations by comparing the applied migration versions against the expected migration files. It provides a simple API to check for missing or extra migrations, ensuring consistency between the codebase and the database schema. This pattern is reusable in any SQLx-based project that needs to enforce migration integrity at startup or in CI.
A client-side token management module that handles JWT access and refresh tokens with automatic refresh, concurrent request deduplication using the Web Locks API, and storage via localStorage/sessionStorage. It emits events on token changes, allowing other parts of the application to react. This pattern is reusable in any web application requiring secure token lifecycle management with automatic refresh and race condition prevention.
A lightweight TypeScript library for cross-thread communication using signals and abort signals, supporting multiple targets (BroadcastChannel, MessagePort, WebSocket, WebWorker, iframe). It provides a clean abstraction over different transport mechanisms with a consistent API for sending and receiving messages. This is reusable in any web application that needs to coordinate between workers, iframes, or browser tabs.