If you aren't writing a web app then you can potentially scrap the web server tier entirely, which can yield security and simplicity benefits in some cases. For example, any app where the userbase size is well known and stable e.g. internal apps, apps for medical, military, industrial use cases. In such a two-tier architecture you implement your business logic using either SQL or server extensions like PL/Java (
https://tada.github.io/pljava/) and then provide users with a desktop or mobile app to access the database directly. PostgREST is useful for languages without good DB drivers, or where you need to traverse HTTP only firewalls/proxies.
Advantages:
• Get back all the time spent boilerplating and bikeshedding ad-hoc app specific REST protocols.
• Eliminates the (near) superuser privileged web servers that pose a security risk if compromised. Eliminate SQL injection, XSS, XSRF as bug classes.
• Allows smart users like business analysts to bypass the UI partially or completely and go straight to a SQL console, because end users = db users 1:1 and ACLs are understood by the RDBMS directly.
• Use UI frameworks and languages that aren't JavaScript. Use context menus, menu bars, hotkeys OS services or whatever else makes your users productive.
• Use multi-threading, files, special hardware as part of your core app architecture if you need it.
• If you can afford the server side resources: align DB transaction length with UI "transaction" length.
Obviously there are also downsides. I wouldn't write Instagram this way. Postgres doesn't scale very well to lots of connections. Oracle/MSSQL scale a lot better and have other advantages like much better blob support, but you'd have to get comfortable with the idea of building new apps on them.
You can mix and match, it doesn't have to be purist. Retain a thin, simple and rarely updated web server that just handles the requests you don't send directly to the DB e.g. for things like ElasticSearch. Or if you can (i.e. not on Supabase) write custom Postgres extensions that let you use SQL stored procedures as your RPC protocol. It has some advantages over HTTP.
Lately I've been experimenting with this design a bit. The traditional hassle has been non-web distribution to desktops. https://conveyor.hydraulic.dev/ fixes that. If you're using something like Electron or the JVM you can do a build+release cycle for Win/Mac/Linux in about 60 seconds all from your dev laptop, and you can make installed clients do a fast update check on each launch just like a web app would. There are some open questions about the best way to handle user authentication when connecting direct to a DB if you don't want passwords. The nice thing is you can e.g. bind the results of SQL query or an ORM directly into your UI toolkit. JSON, REST, custom paging code and all the other goop CRUD apps end up with just boil away.