💻SQLite Database Runs as a Web Server
Your next web app could be just one SQL file away
TL;DR
A new SELF format allows programs to run directly from a SQLite database, storing state and content within the same file. This innovative approach collapses binary tooling into SQL, enabling transactional updates and self-referential queries.
SELF is an intriguing new format that lets you store a program as a SQLite database, where everything—the code, website routes, visitor logs—lives in one file. The interpreter maps rows to execute the entry point, making it possible for running programs to update their own state transactionally. This means your web app can edit its content while running and persist changes without external storage. If you're building a simple web service or experimenting with new deployment methods, SELF could be a game-changer.
Key Points
SELF relies on binfmt_misc to trigger the custom interpreter, mapping rows in segments table (2023)
self-httpd is a proof-of-concept web server running as one file with routes, website content, and logs
The SQLite connection releases before jumping to entry point; writes persist across invocations (transactional updates)
SELF has three tables: routes, visits, presses. sqldiff audits changes between versions of the same program
FTS5 can index pages inside SELF for full-text search capabilities
Why It Matters
If you're building a small web service or experimenting with minimalistic deployments, SELF could streamline your workflow by eliminating external storage needs and simplifying state management. However, it's not suitable for complex applications requiring robust transactional integrity beyond basic SQL.
Frequently Asked Questions
Why does this matter?
If you're building a small web service or experimenting with minimalistic deployments, SELF could streamline your workflow by eliminating external storage needs and simplifying state management. However, it's not suitable for complex applications requiring robust transactional integrity beyond basic SQL.
What happened?
A new SELF format allows programs to run directly from a SQLite database, storing state and content within the same file. This innovative approach collapses binary tooling into SQL, enabling transactional updates and self-referential queries.
Comments
Be the first to comment
Enjoyed this article?
Get it daily. 7am. Free. Reads in 5 minutes.
Join 3,315 builders reading daily.