A developer has introduced SELF, a format that transforms executable programs into SQLite databases, enabling a new class of binary tooling built entirely on SQL queries.

The core concept treats a program as a SQLite database. Using Linux’s binfmt_misc mechanism, a custom interpreter maps rows in a segments table and jumps to the entry point, collapsing traditional binary tooling into SQL operations.
According to the source, the most significant innovation is that programs can store their own state within the same database file they execute from. This eliminates the need for separate directories like /var/, /tmp/, or /home/. The program can update its state transactionally—meaning changes can be committed or rolled back—all within the single executable file.
To demonstrate the concept, the developer created self-httpd, a proof-of-concept webserver that exists entirely as a single SQLite database file. The file contains the program code, website content, routes, and visitor logs. When visitors access the server or press buttons on the page, those interactions are recorded as new rows in the database, persisting across program restarts.
The webserver uses three tables: routes (containing paths, MIME types, and content), visits (recording visitor information), and presses (logging button interactions). Remarkably, the program accesses its own executable file through argv[0], opening it as a SQLite database to read and write data.
Another key capability is live editing. Because the file format is SQLite, the running webserver can modify its own content using standard SQL UPDATE statements, with changes committed transactionally to the same file. No restart or redeployment is required. The developer demonstrated updating the site’s HTML in place while the server continued running.
Since the executable is inherently a SQLite database, it gains access to the entire SQLite tooling ecosystem for free. The sqldiff utility can audit changes between versions, FTS5 enables full-text search within the program itself, and other SQLite features become available without additional machinery.
The author credits Justine Tunney’s redbean webserver—a single-file executable built as a portable binary with a self-extracting ZIP archive—as prior inspiration. SELF achieves similar goals but relies on simpler tools, collapsing functionality into SQL. The developer terms this an “Actually Queryable Executable,” contrasting it with Actually Portable Executables that run anywhere but cannot be queried.
Key facts
- SELF format stores executables as SQLite databases, enabling programs to query and modify themselves while running
- A proof-of-concept webserver (self-httpd) demonstrates the concept as a single file containing program code, website content, routes, and visitor logs
- Programs access their own executable file through argv[0] and can perform transactional reads and writes on their own database
- The webserver can be edited live using SQL UPDATE statements without requiring restart or redeployment
- The SQLite database format grants executables access to existing SQLite tools like sqldiff for auditing and FTS5 for full-text search
