Are you suggesting you allow the client-side JS app to call directly against the Postgres DB or is there another approach you had in mind?
Are you suggesting you allow the client-side JS app to call directly against the Postgres DB or is there another approach you had in mind?
One thing to keep in mind about PostgreSQL is you can do a lot of traditional middleware tasks (including message queues) in the database back-end with transactional control. These can even be hooked into other applications Remember, you can put a lot of what would otherwise go in a middleware layer in the database itself, especially with features in PostgreSQL like LISTEN/NOTIFY.
There are some limitations of this approach, but in general, I have found it ideal, but it requires thinking about your database differently. Instead of a data store on the bottom of the stack, you have an intelligent data storage and queuing system in the center of your environment.
It means there are choices between the traditional ones of putting everything in the database or in the middleware.
Almost directly. The JS frontend calls something like mod_libpq¹, or a very simple node.js "proxy". Something that just gets incoming http requests, executes stored procedures and sends back the response. A reverse proxy between the JS client and Postgres. That proxy can be very generic and reused between applications. All logic would live in the db.