Derek Sivers's database and web apps

27 pointsposted 7 days ago
by surprisetalk

9 Comments

sivers

an hour ago

Whoa. How weird to see this on the HN front page. It's so not ready yet. I'll write up more about it some day soon.

For the big idea, see https://sive.rs/pg

I really took Rich Hickey's "Simplicity Matters" talk to heart. https://www.youtube.com/watch?v=rI8tNMsozo0

I've been making PostgreSQL-centered web apps for 9 years that way, by having PostgreSQL just return JSON. Then the "controller" (Ruby or whatever) parses the Mustache or ERB template with the JSON and returns HTML to the browser.

What I'm doing differently now is having PostgreSQL parse Mustache templates directly!

So now the controller just has to pass in the HTTP params, give it to the PostgreSQL function, and it returns HTML ready to return in the HTTP response.

novoreorx

24 minutes ago

Business logics in PostgresSQL? Impressive, never think of using it this way but it looks actually pretty good! Last time I saw similar concept is at https://spacetimedb.com/ , maybe one day PostgresSQL can do the same, since it's already powerful enough to support web apps this way.

RollAHardSix

an hour ago

This is great stuff. I fell away from web dev for a very long time because I have always been a developer who focused on building from the database first and outwards while using very light amounts of business logic. This feels very old web and I encourage others to try this approach. The lightweightedness of the approach is the beauty of it and you will get much, much better at your database language of choice.

sivers

16 minutes ago

Thanks! And yeah the other inspiration is that in the last 27 years of making web apps, I've gone from PHP to Ruby to JavaScript back to Ruby, considered switching to Go or Elixir, but my PostgreSQL database was at the center of it all, throughout.

So it makes sense to notice what's constant, what's ever-changing, and organize accordingly.

derwiki

2 minutes ago

OOC how did you land on PostgreSQL 27 years ago? That’s before I was doing this sort of thing but 7 years later MySQL definitely seemed like the “no one got fired for choosing..” option.

PS been a big fan of your writing over the years and it’s a little intimidating to just respond to one of your posts asking a silly question haha

ptman

11 minutes ago

Postgrest/supabase, prest or similar

jppope

2 hours ago

Echos of the old web. Feels great to see this posted here