Dbdev – A database package manager for PostgreSQL trusted language extensions
At KotlinConf today I gave a talk on designing apps with two-tier architecture, where you implement your entire app without the web stack appearing anywhere at all. Instead you publish desktop and mobile apps that connect directly to an RDBMS like PostgreSQL via its native protocol, and use server extensions for any logic that is inconvenient to do with SQL.<p>This approach might seem horrifyingly outside-the-box but has a lot of advantages, and some of the reasons we didn&#x27;t do things this way historically have been solved in recent years.<p>Because it was KotlinConf the demo uses PL&#x2F;Java, which is pretty nice because there&#x27;s such a healthy ecosystem of stuff based around JDBC and because deploying JVM stuff doesn&#x27;t require any sort of cross-compilation. PL&#x2F;Java also supports (for now) trusted extensions using sandboxing, although of course the sandbox can just get in the way and normally you trust your own server anyway so this is a double edged sword.<p>The demo code can be found here (it&#x27;s a prototype and nobody reviewed it yet so be gentle)<p><a href="https:&#x2F;&#x2F;github.com&#x2F;hydraulic-software&#x2F;bugzino">https:&#x2F;&#x2F;github.com&#x2F;hydraulic-software&#x2F;bugzino</a><p>I&#x27;ll write up a blog post version of the talk, but for now I had to mention that DBaaS providers don&#x27;t actually enable this sort of design because they like to wall off the full power of the RDBMS behind custom APIs. But in two-tier design you really lean into the database and use all of its features. So, it&#x27;d be nice if:<p>a. database.dev were to support PL&#x2F;Java extensions.<p>b. Supabase were to allow direct connections, as the native DB protocol supports a <i>lot</i> of features that otherwise have to be sort of hacked on top of HTTP. Ultimately, HTTP is designed to fetch hypertext whereas the PG native protocol is designed to work with data, and that difference shines through in a bunch of ways.