Fireship · @fireship

I replaced my entire tech stack with Postgres...

Uploaded March 4, 2025 · Length 8:13

I replaced my entire tech stack with Postgres...

Summary

Replacing a tech stack with PostgreSQL, exploring 11 ways to use it for web development, and building a full-stack application.

  • postgres tech stack
  • web development with postgres
  • full stack application
  • sql vs nosql
  • postgres extensions
  • serverless postgres
  • postgres cron
  • in-memory cache database
  • vector database
  • tech search engine
  • graphql postgres

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    modern web development sucks we have

  2. 0:01

    amazing tools that solve every problem

  3. 0:03

    and technically it's never been easier

  4. 0:05

    to build a billion dooll failed app idea

  5. 0:07

    the problem is that by the time you

  6. 0:09

    deploy it you end up paying 20 different

  7. 0:11

    ycb startups to use their fancy shovels

  8. 0:13

    you think you need an in-memory cache

  9. 0:15

    database to handle your low to five

  10. 0:16

    users you need a cron service you need

  11. 0:18

    authentication performance monitoring

  12. 0:20

    analytics serverless functions and the

  13. 0:22

    list goes on it's no coincidence that

  14. 0:24

    America's homeless population started to

  15. 0:25

    rise immediately after the release of

  16. 0:27

    nextjs in 2016 but what if I told you

  17. 0:30

    you could throw all of these shovels in

  18. 0:31

    the incinerator and use nothing but

  19. 0:33

    postgressql yes the relational database

  20. 0:36

    to achieve 90% of your web development

  21. 0:38

    needs in today's video we'll look at 11

  22. 0:40

    useful unorthodox and just plain weird

  23. 0:43

    ways to use postgress by the end of it

  24. 0:45

    we will have built a full stack

  25. 0:46

    application using nothing but an open

  26. 0:48

    source database but first of all what

  27. 0:50

    makes postgress special and why not use

  28. 0:52

    something like MySQL or SQL light well

  29. 0:54

    out of the box postgress provides

  30. 0:55

    Advanced Data types like binary Json

  31. 0:58

    arrays key value stores and even

  32. 1:00

    geometric types to Define shapes but

  33. 1:02

    more importantly it's extensible and you

  34. 1:04

    can even create your own custom data

  35. 1:05

    types over the years this has led to a

  36. 1:07

    massive ecosystem of extensions where

  37. 1:09

    developers have given it all kinds of

  38. 1:11

    crazy new features it's just like

  39. 1:12

    modding a game where you take something

  40. 1:14

    that sucks like Civilization 7 and

  41. 1:16

    install a bunch of mods to make it

  42. 1:17

    playable now before we get into the

  43. 1:18

    first example I first want to warn you

  44. 1:20

    that just because you can do something

  45. 1:22

    in postgress doesn't mean you should

  46. 1:23

    before you go and cancel all your shovel

  47. 1:25

    subscriptions don't forget to think

  48. 1:26

    critically and make sure you use the

  49. 1:28

    right tool for the job one of the great

  50. 1:29

    debates among web developers is SQL

  51. 1:31

    versus nosql and one of the key selling

  52. 1:33

    points for no SQL is that you can work

  53. 1:35

    with unstructured data like objects with

  54. 1:37

    Dynamic data that might be different for

  55. 1:39

    each record you can't do that in SQL

  56. 1:41

    because every table has a fixed schema

  57. 1:43

    well actually that's not true because

  58. 1:45

    postgress supports binary Json in this

  59. 1:47

    query you'll notice how we create a

  60. 1:48

    table with a Json B type and then insert

  61. 1:50

    some values into it as raw Json strings

  62. 1:53

    so pretty cool and believe it or not we

  63. 1:55

    can actually query this data now we can

  64. 1:56

    use a select statement followed by a

  65. 1:58

    wear clause and then this syntax to