---
type: video
yt_id: VVU2YVRMdUlfajQtMHdpRFN6bWFQY3RRLjRaaHRvT0ZLRlA4
videoId: 4ZhtoOFKFP8
title: "Easiest Database Setup in Next.js 14 with Turso & Drizzle"
date: "2023-12-01T14:00:03Z"
slug: "easiest-database-setup-in-nextjs-14-with-turso-drizzle"
image: 
  name: "easiest-database-setup-in-nextjs-14-with-turso-drizzle.jpg"
  alt: "Easiest Database Setup in Next.js 14 with Turso & Drizzle"
  width: 1280
  height: 720
status: 'published'
description: "I always use Turso and Drizzle for data persistence in my apps. It's so easy and fast and cheap. "
tags: []
---

I always use Turso and Drizzle for data persistence in my apps. It's so easy and fast and cheap. 

Previous Video: [https://youtu.be/z9PF8NdM4XU](https://youtu.be/z9PF8NdM4XU)
Next Video: [https://youtu.be/sjcLxYbw5BQ](https://youtu.be/sjcLxYbw5BQ)

Join this channel to support me making more videos:
[https://www.youtube.com/channel/UC6aTLuI_j4-0wiDSzmaPctQ/join](https://www.youtube.com/channel/UC6aTLuI_j4-0wiDSzmaPctQ/join)

Code: [https://github.com/meech-ward/code-gpt-example/tree/database](https://github.com/meech-ward/code-gpt-example/tree/database)

## Chapters:

* 0:00 Intro
* 0:49 Setup Drizzle ORM
* 6:11 Setup Turso 
* 8:41 Turso Local 
* 11:27 Create a Chat Server Action
* 18:29 Save GPT Messages
* 23:12 View Saved Messages
* 32:32 Cache, Uncache, and Revalidate Messages
* 35:06 Selecting Chats for Context
* 37:23 Summary


