Levin
Browse, query, and manage Datalevin databases in VS Code

Levin (archaic English for "lightning") is a VS Code extension that provides a visual interface for Datalevin databases. It communicates directly with the dtlv CLI, requiring no REPL or Clojure setup.
Features
Database Explorer
- Open local databases via folder picker
- Connect to remote Datalevin servers with
dtlv:// URIs
- Browse schema attributes with type information
- View entity counts by namespace
- Navigate database structure in the sidebar
- Auto-load recently opened databases
Query Editor
- Dedicated
.dtlv.edn file support for Datalevin queries
- Syntax highlighting for Datalog queries
- Autocomplete for schema attributes and query keywords
- CodeLens for running queries directly from the editor
- Query history and saved queries
Results Panel
- Table view with sorting and pagination
- Tree view for nested/referenced data
- Raw EDN view
- Export to CSV, JSON, or EDN
- Click entity IDs to inspect
Entity Inspector
- View all attributes of an entity
- Navigate entity references
- Copy entity data as EDN
Schema Editor
- Add new schema attributes
- View existing schema with properties
Transaction Panel
- Stage and preview transactions
- Execute transact operations
- Validation before commit
Installation
1. Install the Levin Extension
From VS Code Marketplace (Recommended):
- Open VS Code
- Go to Extensions (
Cmd+Shift+X / Ctrl+Shift+X)
- Search for "Levin"
- Click Install
Or from command line:
code --install-extension KwabenaBosompem.levin
2. Install Datalevin CLI
Levin requires the dtlv command-line tool to be installed and available in your PATH.
macOS
Using Homebrew (recommended):
brew install datalevin
Or download the binary:
# Download the latest release
curl -L https://github.com/juji-io/datalevin/releases/latest/download/dtlv-0.9.27-macos-amd64.zip -o dtlv.zip
# For Apple Silicon (M1/M2/M3):
curl -L https://github.com/juji-io/datalevin/releases/latest/download/dtlv-0.9.27-macos-aarch64.zip -o dtlv.zip
# Extract and install
unzip dtlv.zip
sudo mv dtlv /usr/local/bin/
chmod +x /usr/local/bin/dtlv
Linux
# Download the latest release (x64)
curl -L https://github.com/juji-io/datalevin/releases/latest/download/dtlv-0.9.27-linux-amd64.zip -o dtlv.zip
# For ARM64:
curl -L https://github.com/juji-io/datalevin/releases/latest/download/dtlv-0.9.27-linux-aarch64.zip -o dtlv.zip
# Extract and install
unzip dtlv.zip
sudo mv dtlv /usr/local/bin/
chmod +x /usr/local/bin/dtlv
Windows
- Download the latest release from Datalevin releases
- Choose
dtlv-X.X.X-windows-amd64.zip
- Extract
dtlv.exe to a folder (e.g., C:\Program Files\Datalevin\)
- Add that folder to your PATH:
- Open System Properties → Environment Variables
- Edit the
Path variable and add C:\Program Files\Datalevin\
- Restart VS Code
Verify Installation
dtlv --version
# Should output: Datalevin (version: X.X.X)
If dtlv is not in your PATH, you can specify its location in VS Code settings:
{
"levin.dtlvPath": "/path/to/dtlv"
}
Quick Start
- Open the Levin sidebar (lightning bolt icon in the Activity Bar)
- Click "Open Database..." or use
Cmd+Alt+L O (Mac) / Ctrl+Alt+L O (Windows/Linux)
- Choose "Datalog Database" or "Key-Value Store"
- Select a local folder or enter a remote server URI
- Start exploring!
Opening a Local Database
- Click "Open Database" and select "Local Database"
- Select a Datalevin database folder
- The database will appear in the sidebar
Connecting to a Remote Server
- Click "Open Database" and select "Remote Server"
- Enter the server URI in the format:
dtlv://username:password@host:port/database
- Example:
dtlv://datalevin:datalevin@192.168.1.113:8898/ontology
- Without auth:
dtlv://192.168.1.113:8898/test-db
- The remote database will appear in the sidebar with a remote icon
Creating a New Database
- Click "Create Database" in the sidebar or use
Cmd+Alt+L C
- Enter the database name
- Select the parent folder
- The new database is created and opened automatically
Commands
| Command |
Keybinding |
Description |
Levin: Open Database |
Cmd+Alt+L O |
Open an existing database |
Levin: Create Database |
Cmd+Alt+L C |
Create a new database |
Levin: Close Database |
Cmd+Alt+L D |
Close a database |
Levin: New Query |
Cmd+Alt+L Q |
Open new query editor |
Levin: Run Query |
Ctrl+Enter |
Execute query under cursor |
Levin: Inspect Entity |
Cmd+Alt+L E |
Inspect entity by ID |
Levin: Refresh Explorer |
Cmd+Alt+L R |
Refresh database tree |
Levin: Export Results |
Cmd+Alt+L X |
Export current results |
Create .dtlv.edn files for your queries:
;; Local database
{:db "/path/to/database"
:query [:find ?e ?name ?email
:where
[?e :user/name ?name]
[?e :user/email ?email]]
:args []
:limit 50}
;; Remote server
{:db "dtlv://username:password@host:port/database"
:query [:find ?e ?name ?email
:where
[?e :user/name ?name]
[?e :user/email ?email]]
:args []
:limit 50}
Configuration
{
"levin.dtlvPath": "dtlv",
"levin.queryHistorySize": 100,
"levin.resultPageSize": 50,
"levin.recentDatabases": []
}
| Setting |
Default |
Description |
levin.dtlvPath |
"dtlv" |
Path to dtlv executable |
levin.queryHistorySize |
100 |
Number of queries to keep in history |
levin.resultPageSize |
50 |
Results per page in table view |
levin.recentDatabases |
[] |
Auto-populated list of recent databases |
For formatting query files, install the cljfmt extension:
- Install the
cljfmt extension by pedrorgirardi
- Add to your
settings.json:
{
"files.associations": {
"*.dtlv.edn": "clojure"
},
"[clojure]": {
"editor.defaultFormatter": "pedrorgirardi.cljfmt",
"editor.formatOnSave": true
}
}
Note: This changes .dtlv.edn files to Clojure mode, which removes the CodeLens "Run Query" button. You can still run queries with Ctrl+Enter or the Command Palette.
Development
# Clone and install
git clone https://github.com/kbosompem/levin
cd levin
npm install
# Compile
npm run compile
# Watch mode
npm run watch
# Run extension in debug mode
# Press F5 in VS Code
# Package
npm run package
Architecture
Levin uses a simple CLI-based architecture:
- Direct CLI communication - All database operations execute through the
dtlv command-line tool
- No REPL required - No need for Clojure, Calva, or jack-in workflows
- Local & Remote support - Works with local databases and remote Datalevin servers
- Stateless - Each operation is independent
License
MIT License - see LICENSE for details.
Links
Made with lightning by Kay Bosompem