Generating JSON Directly from Postgres
<i>&gt; Too often, web tiers are full of boilerplate that does nothing except convert a result set into JSON.</i><p>Yeah.  This is the problem: we&#x27;ve abandoned the hypermedia architecture of the web for a dumb-data, RPC model.  I suppose if you are going to go that direction and things are simple enough, you can jam it in the DB and get smoking perf.<p>But as things get more complicated, where does the business logic live?  Maybe in the database as stored procedures?  It&#x27;s less crazy than it sounds.<p>An alternative is to cut out the <i>other</i> middle man: JSON, ditch heavy front-end javascript and return HTML instead, going back to the hypermedia approach.  The big problem with that is a step back in UX functionality, but there are tools[1][2][3] for addressing that.<p>[1] - <a href="https:&#x2F;&#x2F;htmx.org" rel="nofollow">https:&#x2F;&#x2F;htmx.org</a> (my library)<p>[2] - <a href="https:&#x2F;&#x2F;unpoly.com" rel="nofollow">https:&#x2F;&#x2F;unpoly.com</a><p>[3] - <a href="https:&#x2F;&#x2F;hotwired.dev" rel="nofollow">https:&#x2F;&#x2F;hotwired.dev</a>