---
title: "TypeScript, PostgreSQL, Prisma Backend"
url: https://daily.dev/posts/typescript-postgresql-prisma-backend-bdyplfr6x
source_url: https://www.prisma.io/blog/backend-prisma-typescript-orm-with-postgresql-auth-mngp1ps7kip4
type: article
source: "Prisma Blog"
published: 2026-05-31T07:45:35.007Z
updated: 2026-05-31T09:33:16.915Z
tags: ["typescript", "authentication", "postgresql", "prisma"]
reading_time: 26
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript, PostgreSQL, Prisma Backend

**[Prisma Blog](https://daily.dev/sources/prisma-blog)** · 26 min read · 0 upvotes · 0 comments

## Summary

A step-by-step guide to securing a TypeScript and PostgreSQL REST API built with Hapi and Prisma. Covers email-based passwordless authentication using a two-step token flow (email token + long-lived JWT), stateful JWT strategy with database-backed token validation, and role/resource-based authorization using Hapi's pre-functions. Includes Prisma schema migration to add a Token model, SendGrid integration for email delivery, and updating tests to handle authenticated routes.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.prisma.io/blog/backend-prisma-typescript-orm-with-postgresql-auth-mngp1ps7kip4>

---

Tags: [#typescript](https://daily.dev/tags/typescript), [#authentication](https://daily.dev/tags/authentication), [#postgresql](https://daily.dev/tags/postgresql), [#prisma](https://daily.dev/tags/prisma)

[View this post on daily.dev](https://daily.dev/posts/typescript-postgresql-prisma-backend-bdyplfr6x)
