DEV Community

Cover image for My Backend Stack Is Just TypeScript + Postgres. Here’s Why That’s Enough

My Backend Stack Is Just TypeScript + Postgres. Here’s Why That’s Enough

Shayan on April 17, 2025

Most people overthink their backend way too early. You start building a new product and suddenly you’re researching Kafka, Redis, background worker...
Collapse
 
code42cate profile image
Jonas Scholz

no serverless? how do you expect this to scale???

Collapse
 
xwero profile image
david duymelinck

Now you are just trolling :)

Collapse
 
code42cate profile image
Jonas Scholz

he's a friend, trolling is required by law :D

Collapse
 
nevodavid profile image
Nevo David

Neat, less mess means more time for building fun stuff instead of fixing problems all day, but it's pretty good. But does keeping things simple always work when your app grows and gets bigger challenges?

Collapse
 
shayy profile image
Shayan

I'd say so! Mostly because you can continue to vertically scale for a very very long time and that gives you time to start planning.

Collapse
 
alan_kelly_021ce70fe5eb86 profile image
Alan Kelly

I can't agree more with you. Many modern patterns are overkill for most projects and produce unnecessary complexity (and opportunities for things to break).

As I get older I appreciate simple over "clever". You can write a monolith in a way that can be decomposed in the future, if needed. But cross that bridge when you come to it.

Collapse
 
prabincankod profile image
Prabin Subedi

are you just using express and typescript or something else ?

Collapse
 
melroy89 profile image
Melroy van den Berg

I'm using Fastify with typescript. I know you didn't ask me. But there you have it.

I'm still interested in the answer of Shayan.

Collapse
 
shayy profile image
Shayan

Yes still using express and trpc

Collapse
 
juandadev profile image
Juanda Martínez

I was procrastinating on a personal project because of this. I've only focused on frontend development for the past years, and I was struggling with choosing the stack. By reading this post, you motivate me to stop overthinking about setting up all the perfect tools and just start. Great post!

Collapse
 
deadreyo profile image
Ahmed Atwa

Could you clarify what you mean by LISTEN/NOTIFY? Is that a feature in postgres?

Collapse
 
ryansgi profile image
Ryan B

LISTEN & NOTIFY events are supported in Postgres: postgresql.org/docs/16/sql-listen.... - They're postgresql's pub/sub system. It can do everything from respond to record changes (say a job state change, or a declined credit card transaction), INSERT notifications, sending messages between DB clients, etc.

But there are some important considerations:

  • Notifications don't have delivery guarantee - they're fire and forget.
  • Payload limit is 8000 bytes; if you’re pushing thicc data, just send IDs and fetch the rest
  • Only listeners within the same connection will hear it. You need long-lived connections - essentially this means that if you're connection pooling, you need ANOTHER connection to handle events.
  • If you're doing more than a few thousand inserts a second, it's not really suitable without some serious Pgsql tuning and you might be better off with something like BullMQ.

I use node's pg_listen module running on a dedicated docker container with a single non-pooled connection, and then something like NATS or gRPC to broker messages as needed.

Bonus reading: look into the pg_cron postgres extension for scheduling jobs in postgres directly:

SELECT cron.schedule('cleanup_expired_jwt_blacklist', '0 * * * *', $$
  DELETE FROM users_jwt_blacklist WHERE expires_at < NOW() - INTERVAL '1 hour';
$$);
Enter fullscreen mode Exit fullscreen mode

Combined with LISTEN/NOTIFY, it's super powerful.

Collapse
 
deadreyo profile image
Ahmed Atwa

Thanks for all the valuable insights!

Collapse
 
gurukulkarni profile image
Guruprasad Kulkarni • Edited

Well we are using kotlin with PostgreSQL, and on jvm at least we had to use a non maintained PostgreSQL specific connector without pooling to use listen notify. It was a few year's ago but are there better connectors now a days? Also listen notify has an 8k transfer limit afaik?

