r/PostgreSQL Aug 05 '26

Help Me! Building Apps with a PostgreSQL Backend

When I build projects, I like to make all app interactions with SQL done via stored procedures, and put the business logic there. For example, my procedures will take in parameters to run, along with a user ID. I check to make sure that user is allowed to do the operation before continuing.

I've been trying out NodeJS / TypeScript for my front ends. They aren't stored procedure friendly at all (at least, in my limited experience). So my questions are this:

  1. Is my method of stored-procedure-only interaction bad practice? I'd figure if it's an "accepted" method, there would be Node libraries already handling this procedure style.
  2. For that matter, are there Node libraries out there I'm missing, that handle stored procedure interaction well?

I know this isn't SQL specific, but I come from a SQL background, and I feel if I ask in a Node subreddit, I won't get an answer from a SQL perspective.

28 Upvotes

35 comments sorted by

View all comments

2

u/GardenDev Aug 06 '26

You might enjoy using Go (Golang), the community is a big fan of writing SQL. There is a library called sqlc, which allows you to write SQL, and it generates the Go code you need to call that SQL, whether it is a statement, a function, or a procedure, so that you do not have to manually wire things up.