Table of Contents
Relations & Dependencies
Relations are the core concept that makes CodeDB more than a simple editor. They let you define typed connections between files, creating a knowledge graph of your codebase.
What Are Relations?
A relation connects a source file to a target file with a type. For example:
app.jsimportsutils.jsapi.pydepends_ondatabase.pyREADME.mddocumentsmain.gotest_auth.pytestsauth.py
Adding Relations
There are several ways to add a relation:
From the Relations Panel
- Open a file in the editor
- Open the bottom panel (⌘J) and click the Relations tab
- The panel shows two sections: Dependencies (outgoing) and Links & Tags (incoming)
- Use the controls to add a new relation
From the Context Menu
- Right-click a file in the sidebar
- Select Add Relation
- Choose the target file and relation type
From the Command Palette
- Press ⌘R to quickly add a relation from the current file
Relation Types
You can use any relation type string. Common types include:
imports— file imports or includes anotherdepends_on— file depends on anotherextends— file extends or inherits from anothertests— test file for a source filedocuments— documentation for a filerelated_to— general associationcalls— file calls functions from anotherconfigures— configuration file for a module
Viewing Relations
The Relations panel at the bottom of the editor shows all connections for the active file:
- Dependencies — files that the current file depends on (outgoing relations)
- Links & Tags — files that depend on or link to the current file (incoming relations)
Each relation shows the connected file name, relation type, and can be clicked to navigate to that file.
Relation Metadata
Relations can store optional metadata as key-value pairs. This is useful for adding context like version constraints, notes, or categories to a relationship.
Database Schema
Relations are stored in the relations table:
CREATE TABLE relations ( id INTEGER PRIMARY KEY, source_id INTEGER REFERENCES files(id), target_id INTEGER REFERENCES files(id), relation_type TEXT NOT NULL, metadata TEXT );
You can query relations directly in the Query Console.
