A fast, native SQL snippet library for Windows — keep the queries you actually rerun
in one searchable place instead of scattered across .sql files, chat history and your
editor's scratch buffer.
- Tiny & fast — the whole app is under 1 MB. Native x64 exe, no Electron, no bundled runtime, no third-party libraries at all. It uses what Windows already ships: .NET Framework 4.8, the WebView2 (Microsoft Edge) rendering engine, and Windows' own SQLite.
- Any dialect — a place to keep the MySQL, T-SQL and other SQL you actually rerun. The app does not care which; it stores the text you write.
- Real database — your queries are kept in a SQLite file (
database\notebook.db) rather than a blob of JSON. That is the storage, not the dialect: open it with any SQLite tool and you get a normal, normalized schema. - Organize by category and tag — one-click facets in the sidebar, with live counts.
- Search everything — title, description, SQL body, category and tags at once.
- Favorites — star the handful you run every morning.
- SQL syntax highlighting in both the reading view and the library preview.
- Light / dark theme that follows Windows, plus four accent colors. The title bar follows too.
- Import / export JSON — back the notebook up, or share a set of queries with a teammate.
- Portable — copy the folder to a USB stick; the database travels with it.
The built app lives in dist\:
dist\
├── QueryNotebook.exe ← the app
├── Microsoft.Web.WebView2.Core.dll
├── Microsoft.Web.WebView2.WinForms.dll
├── WebView2Loader.dll
├── assets\ ← UI (must stay next to the exe)
└── database\ ← created on first run
└── notebook.db
- Double-click
QueryNotebook.exe. It starts with an empty notebook — nothing is added for you, and nothing comes back once you delete it. - Press N (or click New query) to add one, / to jump to search.
You can move/copy the
distfolder anywhere (e.g.C:\Tools\QueryNotebook\) — just keep the exe, the DLLs and theassetsfolder together. Thedatabasefolder comes along with your queries inside it.
| Situation | Database path |
|---|---|
| Normal (portable) | <folder with the exe>\database\notebook.db |
Exe folder is read-only (e.g. C:\Program Files) |
%APPDATA%\QueryNotebook\database\notebook.db |
The app shows the active path under About (? button, bottom-left). Window size,
theme and accent are separate and live in %APPDATA%\QueryNotebook\settings.json.
| Keys | Action |
|---|---|
/ or Ctrl+F |
Focus the search box |
N |
New query |
Enter |
Open the highlighted query |
E |
Edit the open query |
Ctrl+S |
Save while editing |
Ctrl+C |
Copy the open query's SQL |
Ctrl+D |
Duplicate the open query |
Esc |
Close the editor / clear the search box |
↑ ↓ |
Move through the library list |
Ctrl+0 Ctrl+- Ctrl+= |
Reset / decrease / increase zoom |
No SDK, no NuGet, no internet connection required — the build uses the C# compiler that is part of Windows itself.
.\build.ps1 # → dist\QueryNotebook.exe
.\test.ps1 # run the database test suite
.\build.ps1 -Test # bothRequirements: Windows 10 1803+ / Windows 11 (x64), .NET Framework 4.8 (preinstalled on Windows 10 1903+), and the WebView2 Runtime (preinstalled on Windows 11; on Windows 10 the app will link you to the free download if it is missing).
src/ WinForms host (C# 5 only — see CLAUDE.md)
├── Program.cs entry point
├── MainForm.cs WebView2 host + JSON message bridge
├── AppSettings.cs window/theme preferences
└── Database/ storage layer — the only place that speaks SQL
├── SqliteInterop.cs P/Invoke into Windows' winsqlite3.dll
├── SqliteConnection.cs connection + transactions
├── SqliteStatement.cs prepared statements, bind & read
├── SqliteException.cs
├── SavedQuery.cs the record type
└── QueryRepository.cs schema, migrations, CRUD, search, import/export
assets/ the entire UI (index.html + app.css + app.js)
tools/
├── IconGen.cs draws app.ico at build time
└── DbTests.cs automated test suite for the storage layer
docs/reference_ui/ the design mockup this UI was built from
.claude/docs/ architecture & development notes
System.Data.SQLite would mean shipping a managed assembly plus a native interop DLL and
pulling a NuGet package into a build that deliberately has no package manager. Windows
10 1803 and later ship winsqlite3.dll in System32 — the same SQLite library the OS
itself uses. src/Database/SqliteInterop.cs binds the dozen C functions the app needs, and
the wrapper classes above it give a small, typed, disposable API. Net cost: ~200 lines and
zero bytes of shipped dependency.
The schema is deliberately boring so that external tools can read it:
queries(id, title, description, sql_text, category, starred, created_at, updated_at)
tags(id, name)
query_tags(query_id, tag_id) -- many-to-many, ON DELETE CASCADEExport writes a JSON array with one object per query
(title, description, sql, category, tags[], starred), which is also the format
Import accepts — so a hand-written file or another tool's output works as long as each
object has an sql field.
MIT — see LICENSE.