Having said that I like PostgreSQL a lot and always say, let's prove that our system is actually reaching the limits before adding more complexity using maybe load tests so I agree with the essence of the article.

Collapse
 
rob_v profile image
Rob Vandelinder

I'm a strong believer in the NAP stack - NestJS, Angular, and PostgreSQL. Still only TS and pSQL and a bit more boilerplate than your lean setup but it scales very easily and having both front and back end follow similar architecture patterns is huge when bringing new coders in.

Collapse
 
luislopez0 profile image
Luis Lopez • Edited

This is spot on. I've seen too many teams overcomplicate their architecture way before they have product-market fit. TypeScript + Postgres is a killer combo—fast to build, easy to maintain, and flexible enough for 95% of use cases. Love the reminder that users > infrastructure debates. Build the thing first, then worry about scale.

Collapse
 
wilmela profile image
Wilmela

Great article. I love "You’re Not Google. Scaling Isn’t Your Problem (Yet)". You are absolutely right my friend.

Give yourselves some space to breath dear devs.

Collapse
 
shayy profile image
Shayan

Thank you :)

Collapse
 
tim_demarest_8e9438c3a9ac profile image
Tim Demarest

100% on point. Less is very, very often more.

Collapse
 
lucas_vieira_06c3320a6a83 profile image
Lucas Vieira

F* great article!

Most startups and scale ups should just follow what you are suggesting

Collapse
 
shad_m_4a91b9ef7e2640aabe profile image
Shad M

Thank you , very nice Artical

Collapse
 
melroy89 profile image
Melroy van den Berg

I'm also using typescript with Fastify framework and MariaDB (mysql)...

I was thinking about refactoring everything to Golang. But you might be right.. Its easier to on board new contributors, since the frontend is also Typescript with Angular.

What do you think about using MariaDB vs Postgresql?

Collapse
 
melroy89 profile image
Melroy van den Berg

@shayy so is MariaDB also approved 😊?

Collapse
 
krd8ssb profile image
Steven Brown

I usually only jump between the following now depending on my requirements but it follows a very similar pattern of Typescript, and in my case, MySQL.

  • NestJS: GraphQL, Complex-ish API, standard website (sometimes it may be Overkill but with tooling it's incredibly fast to market)
  • Nuxt 3: SPA w/simple REST Backend, SSR, etc...

MySQL for me because I'm the most familiar with it, I have more experience with it, and I've been using it since about 2003

Collapse
 
mjomble profile image
Andres Kalle

Totally agreed 👍

When it comes to Postgres (or any other database), I usually prefer to use it simply for storing and retrieving data, keeping all of the business logic, etc on the Node.js side.

Hence I'm curious - what kind of advantages does LISTEN/NOTIFY have over handling events entirely within Node.js?
Especially if you have only one Node.js instance.

Collapse
 
nevodavid profile image
Nevo David

i think keeping things this simple sounds great tbh - i've def wasted way too much time overbuilding for stuff that didn't need it

Collapse
 
urbanisierung profile image
Adam

Full ack. Especially the part about postgres: most people don't know how powerful a postgres is. LISTEN/NOTIFIY alone is very unknown, although you can do so many things with it.

Collapse
 
urbanisierung profile image
Adam

Also added your article to the next issue of the weeklyfoo.

Collapse
 
khalid_achwaq_04fb3ca1d3d profile image
Khalid Achwaq

Next: let's talk hardware (different needs/setups for different applications for example: Fintech app, messaging and chat app, social media app, e-commerce app etc...)

Collapse
 
eric_chen_b1f933f09df19a7 profile image
Eric Chen

good luck scaling this -- just saying typescript is good for demoing but can quickly destroy your stack...

Collapse
 
ron_johnson_7d711e3294d7e profile image
Ron Johnson

But that’s the point: when you need to scale, then is the time to get complicated.